Skip to content

Hold a reopening and a new thread in an on-screen seat behind the row they would move - #1493

Merged
max-sixty merged 2 commits into
mainfrom
agent-ac559427b1778ee2b
Oct 1, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-ac559427b1778ee2b

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

#1473 held an agent's reply landing in a thread drawn in the page's flow, and left two
kinds of the same news drawn at once. An agent's reply to a resolved thread reopened
it in place: in a task's seat the new turn and the reply box pushed the page down 63px,
and a folded diff thread unfolded under the reader. A thread the agent started in a
task's seat landed above its box and pushed the page down 117px. Both are news moving
what the reader reads.

thread/held-news.js now owns every kind as one HeldNews per seat (inline.js's
ThreadSeat, for page seats and widget outlets). It reads each reading against the
one the seat drew, holds what is news while the place it would grow from is on
screen, and hands the seat the reading to draw, each thread carrying news that says
what waits behind it:

  • a thread's new turns: "N new replies" in its head row, as before;
  • a reopening: the thread stays drawn resolved, and "Reopened · 1 new reply" stands
    in Reopen's place and face, at the resolved row's height (a chip's face stood 6px
    shorter at a fine pointer). It is the thread's reopen control, so Enter and r on
    the thread open it. A folded outlet stays folded and its summary carries the label;
    opening the summary opens it;
  • a new thread: "1 new thread" in the head row of the seat's last thread, or, in a
    seat that draws no thread, in place of its first-message row at that row's measured
    height. The row has no room beside its box: a notice there moved Send and Send &
    pause 96px. A user standing in the box keeps it, and holdBox keeps it still.

What a seat holds shows when the user presses its notice (Tab and Enter, or a tap),
adds a turn of their own (a reply, or a thread they start in the seat, which shows
after the held ones), or scrolls the seat off screen. Holding moved from ThreadView
to the seat, so the view now only draws news; the settlement buttons declare their
keys when made, rather than through a DOM query that copied landing.js's.

A margin row is inserted, then placed by the layout's next pass, and in between it
painted at its fallback, off screen. The marker an arriving thread or a reopening
brings moved from there into the rail as a layout shift on Linux CI ((1006, 265)px).
theme.css keeps a row unseen until it has a posture, so it first appears where it
stands.

Behavior that moved: a thread settling no longer shows the replies it holds; they stay
behind the resolved row's notice. The reading the seat draws before the log is read is
no baseline, so threads arriving with the log are not news.

Tests: three new browser tests in test_render_read_state.py cover the page-seat
reopening (tap and r), the folded diff reopening (keyboard), and the new thread in
both rows with the three ways it ends, plus the box the user stands in. News lands
past Chrome's recent-input window, so the shift watch checks the hold moved nothing.

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

🤖 Generated with Claude Code

… they would move

#1473 held an agent's reply landing in a thread drawn in the page's flow, and left two
kinds of the same news drawn at once. An agent's reply to a resolved thread reopened
it in place: in a task's seat the new turn and the reply box pushed the page down 63px,
and a folded diff thread unfolded under the reader. A thread the agent started in a
task's seat landed above its box and pushed the page down 117px. Both are news moving
what the reader reads.

`thread/held-news.js` now owns every kind as one `HeldNews` per seat (`inline.js`'s
`ThreadSeat`, for page seats and widget outlets). It reads each reading against the
one the seat drew, holds what is news while the place it would grow from is on
screen, and hands the seat the reading to draw, each thread carrying `news` that says
what waits behind it:

- a thread's new turns: "N new replies" in its head row, as before;
- a reopening: the thread stays drawn resolved, and "Reopened · 1 new reply" stands
  in Reopen's place and face, at the resolved row's height (a chip's face stood 6px
  shorter at a fine pointer). It is the thread's reopen control, so Enter and `r` on
  the thread open it. A folded outlet stays folded and its summary carries the label;
  opening the summary opens it;
- a new thread: "1 new thread" in the head row of the seat's last thread, or, in a
  seat that draws no thread, in place of its first-message row at that row's measured
  height. The row has no room beside its box: a notice there moved Send and Send &
  pause 96px. A user standing in the box keeps it, and `holdBox` keeps it still.

What a seat holds shows when the user presses its notice (Tab and Enter, or a tap),
adds a turn of their own (a reply, or a thread they start in the seat, which shows
after the held ones), or scrolls the seat off screen. Holding moved from `ThreadView`
to the seat, so the view now only draws `news`; the settlement buttons declare their
keys when made, rather than through a DOM query that copied `landing.js`'s.

