Repository navigation
Write each delivery's handling for the carrier that freezes it - #1068
Merged
Merged
Conversation
A delivery's handling clauses spelled out conditions Leaf already settles when it freezes the delivery: "acknowledge by your host contract's route where it leaves acknowledgement to you", "in a Codex task Leaf observes over App Server, your final message is the reply instead", "if this event's conversation has a null title". Paired verify_site runs had the leaf.page agent invent `leaf delivery ack` and post an early `leaf reply` anyway. A clause's `when` now reads the event's `conversation` digest and the `carrier` delivering it (`wait`, `queue`, `app-server`) beside the record and its obligation, and the clauses state one case each: - only `leaf wait` deliveries ask for acknowledgement, naming `leaf wait --ack <delivery-id>`; - App Server deliveries say the final message is the reply; the others say to answer with `leaf reply` first; - the naming clause appears only when the thread has no title. Handling moves from capture to the freeze (`freeze_delivery(carrier=...)`, `offer_delivery(..., carrier)`): a Codex record collects batches before the adapter knows which transport will offer them, so a record captured under one transport and offered by another could not be told the wrong route. The watcher preface now says to skip the `leaf wait --ack` clause the forwarded batch carries. Tests: the per-case walkthrough adds queue, App Server and titled/untitled cases; the carrier snapshot freezes the queue route on its own; tests that rebuilt the `when` input pass carrier and conversation. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # docs/how-it-works.html # skills/leaf/assets/registry.json # 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_interact_session.test_agent_sees_a_real_summary_suggestion__0/snapshot.yaml # tests/_regtest_outputs/test_interact_session.test_agent_sees_the_complete_interaction_recovery[reply]__0/snapshot.yaml # tests/_regtest_outputs/test_website_server.test_hosted_agent_receives_the_response_instructions_and_delivery[reply]__0/snapshot.yaml
# Conflicts: # docs/how-it-works.html # tests/_regtest_outputs/test_interact_contract.test_each_carrier_hands_the_agent_what_the_snapshot_shows__0/snapshot.yaml # tests/_regtest_outputs/test_interact_contract.test_each_case_of_an_event_is_told_what_the_snapshot_shows__0/snapshot.yaml
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Sep 24, 2026
max-sixty
added a commit
that referenced
this pull request
Sep 24, 2026
scripts/eval_claude_delivery.py runs headless Claude Code sessions, one with a base ref's plugin and one with this checkout's, at the same time. Each serves the same page, starts its background `leaf wait`, and gets one real comment over HTTP. The script reports seconds from the comment to pickup and to the first reply, the actions before `leaf wait --ack`, and any acknowledgement command the agent invented. `claude -p` keeps a background shell alive while stdin stays open, so each session runs with `--input-format stream-json` and the comment arrives through Claude Code's own task notification. A session ends 20 s after the turn the comment woke, or at a ten-minute deadline that kills it and marks the run timed out. A failed run stops its session and server either way. It is basic and imperfect: four rounds, one page, one comment shape, a fresh session, and substring scoring. Its docstring lists these limits. It settles the TODO item on checking each carrier's delivery route after #1068, which this change removes: - App Server: 4 of 4 `verify_site.py local` runs passed. None invented an acknowledgement command or posted an early `leaf reply`. - Claude Code: 4 paired rounds against a7cd8cd, the commit before #1068. Every run in both arms acknowledged as its first action after reading the envelope, and none invented a command. Pickup took 8, 7, 11 and 8 s before and 5, 5, 10 and 9 s after. A smoke run of this script against main gave the same picture. 🤖 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.
Each delivery now carries only the instructions for the route that delivers it. Clauses used to state conditions Leaf already settles at freeze time:
title"In paired
verify_site.py localruns on 2026-09-23, the leaf.page agent ignored those hedges. It inventedleaf delivery ack,$LEAF ackandleaf acknowledge, and it posted an earlyleaf reply.Clause selection. A clause's
whennow reads the event'sconversation, which is its thread's digest, and thecarrierdelivering it (wait,queueorapp-server), alongside the record and itsobligation. Each clause now states one case:leaf waitleaf wait --ack <delivery-id>leaf replybefore other workleaf replybefore other workThe title clause appears only when the thread has no title. The Markdown line is now its own clause, and every carrier gets it.
summary_hintis now read from the digest.Handling is written at freeze time, not at capture. It is added by
freeze_delivery(carrier=…)andoffer_delivery(…, carrier). A Codex record collects batches before the adapter knows which transport will offer them. Before this change, a record captured under one transport and offered over the other after a restart told the agent the wrong route. In the App Server → queue direction, nothing posted the "final message" reply.Watcher route. The preface in
codex-watcher.mdnow tells the page task to skip theleaf wait --ackclause that a forwarded batch carries.Tests. Behavior that moved:
test_each_case_of_an_event_is_told_what_the_snapshot_shows) adds cases for queue, App Server, and titled and untitled threads.wheninput now passcarrierandconversation.docs/how-it-works.html.Evidence.
verify_site.pyrun passed before the merge with Stream an App Server turn's opening message as the start of its reply #1057, whose opening-message rule the App Server clause now follows. The hosted agent ran 2 commands and 1 file edit. It invented no acknowledgement command and posted no earlyleaf reply. That is one run.Gaps.
ANSWER_ASK_INSTRUCTION, used for Stop-hook and idle refusals, still says "in a Codex task Leaf observes over App Server…".🤖 Generated with Claude Code