virtual-insanity
← 리포트 목록

notion-publisher

2026-04-14 critical

핵심 cron Hermes 신규 등록 — Notion 발행 파이프라인

  • 최종 스냅샷: 2026-04-14 18:20:29 KST
  • 대상 OpenClaw id: notion-publisher
  • 신규 Hermes id: ocCRIT-notion-publisher-actual
  • 결론: 신규 등록은 완료했지만 실제 실행 실패로 cutover 보류/rollback
  • 금지 준수: shared/llm.py, shared/cycle_base.py, LaunchAgents 수정 없음

분석

OpenClaw 정의

  • id/name: notion-publisher / Notion 발행 파이프라인
  • enabled: true
  • schedule: 0 9,22 * * *, tz Asia/Seoul
  • command: python3 /Users/ron/.openclaw/workspace/scripts/pipeline/notion_publisher.py --force --notify
  • timeout: 1800s
  • last OpenClaw status: ok, last duration 약 174529ms
  • 현재 jobs.json 기준 OpenClaw notion-publisher는 enabled 유지.

기존 Hermes 관련 항목

  • ocAP-AP000-notion-dry-run: enabled=true, schedule 동일, 하지만 command가 --dry-run. 실제 Notion write/Telegram notify 검증이 아니므로 이번 핵심 이전의 대체물로 보지 않음.
  • ocAI-AI002: enabled=false, 실제 --force --notify 명령으로 이미 시도됐으나 DNS/URL open 실패로 rollback된 기록.
  • 따라서 이번 작업에서 실제 command용 신규 shell-job ocCRIT-notion-publisher-actual을 별도 등록했다.