Behavior that moved: a thread settling no longer shows the replies it holds; they stay
behind the resolved row's notice. The reading the seat draws before the log is read is
no baseline, so threads arriving with the log are not news.

Tests: three new browser tests in `test_render_read_state.py` cover the page-seat
reopening (tap and `r`), the folded diff reopening (keyboard), and the new thread in
both rows with the three ways it ends, plus the box the user stands in. News lands
past Chrome's recent-input window, so the shift watch checks the hold moved nothing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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.

The added browser cases still fail Leaf's stability gate. Running uv run pytest tests/test_render_read_state.py -q -n0 -k 'replies_held_in_a_page_seat or reopening_in_a_page_seat or reopening_in_a_folded_diff_thread or thread_the_agent_starts_in_a_page_seat' produced 11 passes and five teardown errors. Both page-seat reopening cases and three new-thread cases report a leaf-margin-cluster or .lf-margin-marker moving without input, by up to 265px. Their thread assertions pass, but these shifts contradict the PR's no-shift claim and the Stability contract in skills/leaf/assets/AGENTS.md. The marker placement during these arrivals needs to settle without an unprompted shift before this change is ready.

A margin row is inserted, then placed by the layout's next pass. In between it painted
at its fallback, off screen with no posture, and its move into the rail read as a
layout shift: an arriving marker's (1006, 265)px in the seat tests on Linux CI. Unseen
until it has a posture, it first appears where it stands.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit e89ab47 into main Oct 1, 2026
7 of 8 checks passed
@max-sixty
max-sixty deleted the agent-ac559427b1778ee2b branch October 1, 2026 04:30
max-sixty added a commit that referenced this pull request Oct 1, 2026
…rival as a known shift (#1495)

#1493 hid a margin row until the layout placed it, so an arriving
marker's move into the rail would not read as a layout shift on Linux.
The nightly run on its branch then failed two feature-gallery tests that
main's run before it passed:

-
`test_render_margin.py::test_the_feature_gallery_keeps_its_real_actions_reachable[700]`:
the margin's Undo for `bg-insert` stayed "not visible" for 30s.
-
`test_render_navigation.py::test_the_feature_gallery_keeps_a_choice_when_its_proposal_is_undone`.

On Linux's headless shell an unplaced row stands at the window's origin,
visible and pressable, and some rows stay there, so hiding unplaced rows
hid them. The margin projection also parks a row before placing it on
purpose, so its controls are in the tab order from their first render.

This removes the `theme.css` rule. The marker that an agent's new thread
or reopening brings into the two seat tests of
`test_render_read_state.py` is listed in `tests/known_shifts.py` as the
defect it is, matched to `lf-margin-` nodes only, so any other shift in
those tests still fails them.

Follow-up: place a margin row in the frame it is inserted. Today
`registerMarginRow` schedules the layout pass for the next frame
(`margin-layout.js`), so a row the projection inserts paints unplaced
first; placing it in the same frame removes the known-shift entry and
the stranded rows at the origin.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 1, 2026
…#1508)

The two feature-gallery nightly tests that flake on main show a real
defect: under CPU load, rejecting the gallery's suggested insertion can
leave its margin Undo hidden beside a passage that is on screen, and an
Undo can leave Accept and Reject hidden the same way. The tests stay as
they are, unmarked.

`notes/margin-stuck-style.md` records the investigation so far:

- the symptom: the passage's style stops updating (`getComputedStyle`
ignores inline writes on `span#bg-insert-line` until its parent's style
changes), so the layout's anchor name never applies and the row is
parked;
- the throttled 48-copy harness, its command and its numbers (stuck in
6–15 of 48 on main; the flake predates #1493, per a bisect on CI);
- what each switch ruled out, and the one lead (skipping the
suggestion's whole `#refreshMargin` after the click cleared it once);
- the static snapshot of the page, replaying the reject's DOM mutations,
which did not reproduce it;
- the next step: log every runtime call touching the suggestion between
the click and the first stuck probe, and cut it down to a page without
Leaf that sticks.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 9, 2026
…e page (#1784)

Typing in a floating comment box scrolled the page whenever the box
stood
under or over its passage and grew past the room shown on that side. On
every content change, `floating-response.js` asked `makeRoom` to scroll
the reading region until the whole box fit clear of the passage. A
stack-logged probe at 900x700 measured it. With the box over its passage
at mid-window, the first keystroke scrolled the page 162px. With the box
under a passage near the top, the page scrolled 55px once the box
reached
the window's foot. The user's rule is that the box moves and the page
stays.

The comment box's height may now reach the whole boundary on every side,
as it already could beside its passage, and growth never spends scroll
travel. It grows from the edge that holds it (#1890 holds a landed box
by
that edge). Once the window stops that edge, shift
slides it over its passage, and once it fills the window it scrolls its
own words. This is what a box beside its passage already did at the
window's foot. Only a thread card opening under or over its target still
scrolls to make room. The margin card's reply never scrolled the page
while typing; the same probe confirmed that at both widths.

Letting the box fill the window exposed a 2px mismatch at Send. The box
reserved 2px less beneath its words than the card's reply row takes, so
a
card capped at the window's height shrank its transcript and shifted the
sent words up 2px (`test_send_grows_thread_around_the_words` at
900x600).
One token, `--lf-comment-reply-row`, now sizes both.

Behavior changes the tests now protect:

- `test_typing_moves_the_comment_box_and_leaves_the_page_still` (new)
  types line by line into a box under and over its passage and checks
that the page never scrolls and the box stays in the window. Both cases
  fail on main.
- `test_a_growing_text_comment_keeps_its_side_and_the_page_still` (was
  `..._keeps_its_passage_clear_without_changing_sides`) and
  `test_a_text_comment_chooses_above_when_the_page_has_more_room_there`
asserted that typing scrolled the page and kept the passage clear. They
now assert that the page stays put, and that a later scroll carries the
  grown box with its passage.
-
`test_a_wheel_return_attaches_the_comment_box_in_the_first_visible_frame`
types a shorter draft. In its pane cases, typing used to scroll the pane
  to make room under the passage, and the test expected the box there.
- `test_where_a_comment_stands_before_and_after_send`'s phone case
  required the box to overlap its block only when the two couldn't show
  together, which only held while typing scrolled the page. It now
  requires a box that overlaps to stand at the window's edge.

The assets AGENTS.md "Stability" section now says a floating box grows
inside the window and never scrolls the page for its growth. A field in
flow, which cannot move apart from the page, still keeps its controls in
view.


## Add-on F: one shared reading of where the user works

The design review proposed one reading of the user's working point,
shared
by the card's held edge (`holding`, fed by `drafting` in
`margin-projection.js`), the place keeper (`recentPlaceInput` in
`user-place.js`) and typing growth. This change doesn't add it. I sorted
the place- and landing-hold repairs since 2026-09-23 by the question
each
answered:

- Which edge of the card stays still: #1429, #1536, #1552, #1574, #1587,
  #1771. #1552 and #1574 fixed how the hold was keyed across a second
  placement pass and across Send's admission, not which point the user
  works at.
- Which item in a scroller stays still: #1045, #1464, #1480, #1549,
#1694,
  #1715, #1735.
- What waits behind a notice: #1473, #1493, #1725, #1738, #1742.
- What a landing reveals on entering, sending or typing: #1303, #1364,
  #1571, #1602, #1624, #1626, #1645.
- Whether the box or the page moves as the box grows: #1453 and this
one.

None of these commits names a case where `drafting` and
`recentPlaceInput` disagreed, so a shared reading wouldn't have
prevented
them. The two readings also differ by design. `drafting` counts words
left
in the reply and a send still in flight, both of which outlast focus and
the pointer. The place keeper deliberately follows whichever of pointer
and focus came last. Their outputs differ in kind too: one is an edge of
a
floating surface, the other a node in a scroller's list. The typing
scroll
was a question of which thing moves, so it needed no working-point
reading.

One rule does repeat: a focused control counts as the user's place only
while it is on screen. `holdBox` (`reply-landing.js`), the place
keeper's
"begins in the band" filter, and #1735's resize landing each state it.
It
is a candidate for a shared predicate, but not the primitive F
described.

## Overlap with work in other worktrees

`leaf.shift-a-thread-jitter` has uncommitted changes to
`comment-placement.js`, `floating.js` and `floating-response.js`, based
on
#1705. Its `floating-response.js` hunk is small. Its
`comment-placement.js`
header rewrite overlaps the paragraph this change rewrites, so expect a
textual conflict there. `leaf.thread-card-margin-avoidance` is mid-merge
in
`comment-placement.js` and `margin-projection.js`. Neither touches
`makeRoom`'s call from `floating-response.js` or the frame tokens.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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