Repository navigation
Select page state from the served reading, and count gate coverage as served - #1235
Merged
Merged
Conversation
… served
`leaf page state` and `leaf thread read` called `full_state` and then folded
the log again: the active document, two more thread folds, the frozen thread
reading, thread Asks and requests, updates, unread, summaries, and their own
workflow-by-thread grouping. `browser_state` now returns its wire dict with a
`BrowserReading` (threads, frozen thread reading, each view's document
reading), `read_served_page` returns a `ServedPage` (state, reading, stored
data), and agent state selects from those. `full_state` is the JSON-only
wrapper. `FrozenThreadReading.subject_thread` replaces three inline copies of
which thread a subject stands in.
Each served thread now carries its `id`, and the browser's attention grouping
keys on it rather than `root.id`, so a thread whose opening message a torn log
line lost reads its open Ask as the user's turn.
Behaviour that moved: `thread read` summaries carry `protected`, the same
summary the browser shows. `page state` output is otherwise byte-identical
on nine example pages; in-process time on a 347-event page fell from about
24-33 ms to 17-24 ms.
The render gate's `logApplied` wait counted {action, report} events; the
runtime's stamp counts the served `coverage` records, undos included.
`wait_for_presentation` now reads `log_coverage(state)` itself.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Sep 26, 2026
max-sixty
added a commit
that referenced
this pull request
Sep 27, 2026
… reader (#1250) Four Python readers waited on different subsets of the runtime's readiness facts. The suite's `BOTH_STAMPS` required upgrade, an applied stamp, presentation, the coordinator's current reading, settled rendering and deferred arrivals (#913 and #1145 added the last two, but only there). The render gate's `wait_for_presentation` waited on data version, log coverage and current presentation, with neither arrival nor rendering. `scripts/example-previews.py` and `record-demo.py` checked the three body stamps alone, and `record-demo.py`'s stills waited on upgrade and a count of `action` lines in `events.jsonl`, with no presentation, where the gate counts the reading's served coverage (#1235). `pageReadiness` in `runtime/presentation.js` now names the first fact a page has yet to state, in the order a page reaches them: `upgraded`, then `data` and `log` against an `/api/state` reading the caller holds, then `presented`, `arrived` and `rendering`. It returns null once the page is ready. The entry script exposes it as `lfReadiness`, replacing `lfCurrentPresentationReady` and `lfPageArrived`; `lfRenderingSettled` stays for waits after input. `leaf.render_checks.wait_until_ready(page, state=None)` is the one Python wait. It raises `PageNotReady` naming the stage, and every reader uses it: the suite (`open_page`, `navigate`, `restarting`, the arrivals case and each direct wait), the gate's scheme pass and page-code run, the catalog stills, and the demo recording. The stills now wait against the server's reading, so they count served coverage. Behaviour that moved: - `leaf version check` now also waits for deferred arrivals and settled rendering before it reads a page, and reports either stage by name. A failure at either still keeps the projection findings, as `pageSettled` did. - The gate requires the applied stamp even when the reading covers no records; before, it skipped the log stage then. - The page-code run reads `/api/state` straight after navigation, not after the upgrade stamp, since the readiness wait includes upgrade. - The catalog stills and demo frames are shot after deferred arrivals land and rendering settles, not at first presentation. - A timed-out wait names its stage in the runtime's own words, and reports a page that cannot answer within 5s as `answering`. The render-check probes `initiallyPresented`, `currentPresented`, `dataApplied` and `logApplied` are gone, along with `validationPresentationReady` and `pageArrived`. The tests that read them now assert the readiness stage, or the coordinator's `applicationPresented` directly. A new gate test holds a page's first state answer and checks that the wait fails at `log` with that wording, then passes once the answer lands. The scheme pass keeps its `upgraded` probe as a barrier before the visual-provider check, which must run before presentation can hang on an invalid inventory. `scripts/verify_site.py` and the MCP app still wait on `data-lf-presented` alone. That is the interaction boundary a host shows the frame at, and it stays their fact. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Sep 27, 2026
The concept survey's drifted duplicates now each have one owner (#1214–#1221, #1223, #1228, #1231, #1235, #1244, #1245, #1247, #1250, #1251, #1254, #1260), so the survey note never lands. What it found and nobody has taken becomes `TODO.md` entries: - **Shared definitions** (new section under Next): re-addressing resource references in one pass instead of `http.py`'s regex scopers and three head composers; `tests/render_harness.py` `told()` beside `pageReadiness`'s `data` and `log` stages (#1250), which answer the same question; Python still naming a thread's identity a root (`thread_roots`, `FrozenThreadReading.roots`) now that the runtime keys threads on the served `id` (#1260). - **Requests**: the existing "Decide whether requests earn their weight" entry now says kept requests need one owner for seat availability, which four runtime modules restate. - **Implementation candidates**: the unresolved-gesture ledger as one state machine, deferred until a change has to touch it, since nothing there has drifted and it is the hottest race path. The survey's small undrifted items and its list of deliberate splits are dropped: none has drifted, and the splits are intended. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > _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 stateandleaf thread readnow select from the reading/api/stateserves instead of folding the log a second time. The render gate now reads the log coverage from that same served state instead of keeping its own count of it.Page state is a selection.
_write_page_statecalledfull_state, which runsbrowser_state, and then rebuilt every reading itself: the active document'spage_readingandread_document, two morebuild_threadsfolds,frozen_thread_reading, the thread request lifecycles and Asks,canonical_updates,unread_content,active_summaries, and its own grouping of workflows by thread. Now:browser_statereturns its wire dict together with aBrowserReading: the threads, the frozen thread reading, and each view'sDocumentReading.browser_threadandbrowser_documentalready return this kind of pair.project_browser_statepasses the pair through.served_state.page.read_served_pagereturns aServedPageholding the state, the reading, and the stored data it read.full_statestays as a thin wrapper for every caller that only wants the JSON.agent_statetakes the document, the threads, and the frozen thread reading fromBrowserReading. It takes the thread Asks, updates, unread messages, and summaries from the served wire. It still builds its ownelements,state,content,requests(every occupied seat, across revisions), andreactions.FrozenThreadReading.subject_threadstates which thread a thread or widget subject stands in. The browser's attention grouping andthread read's update and workflow filters all use it, replacing three inline copies.Each served thread carries its
id. The browser grouped attention bythread["root"]["id"]. When a torn log line loses a thread's opening message, the surviving reply opens the thread under the lost id (build_threads), so the root's id and the thread's id differ. Asks and workflows name that thread by the lost id, and the attention lookup missed them: a thread whose open Ask sat in the surviving reply read as nobody's turn. Each served thread now carriesid, and both the attention grouping andpage statekey on it.test_a_thread_whose_opening_message_was_torn_away_still_readsasserts the thread reads as the user's turn, and fails with the old keying. The runtime still keys threads onroot.id(scripts/browser/application.ts,thread/*), so the panel's own reading of such a thread still misses it; the wireidis now there for it to read.Before a page's first revision, the served state has no browser reading. The document, thread, Ask, and update sections of
page statethen keep their empty defaults. That case has no thread or claim subject for them to report, becausestatus --onand every thread need a document.Output. I diffed
page stateand everythread read(at--after 0and--after 3) from base and candidate on nine pages: the feature gallery, ship-review, corpus, command-hub with one pending and one receipted request, review-a-plan, log-retention, triage-board, a gallery page seeded with 347 events, and a command-hub page with two thread Asks, a thread-widget answer, a worker report, and a thread claim. Both versions ran back to back against the same page directories, and a second base run matched the first. The only difference: each summary inthread readnow carriesprotected. That is the browser's list of covered messages that stay in view, so the agent reads the same summary the user is shown.test_thread_summary_is_admitted_as_one_ordered_thread_rangenow asserts that equality.Time. In-process
page statemedians on the 347-event page were 24/31/33 ms before and 19/17/24 ms after (three interleaved rounds of 30 runs each); on the thread-Ask page they were 14/15/10 ms before and 11/9/7 ms after. The spoken reading,read_document, and the frozen thread projection now each run once. The CLI's roughly 0.3 s is mostly process startup.Gate coverage.
render_gate/scheme.pyandrender_gate/page_code.pycounted{action, report}events for thelogAppliedwait. The runtime'sdata-lf-appliedstamp counts the servedcoveragerecords, and those include undos.render_checks.wait_for_presentationnow reads that count itself throughlog_coverage(state)(the length of the active view'scoverage; every view lists the same records), so neither caller passes a count. The gate's "never finished replaying" message now counts records rather than actions.scripts/record-demo.pykeeps its own action-only count, because another branch has unmerged work in that file.🤖 Generated with Claude Code