Repository navigation
Use a valid website deployment probe - #432
Merged
Merged
Conversation
leaf-agent
reviewed
Sep 8, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
#430 fixes the same failure in the same two files — it also replaces the /api/data activation probe with /api/view, carrying the revision and a log boundary. It was opened six minutes before this one, so the two will conflict and one should be closed.
If this one is the one that lands, two things #430 pins are worth carrying over, because both sit on the mechanism this probe depends on and neither is exercised here:
worker/test/index.test.tscovers the Worker branch the probe relies on — a passive reader's non-api/stateAPI GET reaching a container and coming backLeaf-Session: activewith the active cookie. The Worker has noapi/view-specific code; it routes onisPageApiRequest, withapi/statecarved out to the edge instaticState. So a future carve-out that addedapi/viewto that edge-answered branch would put the gate back to failing on every deploy, with nothing red before production — the same shape as the bug being fixed.- The pre-activation
/api/stateread assertsLeaf-Session: passive, which is currently only checked indirectly, through the absence of activation cookies.
leaf-agent
approved these changes
Sep 8, 2026
This was referenced Sep 8, 2026
max-sixty
pushed a commit
that referenced
this pull request
Sep 9, 2026
`publish-site` deployed release `b8550d06…` to leaf.page, verified it in Chrome, and then failed its agent pass on a message about a missing event ([run 34315250259](https://github.com/max-sixty/leaf/actions/runs/34315250259)): `RuntimeError: https://leaf.page/examples/design-decision/ did not return its deployment-check comment`. No event was missing. The container that answered the POST was still running the previous image, refused a layer it does not speak, and answered with its own generation instead of a state — which the gate read as an absent comment. ## Why the agent pass posts into a container it never checked `verify_agent_turn` opened a context, read `api/state`, and posted the deployment-check comment under `state["layer"]["generation"]`. Both readings are wrong for the container that has to admit the event: - A passive `GET api/state` is answered by the Worker out of the built site ([`worker/src/index.ts`](https://github.com/max-sixty/leaf/blob/7453d8c4eeef8fe22c9959c5701be04ff75df376/worker/src/index.ts#L453-L460)), so the layer it names is the *release's*, whatever the containers are running. The POST is not — it always reaches a container ([`index.ts`](https://github.com/max-sixty/leaf/blob/7453d8c4eeef8fe22c9959c5701be04ff75df376/worker/src/index.ts#L497)), which carries the layer of the image it runs ([`worker/server.py`](https://github.com/max-sixty/leaf/blob/7453d8c4eeef8fe22c9959c5701be04ff75df376/worker/server.py#L631)). - The page checks that *do* assert the container release run in their own browser contexts. The Worker keys a container on the reader session alone, so they answer for their own allocations and say nothing about this one. A container whose layer the request does not match answers `{"layer": <its generation>}` at status 200 without appending ([`http.py`](https://github.com/max-sixty/leaf/blob/7453d8c4eeef8fe22c9959c5701be04ff75df376/skills/leaf/scripts/leaf/http.py#L816-L821)) — a deliberate shape, so a stale runtime gets the current generation rather than a verdict in a vocabulary it no longer speaks. `posted.ok` is therefore true, `accepted["state"]` is absent, and the gate reported the one thing that had not happened. That the rollout was still draining during this pass is in the run's own timeline: nine allocations answered `reached a different container release` between 05:34:47 and 05:36:52 before one landed on the new image and ended the retry loop. A rollout drains one allocation at a time, so the agent pass's fresh session is an independent draw. ## The change `agent_session` establishes the session the turn will use, and only returns one whose container reports the deployed release: it activates through `api/view` — the same passive-state-then-projection probe [#432](#432) added for the page checks — then reads `api/state` back under `Leaf-Release`. It reads two things off that answer, as `verify_page` does: `leaf-session` says the read left the edge at all, and only then does `leaf-release` name a container rather than the manifest. The edge stamps a passive `api/state` with the deployed release unconditionally, so the release check alone would pass a session whose activation never took. Because a container is bound to its session for that session's life, a stale draw is retried with a *new* session rather than re-read on the old one. `verify_agent_turn` then posts under that container's own layer. Nothing in the retry writes: it is three GETs, and the turn is still posted exactly once, after a coherent session exists. The wait is bounded at 180s — the release verification ahead of this pass has already waited out most of the drain, and the step's budget still has to hold the turn's five minutes inside the job's thirty. The POST answer is also checked for what it is, so the next occurrence of any container-side refusal names the answer rather than the missing event. ## Verification - `uv run pytest tests/test_website_server.py` — 23 passed, including a new case that drives the mechanism at the file boundary: a comment posted under a layer the server does not hold is answered `{"layer": <generation>}`, and the log is unchanged. The gate's own path needs a live Worker and a rollout in progress, so this is the boundary that can hold it. - `npm run typecheck --prefix worker` and `npm test --prefix worker` — 57 passed. The passive-state case now asks under a release the edge is not serving and asserts it answers with the deployed one anyway, so it fails against an edge that echoed the request header. That is the reading `leaf-session` is load-bearing for above: an echoing edge would let the release check pass a session that never left the edge. - `uv run pre-commit run --files scripts/verify-site.py tests/test_website_server.py worker/test/index.test.ts` — passed, ruff check and format at the pinned 0.16.1 included. - The changed step only runs on pushes to `main`, so this branch's CI cannot exercise it; merging re-runs `publish-site`. ## Relation to the other two open gate fixes All three failure shapes are live — [run 34315493489](https://github.com/max-sixty/leaf/actions/runs/34315493489), the next commit after this one, failed on the third. They are separate defects in the same function: - #487 stops the agent pass re-verifying the whole site, and touches `main()`. It does not reach this: the pass would still post into an unchecked container, and with the page checks gone there is no release reading in the pass at all — this branch supplies the one that matters. - #483 rewrites what the gate waits for *after* the comment is posted (`did not render the agent's published heading`). This branch changes what happens *before* it. Landing more than one will conflict textually at the top of `verify_agent_turn`; the three changes are to disjoint concerns and compose. --------- Co-authored-by: leaf-agent <[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.
The previous website publish deployed successfully, but its Chrome verifier retried an invalid
/api/datarequest until the workflow timed out. That endpoint requires a source and key, so it cannot serve as a generic session-activation probe.Read the passive edge state first, assert that it remains passive, then use its revision and event boundary with the canonical read-only
/api/viewroute. The rebuilt site passes the full exact-release Chrome verifier against the deployed release.The website-server integration test exercises the exact projection request against the real Python adapter. A Worker test also pins the routing boundary: a private API read leaves the edge, reaches a container, and returns the active-session header and cookie.