Repository navigation
Keep On Me's reading of the page until what it reads changes, so m costs a lookup - #6342
Merged
Merged
Conversation
…costs a lookup Each press of `m` rebuilt On Me's groups from every item twice: once to step, and again after arriving to announce the position. Each rebuild placed every item on the page, found the heading over it and sorted them all. On a page of 400 questions the keydown took 7.6 ms and the position read after arrival 16 ms. The queue walk now keeps that reading (each item's stop, page place and heading, and the walk's stops in On Me order and page order) against a key of what it reads: the queues and obligations the server read, the plan, the user's grouping, the page's reading (`pageReadingVersion`) and the threads' placement. Placement had no value saying it changed in the task that changed it, only a signal ticked after the script, so it gains `placementVersion`, a count that moves as soon as any thread's placement does; the seeded placement test now holds that. Where the user stands on a stop, `obligationHolding`'s per-list name index is reused for the kept list instead of rebuilt per press. A walk from what the window shows (#6327) asked `seenWhereRead` of every stop above the read block, each a measure of what clips it. A node a window or more above or below the read block is off screen however the glides move the region, so it is now judged by its box. Measured with `leaf-dev probe` on 400 questions, warm presses: keydown 7.6 ms base, 2.4 ms head; position after arrival 16 ms base, 0.6 ms head. The first press after a change rebuilds once, 10.6 ms. `leaf-dev bench` gains a `walk` input (m and Shift+m from the page's middle), so the walk's growth is measured from now on; `bench asks --input walk --read cpu` per press: base 21/25/33/43/63 ms at 8/64/128/256/512 questions (exponent 0.90), head 18/23/29/27/36 ms (0.39).
…y does `lf-tabs` and `lf-deck` each split a region's obligations into open, waiting on the user and with the agent by reading `status` and `next_actor` themselves, the split `tally()` (runtime/obligations/tally.js) owns for `lf-tally`. A change to how the tally counts would have left a tab's mark and a deck's pips counting the old way. Both now read `tally()`'s counts, and the deck's arrival takes the card's waiting obligation from `readObligations().user`, the reading's list of what waits on the user, as module-reading.md tells a module to. No package reads `next_actor` or `status` any more; what each shows is unchanged.
…s reading doesn't follow Keeping On Me's reading against the page's reading (`pageReadingVersion`) left it stale where an element's id or a part's name changed and the words didn't: the watcher reports an id apart from the reading, and doesn't hear `label` or `aria-label` at all, though `obligationPlace` finds a question's group by id and `partOver` names a part by those attributes. Codex found both with base/head probes: two question groups that swap ids kept their old order in On Me and in `m`, and a box given an `aria-label` headed no group of its own until something else changed. The watcher now hears `label` and `aria-label`, apart from the reading as it hears `id`, and `pageNamesVersion` moves whenever an id or one of those attributes changes, or an element bearing an id comes or goes. On Me's reading keys on it, and so do the two other readings kept against the page's that read ids or names: the conversations each part holds (thread/placement.js), whose parts are `partOver`'s, and the visual actions plan, whose labels are its sections'. Before this, both stayed stale the same way. The new On Me test fails on the aria-label step without the key in queue-walk.js, and on the id step without ids in the version.
…ck is judged A walk from what the window shows takes the read block where the glides under way leave it (`blocksOnScreen`), but asked `seenAhead` of each stop, which also counts a stop a glide carries toward the window. A long glide carries a stop up from below the window to end above it, so `m` pressed mid-glide went back to that stop: on a page of 80 asks, twelve `d`s then `m` reached ask 61 while the glide ran and ask 65 once it had landed. Codex found it in review of the On Me change. `seenLanded` is the landing half of `seenAhead`, and `seenWhereRead` asks it, so a stop and the block it stands beside are judged in one place. `seenAhead` keeps the toward clause for the card a walk glides in, which trails its placement. The new test fails with `seenAhead` there (ask-61 against ask-65) and passes with `seenLanded`.
… kept against it follows them The fix before this one gave readings that read ids or names a second version to key on beside the page's reading, and added it to On Me, the conversations each part holds and the visual actions plan. Codex's review of it found two more readings kept against the page's that read ids and were left out: a saved draft's place (annotation-inventory.js, through `keptWithReading`), which stayed on the old paragraph after two paragraphs swapped ids, and a comment's point (pointed-place.js), lost after ids swapped and swapped back. A second version each reader must remember to add fails that way for every reader that forgets it. So the page's reading as its readers see it now moves with them: `pageReadingVersion` and `keptWithReading` take a new value whenever an id or a part's name changes, while the reading of the words underneath (the outline, the passage index) stays keyed on the words alone. `pageNamesVersion` is gone, and the three readers that keyed on it key on the page's reading again. The names heard are `label`, `aria-label`, `alt` and `for`, the attributes `ownNaming` reads; Codex found `alt` and a label's `for` missing too. In Codex's four presentation passes over the corpus, nothing wrote a `label` or `aria-label` outside Leaf's surfaces, so those readings rebuild no more often there. A runtime test holds that the version and what `keptWithReading` keeps move with an `aria-label`, a `label` and an id, and not with a class that isn't Leaf's; it fails without the names token.
… type that decides a label Moving `keptWithReading` with ids and names made the layout of the words on screen, which reading-place.js keeps through it, rebuild on an id-only change: Codex measured the next reading-position lookup at 8.8 to 9.2 ms and 96 element boxes against 0.8 to 0.9 ms and 22 before. That layout reads no id or name. So `keptWithReading` lasts as long as the words again, and only `pageReadingVersion` moves with ids and names. The one reader of `keptWithReading` that resolves anchors, a draft's place in the annotation inventory, keys on `pageReadingVersion` instead. The watcher also hears `type`, which decides whether a control takes a `<label>`'s name: Codex showed an input turning from `hidden` to `text` move a label's name off a button, and so `partOver` off it, with the version unchanged. The runtime test now holds both lifetimes: the version moves with an `aria-label`, a `label` and an id while what is kept with the words stays, and both move with the words.
leaf-agent
approved these changes
Nov 18, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 18, 2026
…#6346) On Me's seats and stops, the conversations under each part, the visual-actions plan and each draft's place were cached against keys listed by hand, and the review rounds on #6342 kept finding inputs those keys missed (an id swap, an `aria-label`, a draft's section). This records the inputs as they are read instead: `kept` and `keptEach` in `browser/runtime/kept.js` are signals-core `computed`s, so every signal a reading reads is tracked, and the facts outside any signal (the page's reading, the threads' placement, the user's choices, a visual's parts, widgets' layout notices) record themselves through `reads` and are checked on each read. The four caches convert, and `placementVersion` leaves anchor placement's API. To weigh: the page's reading and placement stay pull-checked rather than becoming signals, since a view drawn from them would then draw again at every change the page hears, as on each frame a widget redraws a counter; a moved version makes a fresh reading without notifying the old one's views. Two readers of attributes the page's watcher doesn't hear now follow their announcements where they read them: `currentDatums` reads `documentChanged`, and `claimsVisualGesture` reads `documentChanged` and the new `layoutsChanged`. That replaces the visual plan's hand-listed `documentChanged`, shown document and `lf-layout` reset, and fixes a draft on a datum missing its source's new revision. Cost is unchanged: on 400 questions an `m` press takes 2.5–3.6 ms warm (2.4–3.4 before) and 5.5–6.3 ms after a word changes (5.2–6.5 before); the walk bench matches at 64–512 questions. The user asked for this as a follow-up to #6342, and Codex reviewed it twice. Tests: `pnpm run check:browser`, the runtime suite with new `kept.test.mjs` and `kept-unheard.test.mjs` (each new assertion fails with its reader's recording removed), and 72 targeted browser tests (On Me, the walk, tabs, deck, threads, previews, aim, visual actions, draft entries). > _This was written by Claude Code on behalf of max-sixty_
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.
Each press of
mrebuilt On Me's groups from every item twice, once to step and once to announce the position, so on a page of 400 questions a press cost 7.6 ms in its handler and 16 ms more after arrival. The queue walk now keeps that reading (each item's stop, place and heading, and the walk's stops) until something it reads changes: the server's queues and obligations, the plan, the grouping, the page's reading, or where threads are placed. A warm press takes 2.4 ms and its position 0.3 ms.Two of those inputs needed work. Anchor placement gains
placementVersion, which moves in the task a placement changes. AndpageReadingVersionnow moves with ids and part names (label,aria-label,alt,for,type) as well as words, sinceobligationPlacefinds a question by id andpartOvernames a part by those attributes; the watcher hears them apart from the words, so the outline, passage index andkeptWithReadingstay keyed on words. Four readings already kept against the page's version went stale the same way and now follow too: the conversations each part holds, the visual actions plan, a draft's place and a comment's point.A walk from what the window shows (#6327) measured every stop above the read block, and counted a stop a glide carried past the window as seen. A stop a window or more away is now judged by its box, and every stop where the glide lands (
seenLanded), as the read block is.lf-tabsandlf-deckeach repeatedtally()'s split bystatusandnext_actor; both now readtally(), showing the same.Ownership: the server decides which obligations exist, their status, next actor and On Me membership; the browser decides where each stands in the rendered page, which the server's copy of the document doesn't hold, so On Me's order and grouping stay in the browser, kept against their inputs.
To weigh:
reading()inqueue-walk.jslists what On Me's reading depends on, so a new input must join it.leaf-dev benchgains awalkinput; per press, base 21/25/33/43/63 ms at 8 to 512 questions, head 18/23/29/27/36 ms.Max asked for this after #6327. Codex reviewed it three times; its findings (stale ids and names, the glide case, label
type, an id change discarding layout) are fixed, each with a test that fails without it.pnpm run check:browser, the runtime suite and 59 On Me, walk, tab, deck, preview and visual-action browser tests pass.