Repository navigation
Mark a failure receipt as one, and write it from one place - #783
Merged
Merged
Conversation
`fallback_reply` was the name for the thing that answers a reader when no agent answer is coming — the Worker's rate limiter, a dispatch that threw — and #779 added a second implementation of the same idea for a turn the container followed to nothing. Neither was a fallback: they are how a failure reaches the reader instead of being swallowed. But the page never drew one. `failure` was set on the reply and schema-validated, and read by nothing outside the deploy gate, so "I couldn't generate a reply just now" arrived in the agent's own first person, in the same bubble, under the thread's own agent name — indistinguishable from an answer, which is the one thing the field exists to prevent. One writer, `write_failure_receipt`, now appends all three codes, and one declaration, `FAILURE_RECEIPTS`, holds each code beside the words the reader gets for it. The Worker sends `{event, failure}` and no longer carries a copy of that wording across the HTTP hop; `turn_failed` stays out of that door, because a receipt claiming a turn was observed should come only from the code that observed it. The voice is the host's rather than the agent's, and `_agent_event` loses the text half nothing asks for any more. The writer names only the move. A reply's address is not always the move — a gesture on a widget frozen into thread markup is answered on the conversation holding it — but `cmd_reply` resolves that from the same reading, so working it out beforehand was a second answer to a question the writer already answers, and the wrong one on a repeat: the Worker retries, and once the first receipt has settled the move, nothing outside the log can say where its reply went. Doing it early got the gesture back and refused its own earlier receipt as another event's. The durable attempt is what makes the repeat idempotent, and the writer reads it before the address. The head says the rest. A reply carrying `failure` wears one mark, `Not answered`, in the panel and inline both — the only thing in a message head that is not muted metadata, because it is the only thing there a reader has to act on. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
leaf-agent
approved these changes
Sep 18, 2026
This was referenced Sep 18, 2026
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.
fallback_replywas the name for the thing that answers a reader when no agent answer is coming — the Worker's rate limiter, a dispatch that threw — and #779 added a second implementation of the same idea for a turn the container followed to nothing. Neither was a fallback: they are how a failure reaches the reader instead of being swallowed.But the page never drew one.
failurewas set on the reply and schema-validated, and read by nothing outside the deploy gate, so "I couldn't generate a reply just now" arrived in the agent's own first person, in the same bubble, under the thread's own agent name — indistinguishable from an answer, which is the one thing the field exists to prevent.What changed
One writer, one vocabulary.
write_failure_receiptis now the only code that appends a reply carryingfailure, andFAILURE_RECEIPTSdeclares each of the three codes beside the words the reader gets for it. The Worker sends{event, failure}and no longer carries a copy of that wording across the HTTP hop;turn_failedis derived out of the door's accepted set, because a receipt claiming a turn was observed should come only from the code that observed it. Removingtextfrom that request left_agent_event's text half with no callers, so it goes too.The writer names only the move. A reply's address is not always the move — a gesture on a widget frozen into thread markup is answered on the conversation holding it — but
cmd_replyresolves that from the same reading, so working it out beforehand was a second answer to a question the writer already answers, and the wrong one on a repeat: the Worker retries, and once the first receipt has settled the move, nothing outside the log can say where its reply went. Doing it early got the gesture back and refused its own earlier receipt as another event's, turning the retry into a 400. The durableattemptis what makes the repeat idempotent, and the writer reads it before the address.The head says the rest. A reply carrying
failurewears one mark,Not answered, in the panel and inline both — the only thing in a message head that is not muted metadata, because it is the only thing there a reader has to act on. The three texts now speak in the host's voice rather than the agent's first person.A failure receipt deliberately does not enter the panel's "On you" list:
awaitsmeans the agent's reply left a question and the banner counts it as an Ask, which is a package-owned semantic, so the chip and "Send it again to retry" carry it instead.Checks
Everyday suite (1,142),
test_render_conversations.py+test_chrome_contracts.pyunder--run-nightly(105), worker typecheck and vitest (62), pre-commit, and one real hosted Codex turn throughscripts/verify_site.py local— published revision 2 and replied in 17.2 s through the changed reply door. The new render test is bug-back checked against both the runtime's read offailureand the chip's styling; the retry regression is bug-back checked against resolving the address ahead of the write.🤖 Generated with Claude Code