Repository navigation
Let page check --render pass a page with an unread agent message - #3299
Merged
Merged
Conversation
`leaf page check --render` failed every page that shows an agent message whole, such as the shipped ship-review example. The runtime posts a `read` event on its own once it has shown an agent message, the gate's read-only preview server refused it with a 403, and Chrome reported the failed fetch as a console error the gate counts against the page. A read-only server now answers a bookkeeping event (`read`, and any kind `$events` declares bookkeeping) as a final refusal under a 200: it records nothing, the page doesn't send it again, and nothing reaches the console. This extends the rule `/api/user-view` already follows on a capture: a capture serves an instrument, not the user's reading. A gesture is still refused with a 403, so the gate still catches a page that writes without one. The corpus sweep (`test_page_fixture_renders`) now runs the gate through `preview_server`, the read-only capture `page check --render` serves, rather than through a writable server, which is why it never saw this. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The read-only preview server goes back to refusing every event with a 403. The render gate's `answer_reports`, which already answers the error reports a page sends during a reading so they reach no log and draw no refusal, now answers bookkeeping events too: each is refused as final under a 200, so the page doesn't send it again and Chrome logs no console error. Every other event still reaches the server and its 403, so a page that writes without a gesture still fails the gate. This keeps the event door to one refusal shape and handles the posts a page sends unprompted during a reading in the one place built for them. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 20, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 21, 2026
On leaf.page, a visitor who has only read a page no longer starts a private container by being shown an agent message. The runtime used to post a `read` event on its own once a message had been fully on screen, and the Worker forwarded it to a new private container. Now the runtime sends no read until the visitor's session is active, as it already sends no viewport report (`user-view.js`), and the Worker answers any read that arrives from a passive session itself without recording it. Once the visitor acts on the page, reads are recorded as before, including for a message already in view. This implements Max's decision #19 on the overnight report. Until the visitor acts, their read messages keep their unread marks and Next unread keeps stopping on them. Before this change, each published example with an agent reply in it (ship-review, review-a-plan, log-retention) started Python and Codex App Server in a container for every visitor who opened that reply, and the container then idled for ten minutes. ## How - `thread/read.js` counts a message's exposure only while `sessionIsActive()`, and scans again on `lf-session-active`. When the visitor's first gesture activates the session, a reply in view is marked read in the same visit. On a locally served page and in a live sample the session is always active, so nothing changes there. The kernel is rebuilt. - The Worker answers a passive session's `read` itself, beside the viewport report it already drops ("disposable observation, not a gesture that opens private state"). It reads the event's `kind` in the same bounded parse that recognizes a page fault (`passiveEvent`). The answer is a final refusal under a 200, `{ok: false, final: true, findings: [], attempt}`, as `page check --render` has answered since #3299, and not the viewport report's empty 204. The runtime treats an empty answer as unreached and would send the read again on every later pass, and those passes run on each scroll. This answer only reaches a tab whose runtime predates the gate above. ## Checks - A Worker test beside the viewport one posts a read with no cookie, with a session cookie, with this page's active marker from another release, and with another page's marker. Each gets the final refusal and no container. With this page's active marker, the read goes to the container. Disabling the new branch fails the test. - Through the local Worker (`leaf-dev verify-site`'s `local_worker`), with `ship-review` built from this branch, a fresh visitor opened both threads with `t`. No `/api/event` was posted and no container started. The session was then turned active over its session channel, the way another tab's activation reaches it. The same tab then posted reads for both replies, `91f7c2a8` and `64df0b27`. A control tab whose state answers said `active` from the start posted the same two reads. - `pnpm run check` passes. - `uv run leaf-dev site` then `uv run leaf-dev verify-site website-worker` passes. Two earlier runs on a host at load 20–25 timed out on the container's first activation read, and the same timeout hit main's Worker on that host. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[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.
leaf page check --renderfailed every page that shows an agent message whole, such as the shippedship-reviewexample. The runtime posts areadevent on its own once it has shown an agent message. The gate's read-only preview server refused it with a 403, and Chrome reported the failed fetch as a console error, which the gate counts against the page in both color schemes.The gate's
answer_reportsalready answers the error reports a page sends during a reading, so they reach no log and draw no refusal. It now answers bookkeeping events (read, and any kind$eventsdeclares bookkeeping) too, as a final refusal under a 200, so the page doesn't send one again and nothing reaches the console. Every other event still reaches the server and its 403, so a page that writes without a gesture still fails the gate.The corpus sweep (
test_page_fixture_renders) now runs the gate throughpreview_server, the read-only capturepage check --renderserves, rather than through a writable server. That's why the sweep never saw this. Itsship-reviewcase fails before this change and passes after.Other servings: an exported page's event door throws before any fetch, so it can't hit this. A live sample is a writable child page. On leaf.page, a passive visitor's
readisn't refused: the Worker forwards it to a private container, which starts one for a visitor who has only read.