Repository navigation
Retry the deploy gate's agent ask for a turn_failed receipt, not only startup_failed - #791
leaf-agent wants to merge 1 commit into
Conversation
|
rather than adding retires / conditional retries, can we fix the underlying issue that's causing the need for retries? |
|
Agreed, and the receipt turns out to name where the underlying fault is. Closing this.
That reframes the run. #779 gave the unbound follower an outcome when a fault escapes the loop; this is that outcome reaching a reader for the first time, 2.3 s after dispatch. #772's open half is the other exit from the same unbound state — the silence loop that never raises, so the page reads I can't produce the fix from here. Which fault it was is recorded in the container's own The one candidate I can name from reading the codeInferred from the source, not observed — the logs above are what would settle it.
If that is the path, the fix is small and does not touch the binding rule: I'll add this to #772 so it is on the durable record rather than only here. |
… event id off --section (#837) `publish-site` on `main` failed at the deploy gate's hosted-agent pass. The turn spent three commands failing to reach Leaf's reply interface, and the revision that did reach the page never carried the heading the ask named. This PR fixes the two dead ends those three commands hit: a refusal that offers no recourse when `--section` is handed an id from another namespace, and five printed command forms that omit their required `PAGE` argument. It does not make the failed run green — what the turn chose to publish is the model's, and the section below says why I did not reach for the gate's retry instead. ## What the run did The gate reported: ``` RuntimeError: https://leaf.page/examples/triage-board/ agent did not publish ‘Deployment de34a7d1 verified’; it reached revision 2 from 1 with the page reading listening; it replied: deployment verified ``` Workers Observability for that turn (event `56f596b2765bf1b5f1a6f40bc4232ab6`, turn `01a0b800-c8fd-7f72-a404-2316ffc1f704`) records the sequence: one `commandExecution` at exit 0, one `fileChange`, then three `commandExecution` items with status `failed` at exits 1, 2 and 1, then the final model message the host published as the reply. No publish command ran at all. The gate's own activity profile names the three that failed: ``` $LEAF reply --section 56f596b2… --quote 'deployment verified' "deployment verified" $LEAF reply . --section 56f596b2… "deployment verified" $LEAF reply . --section 56f596b2… --text "deployment verified" ``` One wrong belief runs through all three: that `--section` takes the delivered event id. It takes an element id. The first also drops the `PAGE` argument entirely, so `"deployment verified"` landed as the page directory. Revision 2 was not one of those three. `_capture_anchor` exits before `activate_checked_source` runs, so a reply refused on its section activates nothing; the turn's only other write was the host-bound final message, whose reply carries `validate_source=True` and so activated the edited `index.html`. What that revision actually held is the one thing the records do not say — no content is logged, by design — so whether the model wrote a different heading or the gate's fetch of the private revision never landed is not settled here. Either way the turn reached its reply through a route that never confirmed the edit. The 503s earlier in the same log are separate and already answered: the image rollout draining, absorbed by the workflow's own `until` loop, with #835 since landing the reading that names them. The commit under test (#832) changed only browser runtime modules and their tests, so it did not cause this. ## What changes **The refusal names the namespace.** Reproduced at the CLI, `leaf reply <page> --to <id> --section <that same id>` exits with `can't anchor in revision r1: no element id '…' in this version` and nothing else, sending an agent that holds a log id to look through the page's markup for something that was never there. `_foreign_id_recourse` in `conversation.py` reads the log, and when `--section`'s value is an event there the refusal continues: ``` ; <id> is a comment in this page's log — `leaf reply <page> --to <id>` answers a message and `--for <event-id>` addresses a delivered move, while `--section` takes an element id the page's markup declares ``` It sits at `_capture_anchor`, the one door both `leaf comment` and `leaf reply` reach `--section` through, and it stays silent unless the log actually holds the value, so the existing typo refusals are untouched. `--for` is named for every kind the log holds, not only for a message. A reader's press on a widget frozen into a reply is addressed through that action event's own id and nothing else — `current_responses` returns a reply obligation keyed on it, and `--to` names messages — so gating the pointer on a message kind would have left the one case where a single option is the only route without one. The article is derived rather than fixed, so `action`, `undo`, `edit`, and `unresolve` do not read as "a action". **Every printed command form carries its page.** `leaf comment --section <ask-id>` cannot run: `PAGE` is a required argument, so the next token is eaten as the page directory. It was printed that way in five places — `ANSWER_ASK_INSTRUCTION`, both `requires a page version` refusals in `cmd_reply`, and the `comment` and `reply` handling sentences in the layer registry, which is the vocabulary an agent reads for the exact event it is answering. The public reference in `references/conversation-threads.md` already writes every form with its page; these now agree with it. ## Why not the gate's retry The turn replied without doing the work, and `ask_until_answered` re-asks only on a `startup_failed` receipt, so that shape gets one ask. Widening it is where #791 went, and you closed that with "rather than adding retries / conditional retries, can we fix the underlying issue that's causing the need for retries?" — so I have left the gate alone and fixed what the turn actually ran into. What remains unaddressed is the model's own choice, which no change here reaches. ## Verification Two new cases in `tests/test_interact_anchors.py` — one for a message id handed to `--section`, one for a delivered widget press — each fail against the refusal they replace with exactly its production message, and pass with the fix. `uv run pytest tests/test_interact_anchors.py` is green (53 passed), as are `tests/test_interact_product.py` and `tests/test_interact_contract.py` (329 passed). <details><summary>Wider selection and its environment failures</summary> `uv run pytest tests/test_interact_session.py tests/test_interact_layer.py tests/test_interact_contract.py` ran 627 passed, 3 skipped, with 2 failures and 2 errors that belong to this sandbox rather than the change: three are `OSError: [Errno 30] Read-only file system` on `/tmp`, which the agent sandbox mounts read-only, and `test_staged_writes_honor_umask_without_copying_a_replaced_symlink_mode` reads the sandbox user's umask. None touch the anchor or conversation paths. </details> `publish-site` has since gone green on `main` twice, at `ce11d502` and `d21cd640`, so nothing is currently red and this is not urgent. Failed run: [35422088941](https://github.com/max-sixty/leaf/actions/runs/35422088941). --------- Co-authored-by: leaf-agent <[email protected]> Co-authored-by: leaf-agent <[email protected]>
publish-sitefailed onmainat f249da60 — run 35327552033. The deploy itself is fine: Deploy public Leaf pages succeeded and the release pass printed✓ https://leaf.page serves release 83204c73… in /usr/bin/google-chromeat 09:13:25, so leaf.page is published and current. What failed is the hosted-agent pass that follows it, on a receipt the host writes to tell the reader to send the message again — and the gate reported it instead of sending it again. This PR puts that receipt back in the retried set.The receipt says retry; the gate did not
The pass posted one comment, and the container settled it 2.4 s later:
Those are the words of the
turn_failedreceipt — the one a container writes "from its own reading of a turn it followed to nothing" (worker/README.md). The page was back tolisteningwith nothing holding it, andTURN_LIMIThad 9 and a half of its 10 minutes unspent, so a second ask was affordable. The gate ended the deploy instead.The retried set fell behind the receipt table
Asking again on this exact condition is not new behaviour — it is what #508 was for. It read the receipt as meaning "the deployed container noticed a turn that never completed, closed it, and settled the reader's standing ask rather than leaving it open", and justified sending the message again with the property that still holds: "A release that cannot run a hosted turn at all settles the same way twice and still reddens
main; a single model-side failure does not."What happened since is that the condition moved codes while the gate's list did not:
failurecode. At that point the table held two codes, andask_until_answeredretriedstartup_failed.turn_failedas the third code, for a turn the container followed to nothing, and declared it beside the words the reader gets. Neither commit touchesscripts/verify_site.py(git show 89bf4307 --stat,git show 9bbd2503 --stat).So the one code that names the condition #508 retried became the one code the gate does not retry, and this run is that gap reached.
The change
ASK_AGAINdeclares the two receipts whose own words end in "Send it again to retry" —startup_failed(a turn that never began) andturn_failed(a turn followed to nothing).rate_limitedstays out: it names a load condition a second ask inside the same pass would meet again. A turn that ends with no receipt at all still fails on the first ask.A retry does not paper over a bad release. Neither retried code says anything about the release that would settle a second ask differently, so a container that genuinely cannot run a hosted turn fails the deploy on the second receipt instead of the first — and the
↻line now names which code was asked again, so the log says which one it was.The predicate
turn_failed(replies)— "any reply carries afailure" — is renamedsettled_by_failure, because its name now collides with the receipt code of the same spelling and the collision sits exactly where this policy is read.worker/README.md, which owns the failure contract, andscripts/CLAUDE.mdboth state the widened policy.Verification
uv run pytest tests/test_website_server.py— 81 passed. The two policy cases are parametrized overwebsite_server.FAILURE_RECEIPTSitself rather than a literal pair, so a fourth code cannot be declared without them saying which side it falls on, and they assert against the literalrate_limitedrather than againstASK_AGAIN, so they cannot agree with the constant by construction. Both are bug-back checked: narrowingASK_AGAINback to{"startup_failed"}failstest_the_deploy_gate_asks_again_for_every_receipt_that_invites_one[turn_failed]onassert 1 == 2andtest_the_deploy_gate_reads_a_durable_host_failure[turn_failed]on the predicate.uv run pre-commit runover the four changed files passes.The live path is not reachable from here — the hosted turn runs in a Cloudflare container against a Codex login this account has no credentials for — so the unit coverage is the evidence for the change and the run above is the evidence for the diagnosis.
scripts/verify_site.pyis exercised on the next push tomainthat deploys.Why this is a durable gate gap rather than a transient
The container-side fault behind the receipt may well have been a one-off: the release pass ahead of the agent pass absorbed seven rounds of the rollout
503, at 09:11:19 through 09:12:56, before landing at 09:13:25, so the agent's turn was dispatched into a container the image rollout had only just reached. What is durable is that the gate has no ask-again for the receipt that condition produces: since #783 landed there is no wait coveringturn_failed, so the next deploy whose turn faults once fails the same way. Reading the container's own logs to say which fault it was needs Cloudflare credentials this account does not have.This is a different shape from open tracker #772, which is the unbound follower that reaches no receipt at all and leaves the page reading
workingfor the gate's wholeTURN_LIMIT. That one still needs the bound it asks for; this PR is about what the gate does once a receipt has arrived, so it neither fixes nor depends on it.