Repository navigation
Type in a settled thread's reply without a thread pass per key - #3893
Merged
Merged
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]>
`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]>
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`, application.js's `refreshThread`). The pass existed for what a settled thread's box decides beyond its card: whether its seat keeps it among the open threads and whether the margin keeps its entry. Both read `replyIsEditing`, which #3864's `sessions` signal now makes a followed reading, and a session opens on focus and closes on dismissal, never on a keystroke. So the pass changed nothing; the card's own repaint stays. `reply.changed` had no other caller and goes with it. 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 its thread: 11 passes before, 0 after. A page seat's resolved card ran 0 passes on both. The comment on `PRESENTATION_DOM` now says how obligations locate a control a seat mounts after the thread pass's DOM commit: the control is a widget, and its connection presents the whole document (`widgetMounted`). Traced with a test thread surface whose `threadOutlets` waits 300 ms: the obligations paint and a location frame ran before the commit with no node; the commit mounted the lf-ask, which started another thread and obligations pass, and the next frame and On me's card found it. No code change was needed there. The committed kernel is rebuilt, which also brings in this branch base's runtime changes. 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]>
`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]>
max-sixty
marked this pull request as ready for review
October 27, 2026 05:28
leaf-agent
previously approved these changes
Oct 27, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The two margin cases selected from test_reply_sessions.py report the same metadata-action size change (92×28 → 139×30) on this head, its base 644925d3dbd78606cf5f47bdda5f19e2b4cc7797, and current main b0130cdd0. This is inherited and tracked in #4341; it does not withhold approval under the repository's test policy.
#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]>
leaf-agent
approved these changes
Oct 27, 2026
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.
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'srefreshThread). 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 readreplyIsEditing. #3864'ssessionssignal 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.changedhad no other caller, so it is removed too.Measured with a temporary
performance.markat 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: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.jstakesafter: 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 callswidgetMounted, which presents the whole document (invalidateDom). That claims the obligations region again, along with the thread region, and ticksdocumentChanged, which On me's cards read.I traced it with temporary marks and a test
x-thread-surfacewhosethreadOutletswaits 300 ms. The thread is on its datum and an agent reply carries anlf-ask. The surface first returned no outlets, then returned outlets with the delay: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_DOMnow 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.mdrequires.Checks
pnpm run test:runtime: 675 passed after merging currentmain.tests/browser/drafts/test_reply_sessions.py,threads/test_resolving.py,threads/test_summaries.py,threads/test_seated_threads.py,startup/test_thread_surfaces.pyanddrafts/test_revisions.py::test_live_executable_replacement_keeps_a_resolved_reply_session(102 passed). Alsonavigation/test_obligation_walk.py, bothtest_on_panel.pyfiles andwidgets/test_obligations.pywith-k "thread or seat or reply or frozen or resolv or on_me or walk"(43 passed), andmargin/test_entries.py,test_card_placement.pyandtest_opening_threads.pywith-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 profiletiming. The count above comes from a scratch browser test with marks that were removed before committing.