Repository navigation
Name each delivery's carrier, and route every answer through answer - #1080
Merged
Merged
Conversation
A delivery now names its `carrier` and says once, in `acknowledge`, how the agent confirms it. Only the reader of a `leaf wait` acknowledges, and the field phrases that for how its harness runs the next wait. On the queue and App Server carriers, Leaf has already acknowledged, so the field is null. This replaces the per-event wait clause in `$events.handling`, which a pick delivered on its own never received. A thread reply that the claimant's App Server turn writes is now its own answer kind, `turn`, with the reply attempt. Freezing a delivery for App Server routes the reply there, and so does `activity` once the reply binding belongs to the claimant. The `leaf reply` refusal, `thread_obligation`, the Stop hook, `answer_command`, `stream_reply_target`, and the registry's new `answering.turn` all read that answer. They no longer check the binding, a `turn_answers` flag, or the carrier. The delivered field is `answer`, the same object as the workflow's. `obligation.response` and the unused `as_of_seq` are gone, and the format is `leaf-delivery-v3`. Behavior that moved: - An App Server observer that adopts a queued pointer no longer binds its reply to the turn. That delivery names a plain reply, so `leaf reply` answers it instead of refusing it. - Stop, `leaf status idle`, and `leaf wait --help` no longer append "run `leaf wait --ack` in the background". For a Codex direct wait, that sentence contradicted "poll with `write_stdin`". - The watcher forwarding note and the App Server contract no longer override their deliveries in prose. - The removed `version` answer kind is gone from ANSWER_KINDS, the thread reference, and the hosted instructions. Tests: the carrier and per-case snapshots are re-recorded without the `when: carrier` rows. Stop, idle, and help outputs lose the appended acknowledgement paragraph. The shared-protocol test now shares the answering protocol, because unpicked updates carry no protocol. The `_stream_answers` and plain-reply stream-target tests now assert the `turn` answer. A new test covers an observed queue pointer. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
previously approved these changes
Sep 24, 2026
# Conflicts: # skills/leaf/scripts/leaf/delivery.py
leaf-agent
reviewed
Sep 24, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
A collecting Codex record from the previous format still passes delivery_records(): RECORD_FORMAT remains leaf-codex-delivery-v1, while those records' captured events have obligation instead of answer. If that record is offered after this change, append_batch() counts no existing reply and offer_delivery() freezes a v3 envelope whose older event has no answer or answering instructions. An accepted pointer can then leave the user's move unanswered. Bump the record format so the reader drops these records and recollects the still unacknowledged page events. I can push that change if useful.
A collecting record holds captured events in the delivery's shape, which now names each owed move's `answer` rather than `obligation`. A v1 record offered after the change would freeze an event with no answer and no answering clauses, so the record format moves to v2: `delivery_records` drops the old record and the watch recaptures its unacknowledged events. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
previously approved these changes
Sep 24, 2026
# Conflicts: # docs/how-it-works.html # tests/_regtest_outputs/test_interact_contract.test_each_case_of_an_event_is_told_what_the_snapshot_shows__0/snapshot.yaml # tests/_regtest_outputs/test_website_server.test_hosted_agent_receives_the_response_instructions_and_delivery[receipt]__0/snapshot.yaml
leaf-agent
approved these changes
Sep 24, 2026
max-sixty
added a commit
that referenced
this pull request
Sep 26, 2026
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which route acknowledges a delivery, and which route answers a thread reply, were each decided in several places. This moves both onto the delivery and the move's
answer, so every consumer reads one fact.The model
The envelope names its carrier and says once who acknowledges it. A delivery now carries
carrier(wait,queue,app-server) andacknowledge. Onwait,acknowledgeis the instruction to the reader of the wait, phrased for how its harness runs the next wait: a background task for Claude Code, unified exec polled withwrite_stdinfor Codex (Harness.run_ack). Onqueueandapp-server, Leaf acknowledged the delivery itself, and the field isnull. It sits ahead ofbatches, so output cut off partway still shows it.Acknowledgement was a per-event
handlingclause keyed oncarrier. It was a statement about the whole delivery, so a page pick with no comment beside it got no acknowledgement instruction even though itsleaf waitbatch needed one.The answer route lives in
answer. Answer kinds arereply,turn,markupandreceipt. Aturnanswer is a thread reply that the claimant's App Server turn writes with its opening and final messages, under a replyattempt. Two places produce it:freeze_deliveryfor theapp-servercarrier (delivery.carried_answer), so the delivery tells the agent before the turn binds anythingactivityonce a reply binding belongs to the claimant's sessionEvery consumer reads that answer:
answer_command/unanswered, theleaf replyrefusal (kind == "turn"and a different attempt),thread_obligation, the Stop hook (_turn_wrotereads the workflow'sanswerand its reply draft),stream_reply_target, and the registry, whoseanswering.turnreplaces the carrier-keyedwhenonanswering.reply. No$eventsclause readscarrieranymore.One name. The delivered event field is
answer, the same objectleaf page statelists on the move's workflow.obligation.responseand itsas_of_seqare gone, and nothing readas_of_seq. The format is nowleaf-delivery-v3.Behavior that moved
leaf reply. Before this change,leaf replythen refused it as the turn's. Nowstream_reply_targetreturns only aturnanswer, so the observer opens the turn on the delivery's pages, binds nothing, andleaf replyworks. The prose override inhost-codex-app-server.mdis gone. Test:test_an_observed_queue_pointer_leaves_its_reply_to_leaf_reply.leaf status idleandleaf wait --helpstopped appendingACK_BATCH_INSTRUCTION("runleaf wait --ackin the background") after Codex's "poll … withwrite_stdin". The delivery the poll yields states the Codex acknowledgement.acknowledgesays of whoever ran the wait.answer_command, where it used to check a separateturn_answersflag.turnanswer carriesattempt.leaf page stateshows it on a bound move.leaf reply --initiateson a thread whose reply is turn-bound says to finish in the final message, rather than saying to use--for, which would then refuse too.versionanswer kind is gone fromANSWER_KINDS,conversation-threads.md, and leaf.page's hosted instructions (worker/server.py), which also readobligation.response.Tests and snapshots
The carrier and per-case snapshots were re-recorded. The
when: carrierrows are gone; the App Server cases oweturn; each envelope showscarrierandacknowledge. Stop, idle andwait --helpoutputs lose the appended acknowledgement paragraph.test_pages_owing_the_same_thing_carry_one_copy_of_the_protocolnow shares the answering protocol, since unpicked updates carry none.docs/how-it-works.html's sample delivery was rewritten to the new shape, and its test compares envelope keys and the acknowledgement too.🤖 Generated with Claude Code