Skip to content

Record no reads for a passive leaf.page visitor - #3453

Merged
max-sixty merged 3 commits into
mainfrom
passive-reads-at-edge
Oct 21, 2026
Merged

max-sixty merged 3 commits into
mainfrom
passive-reads-at-edge

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

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 Let page check --render pass a page with an unread agent message #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

On leaf.page, the `read` event the runtime posts once an agent message
has been on screen no longer starts a private container for a visitor
who has only read the page. The Worker answers it with a final refusal,
as `page check --render` does, so nothing is recorded and the tab
doesn't send it again that visit. Once the visitor's page is active,
reads reach the container and are recorded as before. Max's decision
#19 on the overnight report.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A passive read's final refusal persists after the visitor activates this page. createReadTracking puts the message/version in refusedThisVisit; its present() keeps that key while the message remains unread, and scan() skips it. If a visitor sees a reply and then comments in a different thread, the newly active session never receives a read for that reply during the same focused visit. The unread mark and Next unread destination remain, despite the reply having been shown. Please clear or reconsider these refused keys when the page becomes active, then rescan the visible messages.

max-sixty and others added 2 commits October 21, 2026 00:28
A passive leaf.page visitor's runtime now sends no read at all, as it
sends no viewport report, and scans again when its session turns active,
so a reply shown after the visitor acts is recorded in the same visit.
The edge's final refusal stays for a tab whose runtime predates this.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty max-sixty changed the title Answer a passive leaf.page visitor's reads at the edge Record no reads for a passive leaf.page visitor Oct 21, 2026
@max-sixty
max-sixty merged commit 6c6b827 into main Oct 21, 2026
3 checks passed
@max-sixty
max-sixty deleted the passive-reads-at-edge branch October 21, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants