Skip to content

Draw news at once in the thread the user is in, and hold only threads already drawn on screen - #5392

Merged
max-sixty merged 8 commits into
mainfrom
agent-a5fc1359f5e38582f
Nov 4, 2026
Merged

max-sixty merged 8 commits into
mainfrom
agent-a5fc1359f5e38582f

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

News in a thread now follows the convention chat and document apps share: it draws at once in the thread you're in, waits behind "N new" in a thread on screen you're not in, and draws at once above and below the window, where the browser's scroll anchoring keeps what you read still. This is the second step of the cutover to one way of knowing what's on screen, after #5361.

What changes for the user

  • In the thread you're in (focus in it, its reply box included, or your send still in flight), the agent's news draws at once: a new turn, a step, an edit. The control you're on stays still: what stands above it scrolls up by the growth, as a chat does, and what stands below it moves. Where the page can't scroll by all of the growth, as on a page shorter than its window or a short tab at the page's foot, the control moves by the rest. Before, the answer waited behind "1 new" until you went to it.
  • A resolution or reopening the agent makes in the thread you're in still waits behind "1 new", as before, since showing it would move the thread between the open ones and the Resolved disclosure, out from under you. A reading that brings an answer and a resolution together waits whole.
  • A press into a thread holding news, such as into its reply box, shows the news with the pressed control held still. Before, a press showed nothing.
  • A thread the agent starts in a seat on screen, or on a bare diff line, draws at once and moves what follows it. Before, it waited behind a notice.
  • A reply that reopens a resolved thread draws at once and moves what follows. Before, it waited behind a count in the Resolved summary.

A thread on screen you're not in still holds behind "N new". The margin's card, the floating panel's thread view and the Threads list keep their own rules.

How

inline.js owns the in-thread rule, since it owns holdBox: holdBox holds the thread's reply box when focus is on the thread itself, and a message when focus is on it. The seat passes the hold over a change in the thread you're in unless it carries a settlement.

Deleted: HeldArrivals with its surfaces.js wiring, the margin marker as a notice, HeldNews's hold of new threads, the Resolved summary's count, setSettlesAt, the notice's reopened state and NewsNotice.total. held-news.js goes from 1,128 to 844 lines.

Tests

Deleted, with the behavior each guarded, now dropped:

  • test_a_reopening_in_a_page_seat_waits_in_its_resolved_summary: an agent's reply reopening a resolved seat thread waited behind the Resolved summary's count.
  • test_a_reopening_in_a_folded_diff_thread_waits_in_its_summary: the same in a diff outlet's Resolved disclosure.
  • test_a_reopening_waits_where_the_reopened_thread_would_stand: a reopening waited while the place it would land in the seat was on screen.
  • test_a_thread_the_agent_starts_in_a_page_seat_waits_in_the_row_it_would_follow: a new seat thread waited in the previous thread's row or the first-message row.
  • test_a_thread_the_agent_starts_on_a_bare_diff_line_waits_at_its_margin_marker: a new thread at a datum with no seat waited at its margin marker.
  • test_a_walk_to_a_thread_a_diff_line_holds_lands_in_its_outlet: a walk to such a held thread showed it in its outlet.
  • The helpers only those used: _seat_comment, _agent_turn, _to_upper_third, ROUTE_LINE.

Rewritten:

  • test_an_agent_turn_arriving_holds_still_the_page_box_being_typed_in: guarded the turn waiting behind "1 new" with the box still; now the turn draws and the box stays, with a Firefox case.
  • test_a_reply_held_in_a_diff_thread_is_read_once_the_keyboard_opens_it, now test_a_reply_in_a_diff_thread_draws_where_the_user_is_and_waits_elsewhere: guarded a reply waiting in the thread the user had just written in, and a press into its box leaving it waiting; now that reply draws with the box still, and a second one, after the user leaves the thread, waits and shows by its notice or t, read once shown.
  • test_replies_held_in_a_page_seat_show_when_the_user_turns_to_them[onto]: guarded "t onto the thread already stood on is a stay, and the replies wait"; now a user standing on the thread sees them at once. Firefox cases for "opened" and "onto".
  • test_a_new_step_waits_where_its_words_would_move_the_draft, now test_a_new_step_shows_at_once_in_the_thread_being_written_in: guarded a progress step waiting where it would move the draft; now the step draws at once, and on a page that scrolls the draft stays (shift-watched), while on a short page it moves down by the step.
  • test_held_news_says_one_count_of_all_it_holds: the user reads beside the thread rather than drafting in it, since news no longer waits in their own thread.
  • The hub-seat-held-news stills state reads beside the thread rather than drafting in it.
  • test_progress_the_user_spoke_after_keeps_its_steps_and_its_place: a rewrite of a step the user spoke after waited behind the thread's notice ("1 message edited") while they stood on its toggle. Now the rewrite draws at once, the steps stay shown or hidden as the user left them, the toggle stays where it stood, and the user's message moves by the run's growth alone, less what the page scrolled away above the toggle. Its shift watch goes, since that move is the rule's result; the positions are asserted instead.
  • test_opening_a_rewrite_keeps_room_the_thread_holds: an edit shortening a message above the reply box the user had clicked into waited behind "1 new" until they pressed it. Now it draws at once; the room the thread holds, and a rewrite opened in it, still move nothing.
  • test_a_summary_folds_its_messages_where_they_stand: an edit retracting a summary waited behind the notice while the user stood on the summary's toggle. Now it draws at once, and the frame the summary moved still keeps the document it loaded.

