Skip to content

Hold the letter bell while a Codex CLI plan waits for approval - #752

Merged
yansfil merged 24 commits into
mainfrom
prd/codex-plan-approval-hold
Oct 7, 2026
Merged

yansfil merged 24 commits into
mainfrom
prd/codex-plan-approval-hold

Conversation

@yansfil

@yansfil yansfil commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Related: PRD agents/prd/codex-plan-approval-hold/prd.md (local). The reviewable contract is below.

Summary

  • Codex CLI가 plan 모드에서 "Implement this plan?"을 띄운 채 기다릴 때, 편지 종이 Enter를 쳐서 첫 항목 "Yes, implement this plan"을 골랐습니다(2026-10-07 실측 3/3). 운영자가 승인하지 않은 계획이 구현되기 시작했습니다.
  • 이제 hide는 이미 읽는 Codex 세션 파일(rollout)의 턴 기록(task_started의 plan 모드, Plan 항목, task_complete)으로 계획 승인 대기를 알아내고, 그동안 종을 보류 사유 awaiting_operator로 치지 않습니다.
  • 같은 동안 그 Codex 행은 기존 승인 대기(approval demand)로 Needs You에 남고, 읽어도 빠지지 않으며, 다음 턴이나 사람의 메시지가 오면 빠집니다. wire와 web 변경은 없습니다.
  • 판정은 Hide AI 분석이 아닌 결정적 사실이라 요약을 꺼도 같고, 읽은 Herdr state_change_seq에 묶여 지금 상태에 대해 읽지 못한 Codex pane은 session_unread로 종을 보류합니다. Claude Code pane은 그대로입니다.
  • 문서: docs/delivery.md, status-model.md, UI_BEHAVIOR.md, ARCHITECTURE.md, 성능 ledger.

Live: a real Codex CLI at "Implement this plan?" (Herdr reads idle) sits in Needs You with the ! approval mark

Playwright e2e on the pinned Herdr: a rollout whose plan turn ended puts the Codex row in Needs You

