Repository navigation
Settle every failed hosted move and derive thread attention once - #1001
Conversation
Finishes the obligation model from #983. - A failed hosted turn now settles or returns every move it was given, by the answer the move owes. `conversation.fail_answer` is the one writer: a message, or a conversation that asked for a version, gets a reply carrying `failure`; a request gets a failed receipt, which reopens its seat; an answer to a page Ask gets a failed `pickup`, a new phase that hands the move back to the reader (workflow answered, failed response, next actor reader) until they answer again or the markup records it. The worker's `_receipt_unanswered` sweeps every owed move in the delivery, not only replies. - Thread attention is derived only in Python. The browser drops `projectThreadAttention` and the browser-only `next_actor: "none"`; it adjusts the server's attention for unresolved local sends alone: a pending send waits on that send, a standing reader Ask survives prose, a refused send returns a thread the server left with the agent to the reader. - Workflow subjects, coordinates, update targets and work claims name a conversation `{"kind": "conversation"}` everywhere, as delivery and the CLI already did; `agent_state`'s translation is gone. - The working grace is served once, as `working_grace_ms` beside `now`; `quietSince` reads it instead of its own 15-minute copy. Behavior that moved: a thread holding a pending send waits on that send rather than on the strongest server workflow; a refused send's recovery reason is `recovery`; host failure wording no longer says "message", since a request can carry it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
skills/leaf/scripts/leaf/events.md and worker/README.md both now say the host records failure on whichever failure the move's answer takes, and name a failed receipt as one of the three. A receipt can't carry it: _fail_page_answer's receipt branch writes no code, and the registry's receipt record is additionalProperties: false with no failure property.
Nothing reads the code for a request today — canonical_workflows discriminates replies by response.get("failure") and pickups by phase — so this is the references overstating rather than a broken path. What it hides is worth naming, though: conversation/messages.js draws the "answers nothing" head off message.failure, so the reply and pickup arms are marked as standing in for an answer and the request arm isn't. A host give-up receipt reads as the agent having tried and failed, which the FAILURE_RECEIPTS comment calls "the failure this whole path exists to make visible".
The suggestions correct the prose, which leaves the receipt arm as easy to extend as it found it. Adding failure to the receipt record and writing it in that branch is the other way, if the asymmetry is the half worth moving.
A failed request receipt has no field for `failure`; events.md and the worker README said every shape carried it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
#983 made every agent obligation one workflow
answerand listed four things it left undone. This PR finishes them.A failed hosted turn settles every move it was given
Before this PR, a hosted turn that failed wrote a failure receipt only for moves owed a reply. A request, an answer to a page Ask, or a conversation that asked for a version stayed owed with no turn coming for it.
conversation.fail_answeris now the single writer the worker calls, and it writes whatever failure the move'sanswercalls for:reply,version: a reply carryingfailurein the conversation.cmd_replynow accepts a host failure receipt in a version thread, because a failure reply is the only reply that thread can take.receipt: a failed receipt. That is the request's own terminal outcome, so its seat reopens and the reader can press it again.markup: apickupwith the new phasefailedand afailurecode. The reader's Ask answer stays in the log. The workflow reads answered, with a failed response, and its next actor is the reader until they answer again or the markup records the answer.HostedTurn._receipt_unanswerednow covers every owed move in the delivery (codex.delivery_owed_moves), not only replies. The worker door and the continuation scan already went throughwrite_failure_receipt, so they get the same dispatch. The host failure wording no longer says "message", since a request can now carry it.Thread attention is derived once
Python's
_apply_thread_attentionis the only place thread attention is derived. The browser no longer hasprojectThreadAttentionor the browser-onlynext_actor: "none". It changes the server's attention only for unresolved local sends:foldThreads)recoveryOne name for the subject
Workflow subjects and coordinates, update targets, and
status --onclaims now all use{"kind": "conversation"}, the name delivery,page stateand the CLI already used.agent_state's translation layer is removed. The document kind{"kind": "thread"}for frozen thread markup is a different concept and keeps its name. Thethreadfield on Asks is also unchanged.The working grace is served once
served_state/page.pynow servesworking_grace_msfromactivity.WORKING_GRACEalongsidenow.presence.quietSincereads that value, so its 15-minute copy is gone. Nothing reads as quiet until a state has arrived.Behavior that moved
recovery. It wasworkflow.quietSinceuses>=, the same comparison Python's_quietuses. Its grace argument is removed.Tests
test_a_failed_turn_hands_every_kind_of_owed_move_back, parametrized over markup, receipt and version. A turn that completes without answering must leave no obligations and nothing for the continuation scan to pick up, and each move must end up in the shape its answer takes. With the sweep limited to replies, all three cases fail.test_a_host_receipt_does_not_answer_input_an_agent_turn_already_claimedgoes throughwrite_failure_receipt.Local runs:
tests/test_website_server.py, the fivetest_interact_*files touched,npm run test:runtime, the browser gate (check:browser,test:browser) and pre-commit all pass. A keyword selection over the render suites passed except two cases,test_a_growing_reply_keeps_its_send_in_the_listandtest_unit_claim_arrivals_share_one_window_with_the_open_page_map. Both also fail locally on the base commit 19a0213.🤖 Generated with Claude Code