New: test_an_agent_resolving_the_thread_the_user_is_on_waits_behind_its_notice, the agent resolving the seat thread the user stands on with no draft: the thread stays open and focused with "1 new", and pressing the notice shows the resolution.

Size

Runtime code −439 lines net (+200 −639), tests −574 (+223 −797), CSS −9.

Measured

On command-hub's #goal-parser thread at 1440×900, in Chromium and Firefox:

Case main this branch
Reply box focused answer waits behind "1 new" answer drawn; box moves 0px
Reading below the thread waits; read line moves 0px waits; read line moves 0px
Thread above the window drawn; read line moves 0px drawn; read line moves 0px

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

… already drawn on screen

News in a thread in the page's flow now follows the standard rule: it draws at once in
the thread the user is in, waits behind "N new" in a thread on screen they're not in,
and draws at once above and below the window. A thread not drawn yet draws at once and
moves what follows it, as the user chose on 4 November.

What changes for the user, against main:

- News arriving in a seat or outlet thread the user is in (focus in it, its reply box
  included, or a send of theirs still in flight) draws at once. The control they are on
  stays still and the page scrolls what stands above it up by the growth, as a chat
  does. Standing on the thread itself, as a send leaves them, its reply box stays still;
  standing on a message inside it, that message stays and the reply box below moves
  down by the turn. Before, the news waited behind "1 new" until they went to it.
- On a page shorter than its window, which has no scroll to give, news in the user's
  thread still waits as in any thread on screen; drawn at once, a progress step moved
  the draft 42px down such a page.
- A press into a thread holding news, such as into its reply box, shows the news, the
  pressed control held still. Before, a press showed nothing.
- A thread the agent starts in a seat on screen, or at a widget's datum with no seat
  yet, such as a bare diff line, draws at once and moves what follows it. Before, it
  waited behind a notice in the row it would follow, in place of the seat's
  first-message row, or at its margin marker.
- A reply that reopens a resolved thread out of a seat's closed Resolved disclosure
  draws at once and moves what follows it. Before, it waited behind a count in the
  Resolved summary ("Resolved · 1 · 2 new"). A held reopening's notice no longer stands
  in Reopen's place.

Unchanged: a thread on screen the user isn't in holds behind "N new"; the margin's
card, the floating panel's thread view and the Threads list keep their own rules.