Review

  • 판단해 주세요: Herdr가 Codex의 task_complete 기록보다 먼저 정지 상태를 읽으면, 그 상태에서는 종만 보류되고 Needs You는 다음 상태 변화까지 뜨지 않습니다. 재읽기를 더하지 않았습니다(PRD B10).
  • 판단해 주세요: "No, stay in Plan mode"는 세션 파일에 아무것도 쓰지 않아서, 행이 다음 턴까지 Needs You에 남습니다.
  • 판단해 주세요: 세션 파일을 못 찾는 Codex pane(최근 7일 폴더 밖), 그리고 label generator lock이 없는 daemon(같은 Herdr를 따르는 두 번째 hided, 재시작이 겹친 뒤 최대 30초)에서는 Codex 종이 보류됩니다.
  • 조심해서 볼 파일: herdr-core/src/delivery/doorbell.rs judge - failure path. 모름을 "대기 없음"으로 읽지 않습니다.
  • 조심해서 볼 파일: herdr-core/src/labels/overlay.rs waiting, labels/{worker,store}.rs - seq 묶음과 serde 기본값으로 저장되는 새 필드.
  • 조심해서 볼 파일: herdr-core/src/session_sync/coordinator.rs - runtime mutex. overlay를 lock 밖에서 먼저 만들고 두 경로 모두 observe_delivery에 넘깁니다(main #743과 merge 해결 지점).
  • 조심해서 볼 파일: hide-session/src/turns.rs - 대기를 언제 안다고 볼지 정하는 match.
  • 비용 검토: 세션 읽기는 라벨 작업이 이미 하는 상태 변화 시 증분 읽기에 실리고, 새 파일 읽기, 프로세스, lock 안 I/O는 없습니다.

Evidence

  • 확인한 것: sealed verify S1 cargo test --workspace, S2 lint PASS(merge head 267aad3). 첫 두 시도는 base에서도 실패하던 pane process 테스트 때문이었고, main의 Draw pane topology changes before Herdr confirms them #743 수정으로 대체됐습니다.
  • 확인한 것: hide-session 계약 테스트가 합성 Codex 0.160.1 계획 턴 표본으로 대기 시작, 다음 턴, 사람 메시지, aborted 턴, 질문으로 끝난 plan 턴, 모르는 형식, 증분 읽기와 rescan을 확인합니다.
  • 확인한 것: core 테스트가 seq 묶음(이전 seq의 사실은 보류), 모름은 보류, 끝나지 않은 일반 턴은 울림, 요약 꺼짐, 재시작, 필드 없는 기기 helper, Claude Code 불변을 확인합니다. merge 뒤 focused herdr-core 298/298을 3회 돌렸습니다.
  • 확인한 것: Playwright codex-plan-approval.spec.ts가 고정 Herdr와 hided 위에서 계획 대기 rollout이 행을 Needs You로 넣고, 다음 턴 기록과 상태 변화가 빼는 것을 확인합니다. 심은 결함에서 실패하는 것도 확인했습니다.
  • 확인한 것: 격리 live(private socket의 고정 Herdr 0.9.3, private HOME, 이 브랜치의 hided 1560a90, 로그인된 Codex CLI 0.160.1, hooks 꺼짐): Herdr가 계획 메뉴를 idle로 읽는 동안 편지가 awaiting_operator로 한 번 기록되고 보류됐으며, 키 입력 0회, 메뉴 그대로였습니다. 승인 뒤 다음 턴이 끝나자 종이 한 번 울렸습니다.
  • 확인한 것: Herdr는 계획 메뉴를 remote Codex manifest 2026.10.01.1에서는 idle로, 번들 2026.09.23.1에서는 unknown으로 읽습니다(문서에 manifest별로 적음).
  • 확인하지 못한 것: B1 race 경우의 live 재현, 기기 pane live, 계획 대기 중 hided 재시작 live, 운영자의 실제 Codex hook 구성(live는 hooks를 끄고 세션을 직접 보고함).
  • 확인하지 못한 것: live 검증이 ~/.codex/sessions에 Codex rollout 3개를 남겼습니다(설정 변경 없음).

AI tooling: native review subagents read the diff; their findings and dispositions are in the record below.

Verification record
  • PRD: agents/prd/codex-plan-approval-hold/prd.md (sha256 e67aa258a404f1a493a93eec74933e5324e0fcbccbbf40ab605b23e78d819012)
  • Base 9f14487 → head 267aad3, verified 2026-10-07T15:55:58.411Z: PASS
  • Verification report: agents/runs/codex-plan-approval-hold/verification-report.json and agents/runs/codex-plan-approval-hold/verification-report.md; source fingerprint f5b5d1bca59a1702fd81feceebf3c2c3946c71d2f7d3503bac7eb4d8b6b4cf14
  • Suites:
    • S1: GREEN bash scripts/verify-cargo.sh test (exit 0)
    • S2: GREEN bash scripts/verify-cargo.sh lint (exit 0)
  • Reviews:
    • Fidelity (1560a90, follow-ups to 6ab4ea3): Fix now - an unknown record format read as "nothing waits" (fb939cc, 6c96181); fixed.
    • Code (1560a90, follow-ups to 6ab4ea3): Fix now - bell kind mapping disagreed with the session-read kind (5c9342b), approving Enter not counted as the operator's submit at unknown (1bd5647), e2e negative check proved nothing (c6c9e75); fixed. A re-read of unsettled turns (8ad7ab8) was reverted (9c0f057) under PRD B10.
    • Security (1560a90, follow-ups to 6ab4ea3): no open Fix now.
    • Code, merge resolution only (84e189e): no Fix now. 267aad3 is a conflict-free merge of main (Ship software-factory-ui #708) on top, verified again.
    • Observer read of the doorbell verdict, the seq binding and both coordinator call sites (6ab4ea3): no Fix now.
    • Follow-up improvements: per-pane head-of-line letter judging (predates this diff), Codex sessions outside the seven newest day folders hold forever, turn_id length cap, phone reply typing Enter on a plan row.
  • Evidence: 8 registered (1 log, 3 file, 4 screenshot); paths are local to the run directory
    • agents/runs/codex-plan-approval-hold/evidence/live/core.jsonl
    • agents/runs/codex-plan-approval-hold/evidence/live/delivery-ledger.json
    • agents/runs/codex-plan-approval-hold/evidence/live/labels.json
    • agents/runs/codex-plan-approval-hold/evidence/live/needs-you-idle-plan-menu.png
    • agents/runs/codex-plan-approval-hold/evidence/live/needs-you-unknown-status.png
    • agents/runs/codex-plan-approval-hold/evidence/live/README.md
    • agents/runs/codex-plan-approval-hold/evidence/e2e/codex-plan-approval-waiting.png
    • agents/runs/codex-plan-approval-hold/evidence/e2e/codex-plan-approval-approved.png
  • Changed paths: 29 against main (more against the run start base 9f14487, which includes main merged in)

yansfil added 24 commits October 7, 2026 22:06
The session read folds Codex CLI's turn records (task_started with its mode,
the Plan item, task_complete, turn_aborted, a person's message) into an
agent-neutral turn tracker that answers whether the last turn waits for
the operator to approve a plan. The tracker rides on the label transcript
request and answer, so an incremental read, a restart from the anchor and
a device helper carry it; an answer without it reads as not known.
The label worker stores the session read's turn tracker beside its
checkpoint and the Herdr state_change_seq the read was asked under, so
the overlay only answers what an agent waits for when that read is for
the agent's current state and session. A restart resumes without a read
when the wait was read for the same state; a record without a tracker
is read once. Rows carry the wait as awaiting_operator in their facts.
Codex CLI's plan approval menu reads done to Herdr, and the bell's Enter
picks "Yes, implement this plan". The delivery observation now carries
what the pane's session read says for Herdr's current state, taken from
the label overlay, which the coordinator computes before delivery
observes the payload. The bell holds with awaiting_operator while a plan
waits, and with session_unread when an agent whose read reports turns
was not read for the current state and session. Agents whose read
reports no turns are belled as before.
A Codex CLI plan that waits for the operator's approval reads done to
Herdr. When the session read says so for the agent's current state, the
row's demand is approval and it is held in Needs You like a prompt
Herdr reports blocked, so reading the row does not drop it. The Enter
that approves such a plan stays the operator's submit, since Codex CLI
writes the next turn's message from it.
Herdr can report working before Codex CLI writes the new turn's start, so
the read for that state still finds the finished plan. A running agent
waits on no one, so the row ignores the wait until Herdr's state rests.
The spec starts the fixture shim as `codex` on an isolated pinned Herdr and
hided, writes a Codex CLI 0.160.1 rollout whose plan-mode turn proposed a
plan, and moves Herdr's state: the row reaches Needs You with the
approval mark, and the next turn's record takes it out.
delivery.md no longer calls Herdr's blocked the only menu guard and
explains the awaiting_operator and session_unread holds, status-model.md
and UI_BEHAVIOR.md draw the wait as an approval held in Needs You,
ARCHITECTURE.md places the turn tracker in the label read, and the
performance ledger records that the read adds no work of its own.
@yansfil
yansfil merged commit 0eff40b into main Oct 7, 2026
20 checks passed
@yansfil
yansfil deleted the prd/codex-plan-approval-hold branch October 7, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant