Skip to content

Keep each margin pin's seat through a resize that leaves its surroundings as they were - #6071

Merged
max-sixty merged 3 commits into
mainfrom
perf-input-scaling
Nov 16, 2026
Merged

max-sixty merged 3 commits into
mainfrom
perf-input-scaling

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Opening a comment box on a line of the patch at the top of the asks bench page re-seated every margin pin, because the box resizes the page and the margin's ResizeObserver cleared every row's seating record (layoutMovedPage), so the pass read every target and walked the page around every pin again. Now a resize delivery says which watched boxes changed size, and a pin keeps its record, moved down by however far its subject moved, when what the record read still stands as it did around that subject: its neighbours (the boxes beside the subject's path that its band met, which coverIn now records) moved with it at the same size, no box that changed size reaches its band, and at every level of the path that holds a changed box the band meets no box it didn't (seatingsAfter, seatingMove). Every other change that may move the page still clears every record.

What to weigh: Max picked having the browser move the pins (carriers anchored to each section). Measured first, it can't work in Chromium: every anchored box is laid out again on each layout of the document, so 256 section carriers added 6–14 ms to every layout of the page, as each keystroke into a field brings; the header records the measurement. This is the other design he was offered. Three Codex reviews found pins the first versions kept wrongly (a neighbouring column that didn't move, a box shrinking toward its foot, a neighbour entering the band, pointed comments); each is now a step in the browser test, and each check fails it when switched off. A box drawn outside the box holding it (absolute from elsewhere, a transform) can still come beside a kept pin unread, the same gap the anchored design had.

leaf-dev bench asks --input open … --base --rounds 2 at 256 sections: opening a comment box 109.7 → 66.3 ms of main-thread CPU, painted 82.2 → 36.7 ms; comment, resolve and reply unchanged. What still grows is the markers' spoken "N percent down" names, which read every entry's place on any height change (readSpokenPositions).

Tests: test_a_pass_for_a_change_to_the_rows_seats_them_as_a_whole_pass_would gains five resize steps; the focused margin browser tests, the reviewers' reproductions (36 shapes) and pnpm run test:runtime pass.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 2 commits November 15, 2026 12:08
…ings as they were

Opening a comment box on a line of the patch at the top of the asks bench page cost
about 110 ms of main-thread time at 256 sections and grew with the page: the box
resizes the page, the margin layer's ResizeObserver cleared every row's seating record
(`layoutMovedPage`), and the pass read every target and walked the page around every
pin again (`coverIn`).

A resize delivery now says which watched boxes changed size (`heardSizes`), and a row
keeps its record (`seatingsAfter`, `seatingMove`), moved down the page by however far
its subject moved, when what the record read still stands as it did around that
subject: its neighbours, the boxes beside the subject's path that its band met (which
`coverIn` now records), stand where they did beside it at the same size; at each level
of that path holding a box that changed size, the band, where it stands now, meets no
box it didn't; no box that changed size reaches the band (a box's reach grown back by
any shrink, either way); and no box holding the subject changed width or changed with
no smaller box saying where. A kept row a rail note decided re-checks the note.
`shiftedPin` moves a pin's bounds, the window's edges and the page's top, with the
scroll alone. Every other change that may move the page still clears every record.

Rejected, and recorded in the header: carriers anchored to each section, so the
browser moves the rows through a page change. Chromium 158 lays out every anchored
fixed or absolute box on each layout of the document, whatever changed, at 25 to 55 µs
each on a page of 12,000 elements, so 256 section carriers added 6 to 14 ms to every
layout of the page, as each keystroke into a field brings.

Three Codex reviews shaped the checks: the first versions kept a pin whose target moved
beside a column that didn't, kept stale cover where a bottom-aligned box shrank, missed
a neighbour the band came to meet, and followed a pointed comment's target rather than
its point. All agree with a full pass now, over 36 shapes the reviews built. A box that
moves without changing size outside the box holding it, as an absolute box placed from
elsewhere or one a transform moves, can still come beside a kept pin unread.

`leaf-dev bench asks --input open --input comment --input resolve --input reply --base
--rounds 2`: opening a comment box took 109.7 ms of main-thread CPU at 256 sections on
main and 66.3 ms here (8 sections: 32.5 and 27.9), and painted in 36.7 ms instead of
82.2; the resize's own task fell from about 70 ms of script to 14. Comment, resolve and
reply are unchanged within noise. Checking the kept records costs about 6 µs a row at
256 sections, growing with the logarithm of the page. What still grows in the resize's
task is the markers' spoken names, which read every entry's place whenever the page's
height changes (margin-projection.js, `readSpokenPositions`).

Tests: `test_a_pass_for_a_change_to_the_rows_seats_them_as_a_whole_pass_would` gains
steps where words above the rows grow, words come into a pin's seat and leave it, and
words above a pin in one column carry it level with a button the other column holds;
the band, neighbour, new-neighbour and move checks each fail it when switched off. The
shiftedPin unit test covers the scroll and move split.

Co-Authored-By: Claude <[email protected]>
leaf-agent
leaf-agent previously approved these changes Nov 15, 2026
# Conflicts:
#	browser/runtime/annotation-overlay/margin-layout.js
@max-sixty
max-sixty merged commit 338b56b into main Nov 16, 2026
5 checks passed
@max-sixty
max-sixty deleted the perf-input-scaling branch November 16, 2026 04:18
max-sixty added a commit that referenced this pull request Nov 16, 2026
…he work, and wake the session for it (#6160)

The turn-end check now catches pages that have fallen behind the work,
and Leaf wakes the session so the agent can fix the page before the user
returns.

**What it names.** The check's `stale` finding is now a goal for the
whole page: anything on a page that no longer fits the work as it now
stands, wherever it is. That covers words the work has since changed,
and finished or dropped work the page still presents as current. A title
and opening that still tell finished work as news remain one example.

**When the agent hears it.** A finding Leaf can't act on itself is now
queued with `wake`. The watch between turns then starts a turn for it
once the turn that left it closes, and a session no watch follows is
nudged, as a fork's to-do already is. An ask Leaf wrote and a fix it
made only tell the agent, as before.

On margin-open-cost, the session appended each new request's results at
the page's end. The title and opening kept describing #6071, merged
hours earlier, while "Which of these should I build?" sat last. The
check ran at 21:59 PT and named nothing. Even a finding would have
reached the agent only with the user's comment at 00:51.

Measured:
- Replays of three real turn ends whose page opened on finished work
while the next question waited below: this wording named the stale
opening in 4 of 7 runs. The explicit title-and-opening rule it replaces
named it 7 of 7; wordings with no example named it 0 of 6.
- At eight ordinary recent turn ends, it named no opening. The turn-end
suite passes, apart from `ask-follow-up`, whose judge splits on the same
ask wording on both arms.
- Since Nov 10, 121 checks named something only the agent could act on.
26 were heard within a minute, the median waited 5 minutes, 13 waited
more than an hour, and 3 were never heard. Each idle wait now becomes a
woken turn.
- The Claude Code journey passes every step, but its checks named
nothing, so it didn't exercise a wake.

To weigh: each woken turn spends the session's cached context; I
estimate $1–2 a turn. The goal wording also doesn't catch #6158's case,
true material about something since removed.

Requested by the user's `/diagnose-session` on that page; they approved
the wake. Reviewed by Codex. Checks: `tests/model/test_clerk.py`,
`tests/model/test_forks.py`, `tests/model/test_wait.py`, the turn-end
eval suite, the `claude-code` journey.

> _This was written by Claude Code on behalf of max-sixty_
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