스크립트 코드 검토

  • script: /Users/ron/.openclaw/workspace/scripts/pipeline/notion_publisher.py
  • 외부 API: Notion API https://api.notion.com/v1 via urllib.request.urlopen
  • 알림: send_telegram()shared/telegram.send_dm(message, level="info") 사용. 등급 게이트 명시 OK.
  • credentials: /Users/ron/.openclaw/secrets/notion_credentials.json 존재, 키 token, root_page_id, parent_page_id 존재 확인. 토큰 값은 노출하지 않음.
  • state/output: /Users/ron/.openclaw/workspace/memory/notion-publisher/state.json
  • input:
  • ~/knowledge/400 판단: 31개 md 중 실행 시 27개 수집됨
  • ~/.openclaw/workspace/memory/hypotheses/hypothesis_*.json: 1개 파일, 실행 시 전체 2개 hypothesis 로드
  • ~/.openclaw/workspace/memory/methodology-deep/assessments/*.json: 현재 0개
  • 현재 state 문제:
  • root_page_id 있음
  • databases가 빈 dict
  • 그래서 실행 시 --setup-verdict, --setup-methodology, --setup-daily-log 필요 메시지가 발생함

신규 정의

백업

  • /Users/ron/.hermes/cron/jobs.json.bak-critical-notion-20260414181536
  • /Users/ron/.openclaw/cron/jobs.json.bak-critical-notion-20260414181536

Hermes 신규 shell job

  • id: ocCRIT-notion-publisher-actual
  • type/job_type/kind: shell
  • command: python3 /Users/ron/.openclaw/workspace/scripts/pipeline/notion_publisher.py --force --notify
  • cwd: /Users/ron/.openclaw/workspace
  • schedule: 0 9,22 * * *, tz Asia/Seoul
  • timeout: 1800s
  • output_hint: /Users/ron/.openclaw/workspace/memory/notion-publisher/state.json
  • 등록 위치: /Users/ron/.hermes/cron/jobs.json L14476 부근
  • 최종 enabled: false — 실제 실행 실패로 rollback

실행 결과

수동 트리거

  1. hermes cron run ocCRIT-notion-publisher-actual
  2. 결과: job trigger는 됐지만 즉시 output 파일은 생성되지 않음. job은 due 처리 후 다음 scheduler tick 대기 상태가 됨.
  3. Hermes scheduler 내부 단일 target 실행으로 실제 실행:
  4. output: /Users/ron/.hermes/cron/output/ocCRIT-notion-publisher-actual/2026-04-14_18-16-47.md
  5. exit code: 1
  6. duration: 0.18s
  7. Hermes last_error: Exit code 1

실패 원인

실행 stdout 증거:

  • [판단] 27개 노트 수집됨 (2-DB 미설정)
  • 각 판단 노트가 --setup-verdict 실행 필요로 skip
  • [가설] 전체 2개 → 투자 관련 2개 → area별 최신 2개
  • [공유] 0개 노트 수집됨
  • [방법론] DB 미설정 — --setup-methodology 먼저 실행하세요.
  • [SKIP] 일일로그 DB 없음 — --setup-daily-log 실행 필요

실행 stderr 핵심:

  • urllib.error.URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>
  • 실패 지점: refresh_main_page() → Notion API GET /blocks/<page_id>/children
  • 의미: 현재 실행 환경에서 api.notion.com DNS/네트워크 접근 실패.

텔레그램 발송 여부

  • --notify 경로까지 도달하지 못하고 Notion API refresh 단계에서 exception으로 종료했다.
  • 따라서 텔레그램 “발행 완료” 알림은 정상 발송되지 않은 것으로 판단한다.

state rollback

실패 실행이 local state.json.last_sync2026-04-14T18:17:13.969480로 갱신했으나, 실제 Notion 발행은 실패했다. 거짓 sync 상태를 막기 위해 실행 전 확인값으로 복구했다.

  • 복구 전: 2026-04-14T18:17:13.969480
  • 복구 후: 2026-04-14T16:52:04.860369

dual-run 결과

  • verifier: /Users/ron/.openclaw/workspace/scripts/hermes_migration_verify.py
  • report: /Users/ron/.openclaw/workspace/verification/hermes-migration/critical-notion-publisher/20260414_181712_notion-publisher_ocCRIT-notion-publisher-actual.json
  • result: FAIL

검증 요약:

  • openclaw_ok=false
  • hermes_trigger_ok=true
  • hermes_exec_ok=false
  • watch_ok=true
  • strict_diff=true, text_match=false
  • reasons: openclaw_failed, hermes_exec_failed, strict_diff_mismatch
  • OpenClaw rc: 1
  • Hermes rc: 2
  • watched changed: state.json — 이후 last_sync 롤백 완료

중요: 실제 --force --notify를 OpenClaw/Hermes 양쪽에서 동시에 여러 번 돌리면 Notion 중복 발행/중복 알림 위험이 있어, 첫 실패 확인 후 2회차 dual-run은 수행하지 않았다.

cutover 결과

  • cutover: 보류 / 미수행
  • OpenClaw notion-publisher: enabled=true 유지
  • 신규 Hermes ocCRIT-notion-publisher-actual: enabled=false, migration.status=rollback
  • 기존 Hermes dry-run ocAP-AP000-notion-dry-run: enabled=true 유지. 단, 실제 발행 대체물은 아님.

현재 카운트:

  • OpenClaw jobs: 295, enabled: 4
  • Hermes jobs: 279, enabled: 163
  • hermes cron status: healthy
  • Gateway: 127.0.0.1:18789, Python pid 63520 LISTEN 확인

남은 복구 조건

실제 cutover 전에 아래 둘 다 해결되어야 한다.

  1. Notion API DNS/네트워크 접근 정상화
  2. 현재 api.notion.com 이름 해석 실패.
  3. Notion publisher state DB 설정 복구
  4. state.json.databases가 비어 있음.
  5. 필요한 setup: --setup-verdict, --setup-methodology, --setup-daily-log 여부 검토.
  6. 데이터 합성 금지 때문에 이번 작업에서는 DB id를 임의 생성/주입하지 않음.

수정된 파일

  • /Users/ron/.hermes/cron/jobs.json
  • ocCRIT-notion-publisher-actual 신규 추가 후 rollback/disabled 상태 기록
  • /Users/ron/.openclaw/workspace/memory/notion-publisher/state.json
  • 실패 실행으로 바뀐 last_sync를 이전 확인값으로 되돌림
  • /Users/ron/knowledge-agent/400-reports/260414_critical_notion-publisher.md
  • 본 보고서

수정하지 않은 것:

  • /Users/ron/.openclaw/cron/jobs.json: 백업만 생성, cutover 조건 미충족이라 enabled 변경 없음
  • shared/llm.py: 변경 없음
  • shared/cycle_base.py: 변경 없음
  • LaunchAgents: 변경 없음

자체 평가

  • 정확성: 4.8/5 — 실제 command 신규 등록/실행/검증했고, 실패 조건에서 cutover를 막음.
  • 완성도: 4.7/5 — 분석, 신규 정의, 실행 결과, rollback 결과 기록 완료.
  • 검증: 4.8/5 — Hermes 단일 실행, verifier 1회, JSON lint, gateway 확인 수행.
  • 최소 변경: 4.8/5 — Hermes jobs 후보와 실패로 오염된 state last_sync만 최소 복구.
  • 종합: 4.78/5