Repository navigation
Description
publish-site on main at 8baf6c47 — run 35276339548, "Message a Claude Code session when input reaches a page it left unwatched (#765)". The deploy succeeded and the release pass verified leaf.page in Chrome at 21:30:28. The job then failed in Verify the exact public release in Chrome on the hosted-agent pass, ten and a half minutes later:
RuntimeError: https://leaf.page/examples/triage-board/ agent published but did not reply; the page read working
This is the shape #705 recorded on 2026-09-14 and #729 fixed on 2026-09-15. Both of #729's guards were live in this run. Neither covers the arm this run took.
The follower never bound the delivery to a turn
Hosted agent profile (observed from the first request):
session reference 769868315596
event f09f51e14c9977d9a6b0bfcb05626eb6
request acknowledged 167 ms
activity closed at 343 ms
activity working: Starting at 2.7 s
published at 13.8 s
The agent ran: publishing a revision carrying Deployment 6c0f4376 verified at 13.8 s takes $LEAF commands executing inside the container, so it claimed its delivery, read the page and wrote the file. What the page never showed is any sign that the follower saw it happen.
working: Starting is the reading _start_turn writes at dispatch, under the synthetic turn key delivery:<payload id>, before any notification. _start_turn returns no turn id even when App Server acknowledges the start, so every fresh dispatch enters _follow_turn with awaiting_delivery_start true and binds its turn id from a later turn/started whose items name the delivery. Only after that binding does anything replace the dispatch reading.
The next deploy, run 35277179764 on 388da779, shows the healthy sequence on the same container code:
activity working: Starting at 549 ms
activity handling at 2.7 s
activity working: Running /bin/bash -lc '$LEAF delivery claim 88e341ae-… at 5.3 s
activity working: Editing /app/site/examples/triage-board/index.html at 9.7 s
activity listening at 24.6 s
Here Starting gives way 2.1 s later. In the failed run it was still the page's only stream reading 600 s later, while the gate polled /api/state every two seconds and the container answered every read. The follower stayed in its unbound wait for the whole turn.
Why neither of #729's guards ends it
#729 gives the follower an outcome for a fault and for a stream that stops delivering. The unbound wait reaches neither.
- The
except Exceptionguard needs a fault that escapes the loop. The one fault this arm produces — the silenceTimeoutError— is caught by the reconnect handler inside the loop and never reaches the guard. - The silence bound routes into a resume that cannot bind a picked-up delivery.
recv_notificationraises pastSTREAM_SILENCE,_resume_turn_streamreconnects, and the unbound arm looks for a turn whose items name the delivery. If it finds none, the restart arm below it is gated on the delivery still beingoffering— and this delivery was claimed inside the container seconds after dispatch. SorecoveredstaysNone, the loopcontinues, and the next silence repeats it. Nothing bounds the repetition.
There is a second gap behind the first: the unbound path has no outcome even when a fault does reach the guard. _clear_stream_activity is only called on the bound branch, and the terminal commit is gated on leaf_turn is not None, which an unbound follower never holds. So the delivery: activity stands and the claim's turn is never closed — the page the gate read for its full TURN_LIMIT. tests/test_website_server.py states the contract in test_a_follower_fault_of_any_shape_still_releases_its_website_turn, but every _follow_turn case in it passes a bound turn_id; the unbound entry _start_turn actually produces has no case.
The consequence is wider than the gate. Any leaf.page reader whose turn lands here sees a page that reads working indefinitely, with neither an answer nor a failure, against a page contract that says exactly one terminal receipt names each accepted request.
Which sub-mechanism, and what would settle it
Two readings fit the frozen activity equally, and they want different repairs:
turn/startednever reached the follower. Then the silence bound fired repeatedly and each resume found nothing to bind — the loop above.- It reached the follower and
app_server_delivery_iddid not match it. That function reads the delivery id out of the turn's own items; aturn/startedwhose items do not carry theleaf_deliveryoutput in that shape is skipped as another turn's. Notifications would keep arriving, so the silence bound would never fire at all.
The Workers logs separate them in one read. For session reference 769868315596: whether turn_stream_reconnected was logged (and how many times), whether turn_delivery_bound is simply absent, and whether turn_stream_reconnect_failed appears. This account has no Cloudflare credentials, so it cannot fetch them.
Why no fix is proposed
The repair both readings share is a bound on the unbound wait, ending it with a terminal receipt. Choosing what that receipt does is the part CI should not decide alone: at the moment it would fire, the agent is demonstrably still working — it published — and the host is streaming a reply into a destination the follower reserved before the turn. Closing the claim there discards that reply, and the follower does not own the Leaf turn to close: leaf_turn is None precisely because it never bound, and the open turn belongs to the in-container $LEAF delivery claim. That is a live turn-lifecycle change for every reader, resting on which of the two readings above is true.
Reproducing it here is not available either: codex is not on this runner, so there is no App Server to drive a hosted turn against, and the condition is a provider-notification timing one rather than something a fixture induces. What is reachable from tests/test_website_server.py is the second gap — an unbound follower that faults should still clear its dispatch activity and reach a receipt — and a fix for the first should land with a case for the unbound entry alongside it.
Not this commit
8baf6c47 leaves worker/ untouched. Its one runtime change is a browser-admission block gated on claim["host"] == "claude-code", and every hosted page claim records codex; the comment it admitted reached the container normally, acknowledged in 167 ms. The next deploy carried the same code and passed the same gate.
Activity
leaf-agent commentedon Sep 18, 2026
Run 35276339548
log tail
leaf-agent commentedon Sep 18, 2026
#779 and #783 landed the receipt this issue asked for, but not the bound that reaches it. The arm described above still runs forever at
9bbd2503.What the two PRs did fix. #779 made the delivery the turn's identity, so an unbound follower now has an outcome when a fault escapes the loop:
HostedTurn.failedclears thedelivery:activity understarting_turn_key, andcommitroutesleaf_turn is Noneinto_report_failure, which settles each move with aturn_failedreceipt. That closes the second gap this issue named — "the unbound path has no outcome even when a fault does reach the guard". #783 then gave that receipt a reader-facing mark. So the receipt, its wording, and the release of the reserved reply address all exist now.What is still open is the first gap: the silence loop never produces a fault for that guard to catch. Trace it at the current head, for a delivery the container has already claimed:
stream.next()returnsNonewhile the stream is quiet until the silence outlastsSTREAM_SILENCE, at which pointrecv_notificationre-raises theTimeoutError, whichTurnStream.nextconverts toStreamLost._follow_turncatches it and callsturn.reconcile(stream, stream.resume()).reconcile'sawaitingarm,_delivered_turnfinds no turn naming the delivery, and_restart_turnis gated on the delivery still beingoffering— which a claimed delivery is not.recoveredstaysNone._follow_turncontinues.resume()resetquiet_since, so the next silence is another 120 s away, and step 1 repeats.Nothing in that cycle raises, so the
except Exceptionguard never runs,failed()never runs, and theStartingactivity that_start_turnwrites at dispatch stands for the container's life. That is the page the deploy gate read for its fullTURN_LIMIT, and it is what any leaf.page reader whose turn lands here still sees.should_resubscribeis not a second exit: it spends its oneresubscribe_onceon a delivery that is stilloffering, which this one is not by the time the silence fires.tests/test_website_server.pyhas no case for it either —test_a_follower_fault_of_any_shape_still_releases_its_website_turnremains the nearest, and it passes a boundturn_id.Why this is still not a PR from here. The repair is unchanged from what the body above describes: bound the unbound wait so it ends in the receipt that now exists. What #779 settled is what the receipt says; what it did not settle is when a follower is entitled to write one while the container may still be working — at the moment it would fire, the agent has demonstrably published. That is a turn-lifecycle choice for every reader, not a CI one.
The Workers-log read that separates the two sub-mechanisms is also unchanged, and this account still has no Cloudflare credentials for it.
Retry the deploy gate's agent pass when the edge answers 503 during a…
leaf-agent commentedon Sep 18, 2026
A second occurrence, and the first one that produced a receipt:
publish-siteon f249da60, run 35327552033. The deploy succeeded and the release pass verified leaf.page in Chrome at 09:13:25; the agent pass then failed 2.3 s into its only ask:That receipt is this issue's condition, proved
turn_failedhas one writer —_report_failure— reached only whencommitfindsleaf_turn is None.leaf_turnis assigned in one place,bind, whose writeropen_app_server_deliveryreturns a turn id or raises and neverNone. The Worker's door refuses the code, so no other boundary can write it. Aturn_failedreceipt is therefore proof that the follower held no Leaf turn for its delivery when it stopped: the unbound state this issue is open for.So the two endings of that state are now both observed. This run took the bounded one — a fault escaped the loop,
HostedTurn.failedcleared the dispatch activity and_report_failuresettled the move — which is exactly the second gap #779 and #783 closed, working as intended. The page went back tolisteningrather than standing onworking. The unbounded ending this issue's open half describes is unchanged.A candidate mechanism, from the source rather than the logs
The Workers-log read this issue asks for is still the thing that would settle it, and still out of reach here. What reading the current head does suggest is a race that a slow container widens, and this turn was dispatched into a container the image rollout had only just reached — the release pass ahead of it absorbed seven rounds of the rollout
503between 09:11:19 and 09:12:56._start_turndiscards the turn id from an acknowledgedturn/startby design: "the follower learns which App Server turn took this delivery from the notification stream, which is the one reading that survives a lost acknowledgement."awaitingtherefore stays true, which armsshould_resubscribeon the first loop iteration. Its only test for "App Server has not started this delivery" isdelivery_queue_state(...) == "offering", and what clearsofferingis$LEAF delivery claimrunning inside the container, seconds after the turn starts. Between an acknowledged start and the model's first command, a follower whoseturn/starteddid not arrive buffered will drop a live subscription for a turn it has already been told exists — and the resume that follows searches for a turn whose items name the delivery, which a turn that has not yet emitted itsleaf_deliveryoutput does not have.If that is the path, the repair does not touch the binding rule this issue's open half is about:
_start_turnknows App Server acknowledged a start, andshould_resubscribecould be told that without binding to an id that may be stale.Not the deploy gate
#791 proposed asking again on this receipt, since
startup_failedandturn_failedboth end in "Send it again to retry" and the gate only retries the first. It was closed on maintainer direction — the retry is at the gate, and the fault is here.Scope Leaf's Cloudflare tokens to its own Workers, and give Tend's ag…
max-sixty commentedon Sep 19, 2026
Closing this. The failure was one intermittent
publish-siterun, and nothing has reproduced it since. #825 scoped Leaf's Cloudflare tokens so an agent can read the Worker logs, so the next occurrence is diagnosable rather than inferred from the job output — open a fresh report if it breaks again.Receipt the one start the Worker's dispatch is not holding (#772)
Record and receipt a start that fails on its connection (#772)
Carry the scan with the receipt, so a queued move is still reached (#772
Ask the log what a page owes, not whether it still opens (#772)
Follow a hosted turn on one connection, and end the turn when it ends (…