How: inline.js owns the in-thread rule, since it owns holdBox, so a package's primary
reader keeps holding. holdBox holds the thread's reply box when focus is on the thread
itself, and reply-landing.js `scrollsAway` says whether a box scrolling the thread can
take the growth. Deleted: HeldArrivals with its surfaces.js wiring (heldOut,
revealHeld, the registration's drawn datums), the margin marker as its notice and the
inventory's keep for it; HeldNews's hold of new threads (seatNotice, showHeldThread,
the `row` option); the Resolved summary's count; setSettlesAt and newsMoves' landing
check; the notice's reopened state. held-news.js goes from 1,128 to 844 lines.

Tests deleted, with the behavior each guarded, now dropped:

- test_a_reopening_in_a_page_seat_waits_in_its_resolved_summary: an agent's reply
  reopening a resolved seat thread waited behind the Resolved summary's count.
- test_a_reopening_in_a_folded_diff_thread_waits_in_its_summary: the same in a diff
  outlet's Resolved disclosure.
- test_a_reopening_waits_where_the_reopened_thread_would_stand: a reopening waited while
  the place it would land in the seat was on screen.
- test_a_thread_the_agent_starts_in_a_page_seat_waits_in_the_row_it_would_follow: a new
  seat thread waited in the previous thread's row or the first-message row.
- test_a_thread_the_agent_starts_on_a_bare_diff_line_waits_at_its_margin_marker: a new
  thread at a datum with no seat waited at its margin marker.
- test_a_walk_to_a_thread_a_diff_line_holds_lands_in_its_outlet: a walk to such a held
  thread showed it in its outlet.
- The helpers only those used: _seat_comment, _agent_turn, _to_upper_third, ROUTE_LINE.

Tests rewritten:

- test_an_agent_turn_arriving_holds_still_the_page_box_being_typed_in: guarded the
  turn waiting behind "1 new" with the box still; now the turn draws and the box stays,
  with a Firefox case.
- test_a_reply_held_in_a_diff_thread_is_read_once_the_keyboard_opens_it, now
  test_a_reply_in_a_diff_thread_draws_where_the_user_is_and_waits_elsewhere: guarded a
  reply waiting in the thread the user had just written in, and a press into its box
  leaving it waiting; now that reply draws with the box still, and a second one, after
  the user leaves the thread, waits and shows by its notice or t, read once shown.
- test_replies_held_in_a_page_seat_show_when_the_user_turns_to_them[onto]: guarded "t
  onto the thread already stood on is a stay, and the replies wait"; now a user standing
  on the thread sees them at once. Firefox cases for "opened" and "onto".
- test_a_new_step_waits_where_its_words_would_move_the_draft, now
  test_a_new_step_in_the_thread_being_written_in_leaves_the_draft_where_it_stands:
  guarded a progress step waiting where it would move the draft; now on a page that
  scrolls the step draws and the draft stays, and on a short page it waits.
- test_held_news_says_one_count_of_all_it_holds: the user reads beside the thread rather
  than drafting in it, since news no longer waits in their own thread.
- test_a_thread_resolved_while_its_reply_is_written_keeps_the_user_on_it[diff-clear]:
  guarded the resolution waiting behind the notice while the user wrote; now it shows
  at once, the card staying among the open ones.
- The hub-seat-held-news stills state reads beside the thread rather than drafting in it.
…ed while they're in it open until they leave

Review of db58aee found two regressions:

- `scrollsAway` predicted whether a scroll could take the growth and misjudged real
  layouts: a short tabs panel or the parts grid at the page's foot leaves room the
  growth fills without extending the scroll, so the draft moved 153px where main held
  it, and 1px of overflow read as none. It goes. In the thread the user is in, news
  draws at once on every page; holdBox scrolls what it can and the control moves by the
  rest, as on a page shorter than its window.
- The agent resolving the seat thread the user stood on, with no draft, folded it into
  the closed Resolved disclosure and moved them to its summary, hiding an answer the
  agent settled the thread with. The keep that holds a resolved thread among the open
  ones while its reply is written now holds it while the user is anywhere in it, read
  through followingFocus so leaving draws the seat again and folds it. The user's own
  Resolve still folds it at once and lands them on the summary.

Also: NewsNotice.total had no consumer since the Resolved summary's count went, and two
comments described removed holds (destination.js's held widget arrivals, the notice's
header variant).

The user-visible changes of the branch against main, updated:

- News arriving in a seat or outlet thread the user is in (focus in it, its reply box
  included, or a send of theirs still in flight) draws at once. The control they are on
  stays still and the page scrolls what stands above it up by the growth, as a chat
  does; where the page can't scroll by all of it, as when it is shorter than its window,
  the control moves by the rest. Standing on the thread itself, as a send leaves them,
  its reply box stays still; standing on a message inside it, that message stays and
  the reply box below moves down. Before, the news waited behind "1 new".
- A thread the agent resolves while the user is in it shows the resolution at once and
  stays among the open ones, the user still on it, until they leave it; then it folds
  into the seat's Resolved disclosure. Before, it waited behind "1 new".
- A press into a thread holding news, such as into its reply box, shows the news, the
  pressed control held still. Before, a press showed nothing.
- A thread the agent starts in a seat on screen, or at a widget's datum with no seat
  yet, draws at once and moves what follows it. Before, it waited behind a notice in
  the row it would follow, in place of the seat's first-message row, or at its margin
  marker.
- A reply that reopens a resolved thread out of a seat's closed Resolved disclosure
  draws at once and moves what follows it. Before, it waited behind a count in the
  Resolved summary. A held reopening's notice no longer stands in Reopen's place.

Tests:

- test_a_new_step_in_the_thread_being_written_in_leaves_the_draft_where_it_stands, now
  test_a_new_step_shows_at_once_in_the_thread_being_written_in: its "short" case
  guarded the step waiting on a page that can't scroll; now the step shows there too
  and the draft moves down by it. Only the "scrolls" case is shift-watched.
- New, test_an_agent_resolving_the_thread_the_user_is_on_waits_until_they_leave: the
  agent resolving the seat thread the user stands on, with no draft, shows the
  resolution with the thread still open and focused, and folds it once they leave.
…on main

The keep 017297d generalized, holding a resolved seat thread open while the user stood
in it, had three faults of its own: a resolution released through HeldNews presents
the seat directly, so the followingFocus read ran untracked and the thread never folded
once the user left; gesturedOn counts any gesture, so choosing an option in the thread
folded it and moved focus to the Resolved summary; and the focus subscription re-ran
every seat's render on each focus move. It goes, and inline.js keeps main's rule: a
resolved thread stays among the open ones while its reply is being written.

Instead, news in the thread the user is in draws at once only when it adds to the
thread. Its resolving or reopening waits behind "1 new" as on main, with whatever
arrives with it, since a settlement moves the thread between the seat's open threads
and its Resolved disclosure, out from under the user: the seat's newsMoves passes the
hold over only a change whose `news.settled` is null.

The user-visible changes of the branch against main, updated:

- News adding to a seat or outlet thread the user is in (focus in it, its reply box
  included, or a send of theirs still in flight) draws at once: a reply, a step, a
  reaction, an edit. The page scrolls what stands above the control they are on up by
  the growth, as a chat does, and where the page can't scroll that far, as when it is
  shorter than its window, the control moves by the rest. Standing on the thread
  itself, as a send leaves them, its reply box is the control that stays; standing on a
  message inside it, that message stays and the reply box below moves down. Before, the
  news waited behind "1 new".
- A resolution or reopening of the thread the user is in waits behind "1 new" as
  before, and so does whatever arrives in the same reading with it.
- A press into a thread holding news, such as into its reply box, shows what it adds,
  the pressed control held still. Before, a press showed nothing.
- A thread the agent starts in a seat on screen, or at a widget's datum with no seat
  yet, draws at once and moves what follows it. Before, it waited behind a notice in
  the row it would follow, in place of the seat's first-message row, or at its margin
  marker.
- A reply that reopens a resolved thread out of a seat's closed Resolved disclosure
  draws at once and moves what follows it. Before, it waited behind a count in the
  Resolved summary. A held reopening's notice no longer stands in Reopen's place.

Tests:

- test_a_thread_resolved_while_its_reply_is_written_keeps_the_user_on_it is main's
  again: its diff-clear case asserts the resolution waits behind "1 new".
- test_an_agent_resolving_the_thread_the_user_is_on_waits_until_they_leave, now
  test_an_agent_resolving_the_thread_the_user_is_on_waits_behind_its_notice: the agent
  resolving the seat thread the user stands on, with no draft, leaves it open and
  focused with "1 new", and pressing the notice shows the resolution, folding the thread
  into Resolved.
leaf-agent
leaf-agent previously approved these changes Nov 4, 2026
# Conflicts:
#	browser/runtime/thread/inline.js
#	browser/runtime/thread/thread-card.js

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/browser/threads/test_agent_replies.py::test_progress_the_user_spoke_after_keeps_its_steps_and_its_place fails at this head. It also failed at d24eddc, before the merge, and it passes on main (f140fc2), so the new in-thread rule is what turns it red. The test presses "Show/Hide 2 progress messages", which leaves focus on that toggle inside the thread. The seat then treats the thread as the one the user is in, so the agent's rewrite of the step draws at once rather than waiting behind "1 new". Two failures result. The notice assertion fails (expect(notice).to_have_accessible_description("1 message edited")). The shift watcher also reports the user's own "And the camera?" message moving 42px with no input, because the step grows below the focused toggle and pushes the message down.

The PR's rule covers growth above the control the user is on, which it scrolls away. It doesn't cover this case: the user's control sits above the growth, and the user's latest message sits below it. That message is exactly what the test's docstring protects ("a rewrite of the step it shows waits behind the thread's notice where it would move the user's message below it"). Either this should still wait, which means narrowing the in-thread pass, or the move is intended. In that case the test should be rewritten like the others in the Tests list and the dropped behavior named there. Which way to go is a product call. As the PR stands, the suite is red.

…ts news to wait

Three browser tests pressed a control inside a seat thread, which puts the user in it,
and then expected the agent's news to wait behind the thread's notice. Under the
in-thread rule that news draws at once, the control the user is on staying still and
what stands below it moving, as the reply box below a focused message does. Each now
protects what still holds.

Tests rewritten, with the behavior each dropped:

- test_progress_the_user_spoke_after_keeps_its_steps_and_its_place: a rewrite of a step
  the user spoke after waited behind the thread's notice ("1 message edited") while
  they stood on its toggle. Now the rewrite draws at once, the steps stay shown or
  hidden as the user left them, the toggle stays where it stood, and the user's message
  moves by the run's growth alone, less what the page scrolled away above the toggle.
  Its shift watch goes, since that move is the rule's result; the positions are
  asserted instead. The opened run's case grows the step, which the page can scroll
  away, with the toggle clear of the floating panel at the window's foot, where it would
  be out of sight and held for nobody (user-place.js, `focusedInView`).
- test_opening_a_rewrite_keeps_room_the_thread_holds: an edit shortening a message
  above the reply box the user had clicked into waited behind "1 new" until they
  pressed it. Now it draws at once; the room the thread holds, and a rewrite opened in
  it, still move nothing.
- test_a_summary_folds_its_messages_where_they_stand: an edit retracting a summary
  waited behind the notice while the user stood on the summary's toggle. Now it draws
  at once, and the frame the summary moved still keeps the document it loaded.

Checked against main: test_required_page_failure_retains_composer_seat_focus_and_caret
and test_call_diff_source_paths_do_not_alias_durable_rename_coordinates fail on main's
runtime too.
@max-sixty
max-sixty merged commit 4ef9f29 into main Nov 4, 2026
4 checks passed
@max-sixty
max-sixty deleted the agent-a5fc1359f5e38582f branch November 4, 2026 20:40
max-sixty added a commit that referenced this pull request Nov 5, 2026
…lds (#5397)

Four renders took the reader's place away from the browser's scroll
anchoring: they replaced the node anchoring held, or turned anchoring
off where the reader reads. This fixes each at its render. `main`'s
place keeper (`placeKeeper`) and the seat's hold (`holdBox`) are
unchanged, and none of the fixes fights them. This is the first part of
the places step of the cutover to one way of knowing what's on screen,
after #5361 and #5392; the one hold that replaces those two (#5396)
follows, once a generated test of every case lands.

Pixels are `origin/main` → this branch, measured with `leaf-dev probe`
in Chromium and Firefox alike unless named.

## Message words keep their nodes through an edit

A message's words reconcile through `setRenderedChildren`
(`thread/messages.js`, `keptWords`), the matching a revision uses,
instead of a Lit `.innerHTML` binding. An edit keeps every node it
leaves alone and rewrites a changed paragraph's words in place. Neither
engine anchors again on a node that replaces its anchor, so the old
binding lost the place on every edit.

- Reply box focused and scrolled away, an edit from another tab grows
the first paragraph of a message above the window: the second paragraph
being read moved 126px → 0.
- With that first paragraph on screen it still moves 126px: anchoring
holds the paragraph that grows, and the growth is inside it. Only a hold
fixes that case.
- The seat's own holds are unchanged: reply box with an answer arriving
above it 0 → 0, Send focused as a reply appends 0 → 0. A margin card's
focused message under an edit stays at 378px, as on `main`.

The matching (`dom-children.js`) diffs each list of siblings, and a diff
costs the list's length times the edits between them, so an edit that
changed every paragraph of a message would cost the square of its
length. A new rule of the matching, `diffWork`, bounds that, and the
caller chooses it: message words call `setRenderedChildren(…, {bounded:
true})`, and a list whose diff would cost more than 2^18 is replaced, as
`.innerHTML` replaced it. Every other caller keeps `main`'s exact
matching, unbounded: authored revisions, whose nodes carry the user's
state (two fallbacks tried for them each gave the read paragraph's node
away in some revision `main` handles), and the Markdown file preview,
which already reconciled through `setRenderedChildren`. Completing a
Markdown reference definition turns a reference in every paragraph into
a link:

| Paragraphs | 250 | 500 | 1,000 | 2,000 |
|---|---|---|---|---|
| Chromium, `main` (`.innerHTML`) | 0.7ms | 1.2ms | 2.3ms | 8.8ms |
| Chromium, this branch | 4.1ms | 5.7ms | 9.4ms | 19.5ms |
| Firefox, `main` | 5ms | 11ms | 24ms | 57ms |
| Firefox, this branch | 10ms | 15ms | 32ms | 78ms |

Without the bound, Firefox took 959ms at 2,000 paragraphs. A selection
in a paragraph survives an edit elsewhere in the message, where `main`
drops it.

## A revision edits inside a pane

`lf-pane` declares `x-patch: members`, so a revision edits inside a pane
rather than replacing it whole; the module reads only which child is
which. A revision adding five paragraphs above a pane's window moved its
reader 0 → 0 with `main`'s landmark restore, and now the pane and its
body stay the nodes the reader had. For the user, a wheel in a pane
while a revision lands there is no longer cut short by the replacement.

## A sidebar track keeps its own anchoring

A sidebar page's track body no longer sets `overflow-anchor: none` on
its own scroller. The aside before the body keeps that property (#5383),
which keeps the page's anchoring off the track. A block growing 200px
above the line read in the track moved it 200px → 0. A revision adding a
verdict above it stays 0 → 0 with no frame out of place, so the landmark
restore and anchoring don't fight.

## The dial's glide no longer drags Firefox's anchoring

The dial's gliding blocks carry `overflow-anchor: none` in their
keyframes, so a block is no scroll anchor while it glides. Firefox
anchors on where a box is drawn, so anchoring on a gliding block
scrolled the page by its glide. With motion on, Skim then Read on the
detail example:

| | Chromium | Firefox |
|---|---|---|
| `main` | −0.2, −0.2px | 360.7, 347.9px |
| this branch | −0.2, −0.2px | −0.3, −0.1px |

The paragraph wrapped in an `em` lands at −0.3 and −0.1px in Firefox
too.

One sequence gets worse in Chromium. After a turn has glided, and before
any scroll, growth above the reading line, such as an image loading,
moves the paragraph read by the growth: 200px in the reviewer's probe, 0
on `main`. While the blocks glide Chromium anchors on something other
than them, and keeps that anchor after the glide until the next scroll.
Firefox moves in that sequence on `main` too. The trade is that rare
move in Chromium for the 360px Firefox move on every dial turn with
motion on; the stale anchor is the next fix.

## Tests

Each new browser test fails with its fix undone.

- New:
`test_an_edit_above_the_paragraph_read_keeps_it_where_anchoring_holds_it`
(both engines),
`test_growth_above_the_window_moves_nothing_read_in_a_sidebar_track`
(both engines),
`test_a_turn_that_glides_keeps_the_place_in_every_engine` (both engines;
Firefox's case fails without the keyframes), a runtime test that
`setRenderedChildren` keeps the nodes an edit leaves, and one that a
bounded rendered list of 2,000 paragraphs, every one rewritten, is
replaced (without the bound it fails, after 4.7s).
- Rewritten:
`test_revision_restoration_yields_to_input_while_a_diagram_loads[patch-wheel]`
read the pane's offset mid-glide and expected it back, which held only
while a revision replaced the pane. With the pane patched in place the
wheel carries on past that offset, as the user's wheel should. The test
now waits for the wheel to settle and checks that what it brought into
view stays where it stood; without `x-patch`, the 220px wheel never
takes the pane past 300px and the test times out.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent pushed a commit that referenced this pull request Nov 5, 2026
…place of placeKeeper and the seat's hold (#5396)

One Leaf hold now keeps the user's place where the browser's scroll
anchoring can't, replacing `placeKeeper` and the seat's `holdBox`. This
is the places step of the cutover to one way of knowing what's on
screen, after #5361, #5392 and the anchoring fixes in #5397. It passes
every case of the hold-still matrix (#5398) that `main` passes, in
Chromium and Firefox, and six that fail on `main`.

## The one hold

Scroll anchoring keeps the reader's place through re-renders and
revisions since #5397, but it holds the first box on screen, so it can't
keep three places still: a control under the user's hands below growth
on screen, the reading line when growth starts between anchoring's box
and the line, and a place the change hides. `user-place.js` holds those
once, after the change has drawn:

- `holdPlace(node, standIn)` reads where `node` (an element, or a range
over words) stands and returns the step that scrolls it, or what
`standIn(node)` names once the change hid or removed it, back there.
- `holdUserPlace()` takes it around a reading from outside the tab,
where `state-application.js` applies the reading, and keeps it once the
page shows it, whichever surfaces the reading redraws. Page Map takes it
around a widget's own contribution joining with no reading behind it. A
gesture's own result is never held; its handler places it.
- The place is, in order: a field the user types in; then the control
under a resting pointer (only a control a press acts on, `PRESSES`, and
nothing once a mouse has left the window) or the focused control,
whichever input came last; then, if focus is scrolled away, the words at
the reading line (`readingAt`, a range over the letter a quarter of the
way down the window). A thread the user sent from stands at its reply
box (`standsAt`).
- The keep puts back the first of these the change moved. A place the
change left still keeps its scroller, so a later place in it moves
nothing. It yields to what the user did since the reading: a scroll they
or a landing chose, one still under way, a press, or a key anywhere but
in the field it holds, so typing into that field leaves the place kept.
- The dial holds the block it folds, with the gist standing in for it.
Page Map's sheet is a reading region while it stands, so its list is the
scroller that keeps its row. The press-in-place correction in
`floating-panel.js` uses `holdPlace` for its arithmetic.

The revision landmark restore (`version.js`) stays as on `main`, and a
revision takes no hold, since the two undid each other by up to 82px.

## Measured

The matrix, `tests/journeys/test_page_holds_still.py`, 50 cells × 2
engines: `main` passes 80 and fails 20; this branch passes 86 and 14
stay expected failures. The six it fixes, both engines:

| Cell | `main` | this branch |
|---|---|---|
| Reading × edit growing the paragraph read | 84px | 0 |
| Reading × edit shrinking a message above | −42px | 0 |
| Diff gutter Comment × deletions above | 100px | 0 |

A new seat thread drawn above the place moves it by the thread on `main`
(153px, which the matrix allows); here it stays at 0. The cases
independent reviews found that a fixture can reach are new matrix cells,
each holding still on `main` and here: typing then a pointer parked on a
margin pin, on page background, or on a message's words; reading line 40
of an 80-line message whose start the agent grows or shrinks by five
lines; and a disclosure the user opens while `lf-diff` still waits on a
syntax grammar. Words between line breaks inside a widget's open shadow
tree hold still too, checked with a probe, since no bundled widget draws
them.

## Behavior changed

- A re-render that replaces the very element the reader reads can move
them by what grew above their line in it (the user's choice, 4
November). No keyed re-render hands the place to a node drawn under the
same identity.
- A presenter that paints a reading's change frames after it arrives, as
`lf-diff` does while it waits on a syntax grammar, shows the move until
the keep runs, and typing in that window ends the hold, since the caret
keeping itself in view is a chosen scroll (+75px after a letter, +86px
after an arrow key, measured with a presenter held back). The hold's
header records the limit.
- Two rarer paths move the reader where `main` holds them, left without
a rule of their own: growth above the reading line inside a closed
shadow tree, where the hold can only name the host (±150px measured; the
only bundled closed root is the text field's), and a press inside a
child frame while a presentation is pending, which the page's input
watch can't see (140px).
- In Firefox, an answer arriving during a smooth scroll or a wheel's
glide is yielded to, so the scroll finishes and the place moves by the
answer, where on `main` the hold's write stops the scroll short. In the
matrix's smooth scroll × reply above, the reply box ends −105px along
the scroll's −300 (the 195px answer pushed it back), against −40px on
`main`; the revision cell fails on both, by an amount that varies run to
run. Both stay expected failures. Playwright's Firefox wheel fires no
`scrollend`, so an answer straight after it counts as mid-scroll too;
the matrix waits that out.
- `widget-api.js` exports `holdPlace` and `readingAt` in place of
`placeKeeper`; `lf-dial` is the bundled consumer, and
`module-scroll-and-motion.md` describes them. `headerInset` is no longer
exported, and `offFlowSurfaceOf` is deleted.

## Tests

- **Deleted:** `placeKeeper`'s runtime tests in `user-place.test.mjs`,
which guarded its candidate order, clamp correction, nested keepers on
one scroller, the identity hand-off, the band-top rule and its anchoring
claim.
- **Rewritten:**
`test_an_edit_above_the_paragraph_read_keeps_it_where_anchoring_holds_it`
is now `..._holds_it_with_the_reply_box_scrolled_away`, which needs the
reading line.
- **New:**
`test_a_thread_joining_page_map_above_the_row_the_user_is_on_leaves_it_still`
(focus and resting-pointer aims); runtime tests for each rule of the
hold (growth anchoring left, a hidden node's stand-in, the first moved
place, a still place keeping its scroller, yielding to a scroll under
way, to a press and to a key at a control while typing into the held
field keeps it, a typed field before a resting pointer that names only a
control, a mouse leaving the window, until-found folds); the matrix
cells above, with the six fixed cells' expected-failure marks removed.
Each rule's test fails with the rule undone.

## Size

Runtime −141 lines net (+360 −501), `lf-dial.js` −20, tests +164, docs
+28.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty pushed a commit that referenced this pull request Nov 5, 2026
…own controls wear their keys (#5551)

Three of the seven tests #5486 tracks fail because #5361's single cover
box for the floating panel is read wrongly in two places, and one of
them also hides a test step #5392 made stale. This fixes those three;
the other four have separate mechanisms that are still being diagnosed
under #5486.

-
**`test_a_seat_send_at_the_window_foot_shows_the_thread_it_started[verdict]`.**
`seenRect` kept the larger part of a box above or below the panel's
cover, so the 14px strip between the panel card (842–886) and the
window's foot (900) counted as seen. After a verdict seat's send, its
reply box showed only that strip, so `returnToThread` skipped the
landing and left the sent message under the panel. A cover now takes
everything from itself to the window edge it stands nearer (`coverCut`).
`shownWindow` already used that rule, and now `uncovered` (behind
`seenRect`, `inFront` and paint cuts) uses it too.
-
**`test_required_page_failure_retains_composer_seat_focus_and_caret`.**
`covered` read an empty box as covered, because nothing is left of a box
with no height. The widget's empty seat `b` (720×0) was refused the
comment editor, although nothing stood over it. `covered` now asks
whether a cover cuts the box. The test's later step expected the thread
that loses its seat to wait behind "1 new" in the rail. #5392
deliberately replaced that hold with drawing the thread at once, so the
step now expects both threads drawn.
-
**`test_a_thread_obligations_done_press_keeps_its_keys_and_one_workflow`.**
Key badge placement kept every chip off every cover. Since #5361 the
panel's cover spans its open view, so the Done button inside the panel's
own thread view lost its key face. A chip now keeps off only the covers
over its own control (`coverBoxes(owner)`, which already leaves out a
surface for what it holds). Chips for page controls still keep off the
whole panel, as #5361 intended.

What the user sees: a message sent from a seat at the window's foot
lands clear of the panel, the comment editor takes an empty widget seat,
and controls in the panel's thread view show their digits again. #5361's
rule that what a panel view covers counts as unseen is unchanged.

**Verification.** Each of the three fails on `main` and passes on this
branch's head, rebased on `8bece180c`. `pnpm run test:runtime`,
`check:browser` and `test:browser` pass. `test_go_to.py`,
`test_key_surfaces.py`, `test_composing.py`, `test_reading_place.py` and
`test_render_floating_panel.py` show no new failures. The four failures
there also fail on unchanged `main`: three are in main's run
42074354782, and `test_sending_flashes_only_the_new_message[card]` fails
the same way locally on `main`.

<details><summary>The four #5486 tests this leaves</summary>

These still fail with this change, each with its original message:

-
`test_render_aim.py::test_a_pointed_comment_keeps_the_rows_still_owed[thread]`:
`t` now gates its start landing on `alreadyShown`, a nearest-landing
question. A section taller than the window that fills it counts as
shown, so `t` no longer lands the section's top. The old
`readableDestination` asked whether the whole destination stood in the
landing band.
-
`test_current_location.py::test_the_obligation_walk_keeps_its_place_when_a_version_lands`
-
`test_render_diff_controls.py::test_file_tree_lands_at_the_file_start_after_reading_down`
-
`test_render_controls.py::test_sample_host_view_changes_leave_its_scroll_and_keyboard_position`
(ResizeObserver error at teardown, still present after #5544)

</details>

Refs #5486 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 8, 2026
…the thread being typed in (#5692)

Three nightly journey cases have failed since #5392 because each still
expected the old hold of news in the thread the user is typing in. #5392
deliberately draws that news at once, as a chat does: the control the
user is on stays still while what stands above it scrolls up by the
growth, and on a page too short to scroll that far the control moves by
the rest (`browser/AGENTS.md`, "News moves what the reader reads only in
the thread they are in"). This PR changes only the tests. Each case
failed on main before the change and passes after it, run locally with
the journey tier.

- **`test_live_news_keeps_the_reading_draft_and_resting_target`**,
renamed
`test_live_news_keeps_the_reading_draft_in_the_thread_being_written_in`.
It expected the working indicator and a tall reply to wait behind "1
new", and the pointer resting on Resolve to stay over it. On main the
working indicator draws, so `.lf-thread-working` never reached a count
of 0. Now the test expects the working state and the reply to draw at
once. It checks that the editor, its words and selection, and the
reading line stay where they were through the working state, the reply
and a source revision, and that Resolve, which sits above the editor,
scrolls up by more than 100px. The pointer assertion and the notice
press are removed, because the rule now holds the editor still and not
what stands above it.
-
**`test_native_reply_edits_after_semantic_paint_keep_the_first_line[seat-delete-desktop]`**
and **`[seat-mirrored-composing-android]`**. The agent's reply now draws
above the seated box. On the short seat page the page can't scroll, so
the box moves down by 69–72px, and the shift watch reported that move at
teardown. The seat page now has room below, so the page scrolls by the
reply and the box stays still, which is what the test's later native
edits assume. All eight parametrized cases pass.

The fourth case the issue names, `[margin-delete-desktop]`, had a
separate cause and was already fixed by #5685.

Closes #5683 — automated triage

Co-authored-by: leaf-agent <[email protected]>
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