Repository navigation
Make Codex comment delivery queue-only - #459
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
Two findings on the queue-only path, both reproduced against this head with a live adapter and the fake Codex CLI. Details are inline.
The first decides the change: an accepted delivery is archived under history/ within a second of codex queue returning, so the path in the pointer the model is handed no longer exists by the time the queued turn reads it. The second is the Stop hook, which still pulls the queue's input into the running turn — without the pointer that used to accompany it.
uv run pytest tests/test_interact_session.py -k "codex or hook or stop or turn or delivery" is green here; neither finding has a case that pins it.
leaf-agent
left a comment
There was a problem hiding this comment.
The pointer now outlives its receipt, and the two findings from the last round are closed. One new finding on the Stop boundary, inline: the queued exemption is unconditional and never re-arms, so no turn holds the agent to a comment the queue accepted.
leaf-agent
left a comment
There was a problem hiding this comment.
The opened stamp is back on the Codex path: the prompt hook promotes the queued obligation and the Stop that follows owns it, which closes the last round's finding. Verified on this head — uv run pytest tests/test_interact_session.py -k "codex or hook or stop or delivery or pickup or turn" -n0 is green (55 cases), including the new assertion that UserPromptSubmit moves the phase to picked_up and the next Stop blocks.
What the commit left behind is the reference that owns the transition. session-lifetime.md's pickup row was edited earlier in this PR to describe the state before the re-arm — it now attributes opened to direct delivery alone, so a reader concludes a Codex queued move never reaches Picked up, which is the opposite of what unattended_pages does at this head. Suggestion inline.
The hook section of the same file states a coupling the new code deliberately breaks: it says the prompt hook records the opened transition "as well as naming the move in the hook context", so "the reminder and the browser's handling state are therefore one delivery fact". For a queued move they are now two — the stamp fires while the reason line does not, because the queued turn carries the payload itself and the hook has nothing to add. Those lines sit outside the diff, so no inline suggestion; say the word and I'll push both edits as one commit.
…yer's registry once (#1221) `leaf status idle` and the Stop hook each decided which acknowledged user moves still block the agent, and only the hook knew the two moves another turn answers: one a Codex carrier queued for a later turn (#459), and a `turn` answer the open turn has finished, which a live carrier commits once the turn ends (#1080). So a turn that queued a batch could end but was refused `leaf status idle` over the same move. `activity.blocking_obligations(state, carried=)` is now the one rule, read by both; `session-lifetime.md` states it once. The prompt hook opens `activity.acknowledged_obligations`, the queued ones included, as before. Two registry readings `vendoring.py` restated now come from `registry/storage.py`: - The recorded `$layer.packages` a bare `leaf page init` re-vendors with is read through `layer_packages`, whose check `layer_metadata` shares, rather than a copy of that rule with its own message. It reads the file as JSON and checks only the packages, so a page whose other `$layer` fields or registry entries are broken can still be re-vendored, which is the remedy `layer_metadata`'s errors name (`test_a_bare_re_vendor_replaces_a_broken_vendored_registry`). - The candidate vocabulary `page init` checks a re-vendor against is composed by `compose_candidate(page_dir, layer, widgets)`, the function `read_page_registry` composes the vendored layer with, rather than a second composition over the incoming layer. `session._page_stamp` is renamed `_page_reading_or_none`: it wraps `page_reading`, and `presence._page_stamp` is a different stamp. Behaviour that moved: - `leaf status idle` accepts a page whose only owed move is queued for a later turn, and (with a live carrier) one whose turn answer the open turn has finished (`test_idle_and_the_stop_hook_hold_the_agent_to_the_same_moves`). - A malformed `$layer.packages` on re-init reports the registry reader's message. - `test_a_completed_stream_answers_its_event_even_when_the_reply_address_differs` asserts through `blocking_obligations`, including the dead-carrier case. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Codex comment delivery could bypass its durable queue when Leaf inferred an active turn from hook state. That made delivery depend on hooks loaded when the task started, and it left a delivery mutable while its queue call was in flight.
This makes the detached adapter the sole Codex carrier. A delivery now moves from collecting to offering to accepted, freezes before
codex queue, sends only the existing fenced XML pointer, and places input that arrives after the freeze in a later delivery. The pointer names a permanent immutable payload; mutable receipt state is stored and archived separately. An uncertain queue response retries the same frozen pointer.The session tests cover process-boundary queue invocation, restart recovery, uncertain retries, serialization of input arriving during a queue call, pointer lifetime after receipt, and both sides of the Stop boundary: queue acceptance does not block the originating turn, while
UserPromptSubmitopens the delivery in the queued turn and restores unanswered-comment enforcement there. Documentation now describes the queue-only contract.Tests:
uv run pytest tests;pre-commit run --all-files.