Repository navigation
Draw the margin once per thread pass - #3864
Conversation
The margin's annotations drew twice per thread pass: once from their own presenter, which waits only for the projection's chrome, and again when the thread pass committed (`untracked(renderAnnotations)`). A comment gesture runs two passes, so the margin drew four times; now two. The thread pass paints no other owner's region. What it decides about a thread reaches the margin as readings its paint follows: where the thread is placed (`placedAt`, already followed), and now whether a widget seats or holds it (`claimed`, `heldOut`, an `ownership` signal in thread/surfaces.js that moves only when the claimed set or a hold's keys change) and whether its reply is being edited (`replyIsEditing`, a `sessions` signal in thread/replies.js that moves when a session opens or closes). A commit that moves one has the margin's presenter claim again inside the same pass; one that moves none leaves the margin drawn once. Reply continuity, whose route may be a margin card, starts once `whenDocumentPresented()` settles, still in the task that committed. Measured with `leaf-dev profile triage-board comment` and a temporary mark in `renderAnnotations`: margin paints between the keydown and Sent went from 4, 4, 4 to 2, 2, 2 over three runs; `renderAnnotations` (8.7 ms inclusive per run) left the top-12 JS list. Co-Authored-By: Claude Fable 5.1 <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The ownership notifications also subscribe the thread pass to its own writes, so a seat membership change schedules another full thread paint. In a focused probe using the new runtime test’s setup, wrapping seating.commit() in an applicationPresenter paint produced two paints for one requested presentation. That adds another surface preparation/commit on the path this change is intended to reduce.
Both ownership.value += 1 expressions read the signal inside a tracked paint stretch; incrementing from ownership.peek() avoids those subscriptions. The internal page-candidate filter in commit() also still calls the now-tracked heldOut(thread.id) rather than the plain holdsOut(thread.id), so that call needs the same internal-read treatment already applied in prepare(). The existing test observes only the consumer’s effect and therefore misses this producer feedback loop.
`anchorPlacement.read` bumped its version with `version.value += 1`, which reads the signal before writing it. The read runs inside the thread pass's tracked stretch (`readTargets`), so the pass subscribed to its own write and `applicationPresenter` claimed the thread region again: every pass whose placements changed ran twice. `tick` in the new version-signal.js writes without reading, as page-controls.js's `tell` did by hand, and is the one home for advancing a version signal. Measured with `leaf-dev profile triage-board comment` and a temporary mark at the start of each thread pass: passes between the keydown and Sent went from 4, 4, 4 on main (each of the two publications started its pass twice, 1 ms apart) to 2, 2, 2. Co-Authored-By: Claude Fable 5.1 <[email protected]>
`x.value += 1` reads a signal before writing it; run inside a paint, as an owner's commit is, it subscribes that paint to its own write and the region claims another pass. The `ownership` and `sessions` bumps this branch added in thread/surfaces.js and thread/replies.js had that form, as did five sites on main that happen to run outside paints. All of them now call `tick`, and `no-restricted-syntax` in the private runtime's eslint block refuses `.value +=` so the form can't come back. The exact closures in .dependency-cruiser.mjs admit version-signal.js, which imports nothing. `tests/runtime/region-presenter.test.mjs` pins the difference with the real presenter: a paint that ticks a version paints once; one that reads the version first paints twice. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Continuity waited on `whenDocumentPresented()`, the whole pass, which also holds every widget's asynchronous preparation and any ticket a widget keeps open through a drag. A displaced reply editor would then wait on an unrelated widget before focus returned, and keys typed meanwhile would land on the page. It now waits on the margin's own DOM commit, `PRESENTATION_DOM.annotations`, the DOM its route may land in. The margin's claim for what the commit moved lands when the commit's stretch ends its batch, so the commit is read a microtask later; a margin owing no repaint has already committed, and continuity runs in the task that committed the seats. `tests/runtime/region-presenter.test.mjs` holds a widget's commit open through a pass and shows the margin's commit settling while the pass does not. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The backlog is now GitHub issues labelled `backlog`. Every item under Now, Next and Etc in `TODO.md` became one issue, so a pull request that says `Closes #N` links itself to its item, and a session finds untaken work with a query instead of reading a file that has no claim signal. #4000 landed first, so none of the new issues started a triage run (all 82 `tend-triage` runs were skipped). **Query.** ```bash gh issue list --search "label:backlog label:now -label:waits-on-user -linked:pr" ``` then `label:next` and `label:etc`. `-linked:pr` leaves out issues a pull request already links with a closing keyword. **What moved where.** - 82 issues from #4007 to #4089 (#4067 is another session's), one per bullet. Each is labelled `backlog` and its priority: 13 `now`, 29 `next`, 40 `etc`. Now and Next items also carry a theme mapped from their `###` heading: `ux` (User experience; User continuity and mobile access), `agent-experience` (Agent and author experience; The agent's text interface), `layout` (Layout; Layout stability; Queues), `review-tools` (Before/after comparison; Recorded interaction review) and `dev-velocity`. Etc's two headings, Product and harness ideas and Implementation candidates, sort kinds rather than subjects, so those items carry no theme. - 14 items also carry `waits-on-user`, the "Waits on the user" marking from #3891 (`todo-review`), and their bodies take that branch's wording, including its rewrite of the held-news item as "Keep a held-news count whole as it grows" (#3459 landed the "+N" route). `TODO.md` says what the label means, and the query above leaves those items out. - After the migration, #3891's author asked for three more edits from the grind PRs that touch these items: #4039 is retitled "Decide whether Pixels should soften redrawn-shadow fringes" (#3838), #4039 and #4048 (#3840) also carry `waits-on-user`, and #4098, "Keep a window preference from cramping a dashboard into a workspace", is the item #3913 puts in place of #4033. - Each title is the bullet's bold outcome. For the bullets whose bold text is a label ("Multiplayer:", "MCP Apps:"), the title adds the bullet's first clause. - Each body is the bullet's text with its hard wraps joined (GitHub renders a single newline as a line break), relative links made absolute, and `notes/` paths linked. A footer gives the bullet's `TODO.md` permalink, its heading, its position within its priority, the old `TODO #N` id for the six that had one, and the theme section's introduction where there was one. #4014's mention of the reply-widgets item now links #4089. - `TODO.md` keeps "Biggest current challenges" unchanged. Its priority explanation now says the items live in issues, what the labels mean, and how to query them. - `/developing-leaf` gains "Take a backlog item": pick an unclaimed issue that isn't waiting on the user, and open the PR early with `Closes #N`. It points at `TODO.md` for the query, so the rule and the query each have one home. - Every reference to a current `TODO.md` item now names its issue: `AGENTS.md`'s repository map, `/developing-leaf`, the thread snapshot skips, `journey.py`, `thread_snapshots.py`, `llm.py`, `test_tabs.py`, the Worker, two eval comments and five notes. - #3891's two note edits come along (`notes/browser-support.md`'s recheck rule, `notes/user-feedback-responsiveness.md`'s retired tone lever), since #3891 will drop its `TODO.md` changes. **Order.** Each issue's footer records its old position ("item 6 of 13 in Now"). I didn't keep an ordered index in `TODO.md`: it would be a second list of the backlog that every new issue has to be added to by hand, and it would drift from the labels. The priority label is the ordering that stays current. **Duplicates.** None of the 15 open issues duplicated an item, so every item is a new issue. **Mapping.** The old-item-to-issue table, with open PRs whose titles match an item, is below; the same table is at `~/.tmp/leaf.agent-afd0a8c0d63089ed9/backlog-mapping.md`. <details><summary>82 items</summary> | Issue | Priority | Old position | Old id | Title | Possible PRs | |---|---|---|---|---|---| | [#4007](#4007) | now › User experience | 1 (TODO.md line 43) | | Make complete reading journeys feel coherent | #3860, #3865 | | [#4008](#4008) | now › User experience | 2 (TODO.md line 47) | | Keep the Thread hierarchy clear | | | [#4009](#4009) | now › User experience | 3 (TODO.md line 49) | | Keep a long Thread's current status visible | | | [#4010](#4010) | now › User experience | 4 (TODO.md line 53) | | Test annotation placement in context (waits-on-user) | | | [#4011](#4011) | now › User experience | 5 (TODO.md line 57) | | Make the next move and its result apparent | #3879 | | [#4012](#4012) | now › User experience | 6 (TODO.md line 62) | TODO #28 | Finish the floating panel (waits-on-user) | | | [#4013](#4013) | now › User experience | 7 (TODO.md line 69) | | Keep a held-news count whole as it grows (waits-on-user) | | | [#4014](#4014) | now › User experience | 8 (TODO.md line 80) | | Stop moving live content between parents | | | [#4015](#4015) | now › Agent and author experience | 9 (TODO.md line 94) | | Wake idle Codex desktop chats without user messages | | | [#4016](#4016) | now › Agent and author experience | 10 (TODO.md line 99) | | Consider a reminder when revising decided content (waits-on-user) | | | [#4017](#4017) | now › Agent and author experience | 11 (TODO.md line 104) | TODO #20 | Act on the plain HTML comparison | | | [#4018](#4018) | now › Agent and author experience | 12 (TODO.md line 118) | | Keep delegated work in the panel's status on Codex and Pi | #3854 | | [#4019](#4019) | now › Agent and author experience | 13 (TODO.md line 123) | TODO #24 | Measure time to an initial reviewable page and the value of review | | | [#4020](#4020) | next | 1 (TODO.md line 149) | | Add a host-owned widget LLM allowance (waits-on-user) | | | [#4021](#4021) | next › User continuity and mobile access | 2 (TODO.md line 159) | | Bring back a rewrite Escape discarded | #3862 | | [#4022](#4022) | next › User continuity and mobile access | 3 (TODO.md line 163) | | Decide when a page merits a separate phone composition (waits-on-user) | | | [#4023](#4023) | next › User continuity and mobile access | 4 (TODO.md line 169) | | Improve maintained examples through a phone-quality queue | #3869, #3899, #3902 | | [#4024](#4024) | next › User continuity and mobile access | 5 (TODO.md line 175) | | Decide whether Back may restore a leaf.page page whole (waits-on-user) | | | [#4025](#4025) | next › User continuity and mobile access | 6 (TODO.md line 182) | | Consider automatic Leaf recovery on resume | | | [#4026](#4026) | next › User continuity and mobile access | 7 (TODO.md line 185) | | Verify the native phone reading journey | | | [#4027](#4027) | next › User continuity and mobile access | 8 (TODO.md line 189) | | Finish what a phone user still cannot reach | #3856, #3868, #3874, #3875 | | [#4028](#4028) | next › User continuity and mobile access | 9 (TODO.md line 199) | | Reconsider thread navigation (waits-on-user) | | | [#4029](#4029) | next › Layout | 10 (TODO.md line 224) | | Show returning threads without moving the current reading | #3883 | | [#4030](#4030) | next › Layout | 11 (TODO.md line 229) | | Let a page restyle Leaf's chrome on purpose (waits-on-user) | | | [#4031](#4031) | next › Layout | 12 (TODO.md line 235) | | Let a block be a workspace | | | [#4032](#4032) | next › Layout | 13 (TODO.md line 245) | | Show each floating surface across the content it can hold | | | [#4033](#4033) | next › Layout | 14 (TODO.md line 275) | | Test the Layouts on agents | #3913 | | [#4098](#4098) | next › Layout | 14, added by #3913 in #4033's place | | Keep a window preference from cramping a dashboard into a workspace | | | [#4034](#4034) | next › Layout | 15 (TODO.md line 285) | | Layout values that wait for a task: list-detail on a phone, canvas regions, slides | | | [#4035](#4035) | next › Layout | 16 (TODO.md line 288) | | Decide whether a too-narrow table fails a page at the fixed widths (waits-on-user) | | | [#4036](#4036) | next › Layout stability | 17 (TODO.md line 298) | | Keep what a live revision adds above the reader from moving it | | | [#4037](#4037) | next › Layout stability | 18 (TODO.md line 304) | | Keep the merge film's controls still as it steps | | | [#4038](#4038) | next › Queues | 19 (TODO.md line 314) | | Keep the open item's group named on a phone | #3853 | | [#4039](#4039) | next › Before/after comparison | 20 (TODO.md line 323) | TODO #29 | Decide whether Pixels should soften redrawn-shadow fringes (waits-on-user; was "Explain the faint amber halo in Pixels") | #3838 | | [#4040](#4040) | next › Recorded interaction review | 21 (TODO.md line 333) | | Explore DOM selection in the imported timeline | | | [#4041](#4041) | next › The agent's text interface | 22 (TODO.md line 343) | | Decide the Leaf-owned defects the bad-pages eval left open (waits-on-user) | | | [#4042](#4042) | next › The agent's text interface | 23 (TODO.md line 350) | | Read the full render gate after handover | #3888 | | [#4043](#4043) | next › The agent's text interface | 24 (TODO.md line 366) | | Consider loading a page once per render check (waits-on-user) | | | [#4044](#4044) | next › The agent's text interface | 25 (TODO.md line 372) | | Derive the waiting status from the page's open obligation | | | [#4045](#4045) | next › Development velocity | 26 (TODO.md line 380) | | Require `test` on `main` again (waits-on-user) | | | [#4046](#4046) | next › Development velocity | 27 (TODO.md line 386) | | Resume the thread appearance gate (waits-on-user) | | | [#4047](#4047) | next › Development velocity | 28 (TODO.md line 394) | | Guard thread appearance on CI again | #3896 | | [#4048](#4048) | next › Development velocity | 29 (TODO.md line 404) | | Keep the agent journey's samples (waits-on-user) | #3840 | | [#4049](#4049) | etc › Product and harness ideas | 1 (TODO.md line 420) | | Consider Redo and a Changes panel | | | [#4050](#4050) | etc › Product and harness ideas | 2 (TODO.md line 433) | | Link filenames to their repository context | | | [#4051](#4051) | etc › Product and harness ideas | 3 (TODO.md line 438) | | Revisit the Claude desktop app opening a page's file over the live page | | | [#4052](#4052) | etc › Product and harness ideas | 4 (TODO.md line 448) | | Decide the site's structure before release | | | [#4053](#4053) | etc › Product and harness ideas | 5 (TODO.md line 451) | | Assess whether automatic measurement freshness is useful | | | [#4054](#4054) | etc › Product and harness ideas | 6 (TODO.md line 457) | | Revisit where an abandoned comment's words come back | | | [#4055](#4055) | etc › Product and harness ideas | 7 (TODO.md line 462) | | Revisit a pin's icons if they read unclearly | | | [#4056](#4056) | etc › Product and harness ideas | 8 (TODO.md line 466) | | Revisit the reaction tokens' meanings or glyphs if they confuse | | | [#4057](#4057) | etc › Product and harness ideas | 9 (TODO.md line 471) | TODO #30 | Try a feed of ready-to-approve actions | | | [#4058](#4058) | etc › Product and harness ideas | 10 (TODO.md line 477) | | Explore independent jobs | | | [#4059](#4059) | etc › Product and harness ideas | 11 (TODO.md line 480) | | Tell the agent when to ask before ending its own to-do | | | [#4060](#4060) | etc › Product and harness ideas | 12 (TODO.md line 485) | | Let the user edit items in the On view | | | [#4061](#4061) | etc › Product and harness ideas | 13 (TODO.md line 489) | | Multiplayer: let several users share a page, each recorded as themselves | | | [#4062](#4062) | etc › Product and harness ideas | 14 (TODO.md line 495) | | Show which pane has focus, and move between panes by key | | | [#4063](#4063) | etc › Product and harness ideas | 15 (TODO.md line 508) | | Expand everything waiting with a keypress | | | [#4064](#4064) | etc › Product and harness ideas | 16 (TODO.md line 514) | | Let a user add, remove and edit table rows | | | [#4065](#4065) | etc › Product and harness ideas | 17 (TODO.md line 519) | TODO #16 | Named widget interfaces: let a typed reference name the interface its target implements | | | [#4066](#4066) | etc › Product and harness ideas | 18 (TODO.md line 523) | | Visual review beside Leaf: coordinate a real browser target through the harness | | | [#4068](#4068) | etc › Product and harness ideas | 19 (TODO.md line 526) | | Other harnesses: add a blocking `leaf wait` route when another harness needs it | | | [#4069](#4069) | etc › Product and harness ideas | 20 (TODO.md line 528) | | Consider Leaf running the agent session | | | [#4070](#4070) | etc › Product and harness ideas | 21 (TODO.md line 533) | | Decide whether an exported page carries its threads | | | [#4071](#4071) | etc › Product and harness ideas | 22 (TODO.md line 540) | | Character bindings: let users disable them | | | [#4072](#4072) | etc › Product and harness ideas | 23 (TODO.md line 541) | | Replacement diffs and visual masks for repeated reviews | | | [#4073](#4073) | etc › Product and harness ideas | 24 (TODO.md line 543) | | Motion evidence: define video, caption and transcript handling | | | [#4074](#4074) | etc › Product and harness ideas | 25 (TODO.md line 545) | | Revisit long-thread folding after using summaries | | | [#4075](#4075) | etc › Implementation candidates | 26 (TODO.md line 551) | | Remove the early-key hold once startup is fast on slower machines too | | | [#4076](#4076) | etc › Implementation candidates | 27 (TODO.md line 578) | | Draw the margin's annotations once per thread pass | #3864 | | [#4077](#4077) | etc › Implementation candidates | 28 (TODO.md line 587) | | Read moves exactly where the before/after pair is a browser's capture | | | [#4078](#4078) | etc › Implementation candidates | 29 (TODO.md line 597) | | Reduce plugin-update downloads by cleaning Git history | | | [#4079](#4079) | etc › Implementation candidates | 30 (TODO.md line 605) | | Set interaction-trace privacy before sharing pages | | | [#4080](#4080) | etc › Implementation candidates | 31 (TODO.md line 610) | | Make a leaf.page dispatch survive its container | | | [#4081](#4081) | etc › Implementation candidates | 32 (TODO.md line 616) | | Start each release's containers on its own image | | | [#4082](#4082) | etc › Implementation candidates | 33 (TODO.md line 629) | | Push page updates instead of polling | | | [#4083](#4083) | etc › Implementation candidates | 34 (TODO.md line 670) | | Claude Code tool observation: a cheap hook for sessions holding pages | | | [#4084](#4084) | etc › Implementation candidates | 35 (TODO.md line 672) | | Measure Leaf's hook cost for sessions holding pages | #3876 | | [#4085](#4085) | etc › Implementation candidates | 36 (TODO.md line 677) | | Invoker commands: test `command` and `commandfor` once Leaf's Chromium floor allows | | | [#4086](#4086) | etc › Implementation candidates | 37 (TODO.md line 681) | | MCP Apps: rebuild inline hosting as a direct resource | | | [#4087](#4087) | etc › Implementation candidates | 38 (TODO.md line 692) | | Release labels: prefer an exact tag when Leaf adopts named releases | | | [#4088](#4088) | etc › Implementation candidates | 39 (TODO.md line 693) | | Diff controls: author-configurable wrapping and per-file review tracking | | | [#4089](#4089) | etc › Implementation candidates | 40 (TODO.md line 695) | | Show a reply's widgets in every view of it | | </details> **Not migrated cleanly.** - Each section introduction (Layout, Layout stability, Queues, Recorded interaction review) is copied into every issue of its section, since a label can't carry it. - Eval fixtures that quote a past session mentioning `TODO.md` (`assessment-surfaces-pending-decisions`, `record-asks-hold-their-premise`, `options-*`) are recorded inputs and stay as they were. Two eval provenance comments and one line of `notes/agent-usability-evals.md` name items that left `TODO.md` before this change, so they have no issue to point at. - The fold-button entry #3891 corrected is in neither `TODO.md`, and #3928 fixed it, so it has no issue. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Takes main's TODO.md, whose backlog moved to GitHub issues in #4090. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The new continuity wait still inherits the widget commit it is intended to avoid. In mountAnnotations, the margin uses after: PRESENTATION_DOM.obligations; obligations use PRESENTATION_DOM.thread, and thread → projection → widgets completes that chain. applicationPresenter includes those transitive dependencies in the promises returned by PRESENTATION_DOM.annotations(), even when the intermediate regions owe no paint.
I reproduced this with the real presenter and those four production dependency edges: after their initial paints, queueing a widget with a held native commit left Promise.allSettled(PRESENTATION_DOM.annotations()) pending until the widget was released. Thus the new wait can still leave reply continuity waiting on that widget. The new test passes because its annotations presenter omits after, so it does not exercise the production margin. The continuity readiness boundary needs to distinguish the margin's committed card from unrelated upstream DOM work; the regression test should preserve the production dependency chain and assert that continuity proceeds while the widget remains held.
`renderSurfaces`' commit runs inside the thread pass's paint, and filtered a page registration's threads with `heldOut`, the followed reading. When the same commit then changed the claimed set, its `tick(ownership)` reached a signal the pass had just read, so the pass claimed a second one: the self-subscription the branch's `holdsOut` split exists to prevent, missed at this one site. The commit now reads `holdsOut`, as preparation does. Only a page registration (`placePageThreads`, which no bundled package uses) reaches that read, so bundled pages never took the extra pass. `tests/runtime/thread-surfaces.test.mjs` runs the first commit inside an effect, as the pass's resumed stretch does: it ran twice before the change and once after. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Main moved the signals import to /runtime/framework.js and folded event-kinds and passage-facts into kernel-facts.js; the PR's new version-signal imports and closures follow it. Kernel rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kernel rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kernel rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kernel rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…stream of it PRESENTATION_DOM.annotations is transitive: it includes every commit the margin's paint follows, down to the widgets, so a widget holding its commit through a drag still kept a displaced reply editor waiting. regionCommitted returns a region's own DOM commit, settled unless that region owes a paint, and continuity reads the margin's. The runtime test now keeps the page's chain (widgets, projection, thread, obligations, margin). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kernel rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
The focused reply-continuity checks passed their assertions. The margin-reload case reports the same metadata-action size change on this branch and current main (5b62cca91fccc8ee3f80d311759fec54933b9645); #4341 tracks that inherited failure.
#3864 landed as 95d241a; its commits resolve against the squashed copy, with regionCommitted kept. Kernel rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Follows #3864 (landed) and closes its two follow-ups. ## A settled thread's reply no longer claims a thread pass per keystroke Each keystroke in the reply box of a resolved thread scheduled a frame that repainted the card and then claimed a whole thread pass (`reply.changed`, which is application.js's `refreshThread`). That pass was there for two things a settled thread's box decides outside its own card: whether its seat keeps it among the open threads, and whether the margin keeps its entry. Both read `replyIsEditing`. #3864's `sessions` signal makes that a followed reading, and a session opens on focus and closes on dismissal, never on a keystroke. So the pass changed nothing. The card still repaints itself. `reply.changed` had no other caller, so it is removed too. Measured with a temporary `performance.mark` at the start of each thread pass (`renderReading`), typing 11 characters 60 ms apart into a margin card's reply after the agent resolved the thread: | | thread passes | |---|---| | before | 11 | | after | 0 | The same journey on a page seat's resolved card ran 0 passes both before and after. ## Obligations in late-mounted seats: the premise didn't hold The follow-up said `obligations/view.js` takes `after: PRESENTATION_DOM.thread`, which resolves before the seats commit, and never repaints when they land. The first half is true. The second is not. An obligation's control is a widget, and a widget the seat commit mounts calls `widgetMounted`, which presents the whole document (`invalidateDom`). That claims the obligations region again, along with the thread region, and ticks `documentChanged`, which On me's cards read. I traced it with temporary marks and a test `x-thread-surface` whose `threadOutlets` waits 300 ms. The thread is on its datum and an agent reply carries an `lf-ask`. The surface first returned no outlets, then returned outlets with the delay: ``` thread-pass@5:none obligations-paint@6:none location-frame@9:none seats-commit@308:node mounted-first-job@312:node thread-pass@316:node obligations-paint@316:node location-frame@328:node ``` On me was open throughout. Its card had no answer buttons while the control stood nowhere, and showed "Put the mounts back / Install the camera" after the commit, without being reopened. With no delay the order was the same. So no code change is needed here. The comment on `PRESENTATION_DOM` now says how obligations find such a control (`widgetMounted`). It had previously named only the margin's readings. The committed kernel is rebuilt as `build/AGENTS.md` requires. ## Checks - `pnpm run test:runtime`: 675 passed after merging current `main`. - Browser: `tests/browser/drafts/test_reply_sessions.py`, `threads/test_resolving.py`, `threads/test_summaries.py`, `threads/test_seated_threads.py`, `startup/test_thread_surfaces.py` and `drafts/test_revisions.py::test_live_executable_replacement_keeps_a_resolved_reply_session` (102 passed). Also `navigation/test_obligation_walk.py`, both `test_on_panel.py` files and `widgets/test_obligations.py` with `-k "thread or seat or reply or frozen or resolv or on_me or walk"` (43 passed), and `margin/test_entries.py`, `test_card_placement.py` and `test_opening_threads.py` with `-k "resolv or settl or reply or draft"` (3 passed). No test asserts the pass count. That would need a counting hook the harness doesn't have. The behavior the claim used to serve is covered by the resolved-reply session tests: the box stays while its session stands, and the margin entry goes once the session is dismissed. Not verified: Firefox, and the `leaf-dev profile` timing. The count above comes from a scratch browser test with marks that were removed before committing. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
#3864 made reply continuity wait for the margin's own DOM commit (`regionCommitted("annotations")`) and said that a widget holding its commit, as through a drag, no longer kept a displaced reply editor waiting. That holds only when the margin owes no repaint. A region's own commit (`presenter.committed` in `framework/presentation.js`) resolves in its paint, and `collect` runs the paint only after the DOM its `after` names, which for the margin is obligations, thread, projection and the widgets. When an editor is displaced the margin usually repaints, so a held widget still delays continuity. A scratch runtime test confirmed it: a margin claimed while a widget holds its commit doesn't commit until the widget does. ## What changed - `applicationPresenter` returns `committed`, its region's own DOM commit, and its header says when that settles: at once when the region owes no paint, otherwise after everything upstream. - `application.js` passes the margin presenter's `committed` into `createThreadPresentation` as `marginCommitted`, which continuity awaits. This replaces the string-keyed `regionCommitted` and its `ownCommits` map, which had this one caller. - `PRESENTATION_DOM.annotations`, added by #3864, is deleted: nothing in production read it, only the test. - The comment in `thread/presentation.js` now says a repainting margin still waits for its upstream, so a held widget delays continuity then. - The runtime test is renamed to the case it covers, a region owing no paint, and reads the region's `committed` and the margin's `after` chain directly. Whether continuity should skip held widgets when the margin repaints is left open; this change only makes the code and its comments agree. #3864's `tick()` helper and its eslint rule stay. > _This was written by Claude Code on behalf of max-sixty_
The margin's annotations were drawn twice per thread pass: once by their own presenter, which waits only for the projection's chrome (the thread region's
committed()resolves after its synchronous start, before its seats commit), and again when the thread pass committed (untracked(renderAnnotations)inthread/presentation.js). A comment gesture runs two thread passes (the local send, then the server's reading), so the margin drew four times. Measuring also showed each of those thread passes ran twice onmain, becauseanchor-placement.jsadvanced its version withversion.value += 1inside the pass, subscribing the pass to its own write.What changed
thread/presentation.jsno longer callsrenderAnnotationsat commit, andcreateThreadPresentationno longer takes it. What the pass decides about a thread reaches the margin as readings its paint already follows (applicationPresenterfollows a paint's reads of values outside the state): where the thread is placed (anchor-placement.jsplacedAt, already a followedversion), and now also whether a widget seats or holds it and whether its reply is being edited.thread/surfaces.js:claimedandheldOutare followed readings. Oneownershipsignal moves when a commit changes the claimed set or a hold changes the keys it keeps out; both compare sets, so a commit that seats the same threads moves nothing. The module's own reads inprepareandcommittake the plain answer (holdsOut), so the thread pass doesn't follow what it moves itself.thread/replies.js:replyIsEditingis a followed reading. Asessionssignal moves when a session opens or closes (openSession/closeSession, the four membership writes), not when its owner changes. The margin lists a resolved thread only while a session stands (threadHasDiscussion), and previously relied on the thread commit's redraw to notice a session starting or ending.version-signal.jstick, the one home, aspage-controls.jstelldid by hand).x.value += 1reads the signal first, and inside a paint subscribes that paint to its own write, so the region claims another pass.anchor-placement.jshad this form onmaininside the thread pass (its own commit, measured below); the newownershipandsessionsbumps had it too, as did five sites onmainoutside paints. All are converted, andno-restricted-syntaxin the private runtime's eslint block refuses.value +=. The exact closures in.dependency-cruiser.mjsadmitversion-signal.js, which imports nothing.continueRepliesstarts once the margin region's own DOM has committed (regionCommitted("annotations"), new insemantic-state.js: a region's commit without the upstream DOM its paint follows, settled unless the region owes a paint), read a microtask after the commit's stretch so the margin's follow-on claim has landed. It does not wait for the whole pass (whenDocumentPresented()), nor forPRESENTATION_DOMentries, which are transitive down to the widgets, so neither a widget's asynchronous preparation nor a commit it holds through a drag leaves a displaced reply editor without focus meanwhile. It still runs in the task that committed the seats.semantic-state.js,annotation-inventory.jsandapplication.jsdescribe the mechanism (the followed-readings path is the margin's;obligations/view.jsstill depends onPRESENTATION_DOM.thread).The margin still doesn't depend on the thread region committing: its
afterchain is unchanged, so a held thread pass delays no margin paint; it repaints again only when a reading the pass moved says so.Evidence
uv run leaf-dev profile triage-board comment, 3 runs each, with temporaryperformance.marks (not committed) at the start of each thread pass (renderReading) and inrenderAnnotations, counted per trace between the last keydown and theSentgoal (.tmp/grind/count_paints.py):main(f00911ed1)renderAnnotationswas 8.7 ms inclusive per run inmain's top-12 JS list and no longer appears in it. Elapsed times are noise on a loaded host (load average ~25 on 18 cores during the runs); the counts are the measurement.Tests
tests/runtime/thread-surfaces.test.mjs: "a paint reading which threads a seat claims follows the commit that changes them" fails on the baseline reading and passes with the change. It also runs the commit inside an effect, as the pass's resumed stretch does, and asserts that effect runs once; it ran twice whilecommitfiltered page threads with the followedheldOut.tests/runtime/region-presenter.test.mjs: "a paint advancing a version it does not read claims no second pass" (aticked paint paints once, a+=paint twice, with the real presenter), and "the margin's own commit is reachable while a widget holds its paint" (the page's chain of regions, widgets to margin, with a widget's commit held open:regionCommitted("annotations")settles whilePRESENTATION_DOM.annotations()andwhenDocumentPresented()do not; with the transitive wait it hangs).pnpm run test:runtime: 671 pass after merging currentmain.pnpm run checkpasses.test_seated_threads.pyandmargin/test_card_reply.pywith-k "reply or return or continu or displac or moved or seat": 79 pass;test_r_settles_the_thread_seated_under_the_diff_line_the_user_stands_ontimes out onlf-diff .lf-diff-fold-allonmaintoo, and a margin-reload case reports the thread-actions size changemainalso shows (Thread resolution changes the size of its metadata actions #4341).tests/browser/threads/test_seated_threads.pyandtests/browser/startup/test_thread_surfaces.py: 51 of 52 pass after mergingmainat070e6dd54. The one failure,test_a_user_on_a_thread_returning_to_the_diff_goes_with_it[close], fails the same way onmain(focus assertion at line 853).test_a_resolution_from_elsewhere_moves_nothing_after_a_diff_threaderrored after the earlier merge ofmainatc26545cd3(p#aftermoved 355px). That is Externally resolved diff thread test reports a 355px passive shift #4097, whichmainatc26545cd3also fails 5 of 5 runs; fix: hold presentation through the first drawing after a skipped update #4103 fixed it, and the branch passes 5 of 5 with it merged.tests/browser/margin/test_entries.py,test_opening_threads.py,test_card_reply.py,test_status.py,tests/browser/threads/test_resolving.py, and the held-arrival cases oftest_agent_replies.pyandtest_arrivals.py: pass (card_reply and resolving re-run after thereplies.jschange).Not verified
heldOutfollow (a hold changing between passes) is exercised only by the held-arrival browser tests, not by a runtime test.createThreadPresentationitself.threadOutletsrender asynchronously; the bundled widgets were covered by the browser tests above.Calls Max may reverse
replyIsEditingis followed by every paint reading it, including thread cards, so a reply session opening (first focus in a reply row) or closing now claims a thread pass where an open thread previously claimed none. A narrower alternative is a follow token the margin alone reads..value +=on any member namedvaluein the private runtime; no DOMinput.value +=exists there today.Closes #4076.