Skip to content

Draw the floating panel's thread through ThreadView, as the margin card does - #5390

Merged
max-sixty merged 10 commits into
mainfrom
one-thread-view
Nov 4, 2026
Merged

max-sixty merged 10 commits into
mainfrom
one-thread-view

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

The margin card drew a thread with ThreadView, and the floating panel built its own from three parts the primary reader lent it (the transcript, the held-news notice and the reply box), with its own quote, ✓, to-dos and rewrite wiring around them. The two copies had drifted: the panel's ✓ lacked the card's "Resolved by " label and its key command. Now both surfaces hand the whole thread to ThreadView and say where its parts stand through one contract: the panel stands the notice and ✓ on its head line and the reply box in its field, and the card stands them on its row of presses. ThreadView no longer asks which surface it is on. Each surface keeps its own placement, the edge it holds still, its scroller, its navigation and Close.

What the user sees change, all in the panel

  • A thread the agent resolved names the agent on ✓ ("✓ Resolved by Codex · Reopen"), and ✓ declares thread.resolve and thread.reopen, so Enter on it runs the command, as a card's does.
  • An agent's Resolve that arrives while the user reads the thread waits behind "1 new", as in a card: ✓, the notice and the field's words change together when the user shows the news. Before, ✓ and the field flipped at once beside a notice still saying "1 new". Pressing ✓ while it waits shows the news and sends nothing.
  • Fixed: Resolve on a thread opened from Threads went back to Threads, where the user chose that it moves on to the next open thread, whenever the thread's record had been replaced since the panel drew it, as after t then Enter on ✓ or after the user's own reply. The thread is found by key now; test_resolve_opens_the_next_thread_as_tall_as_it_holds gives its threads replies and fails on main.
  • Fixed, from Ask one question of whether the user sees a box, and land only what it says isn't shown #5361: the panel's open view counted as covering the thread it shows, so the panel stopped holding news at all. shownWindow now takes the node it reads for and leaves out the cover of the surface holding it, as coverBoxes already did. On main, test_held_news_reads_whole_among_the_thread_s_controls, test_on_a_phone_held_news_gives_way_before_close and test_threads_grow_in_place_and_hold_news_until_asked fail; here they pass.

Package API

parts.transcript and parts.news are gone; only the panel used them. parts.thread takes optional {head, reply, quote, landing, drawn}, documented in module-annotations.md, "Owning the primary conversation presentation". Every place a nomination names is checked and slotted as its outlet is, so a place outside the widget refuses the update and a place in its shadow tree takes its part through slots. The primary reader forwards only those options, so the card's own (CardOutlets) never reach a package's thread. A package's whole thread with quote: true draws the quote as the panel does; its rules moved from the chrome's scope to surfaces.css.

Where to look

  • browser/runtime/thread/thread-card.js: ThreadOutlets, CardOutlets and ViewOutlets; the boxes a thread draws apart; #settle, whose landing and reader each container states; #createReply, which hands the reply's words {resolved, attention} of the thread as drawn; #drawQuote.
  • browser/runtime/thread/primary-reader.js: one path for every place a nomination names (placesOf), placing each part before drawing it.
  • browser/runtime/floating-panel.js: the panel's outlets and landings; its quote, ✓, to-dos and settlement wiring are deleted.
  • browser/runtime/annotation-overlay/thread-preview.js and thread/inline.js: the card's and the seat's outlets.
  • browser/runtime/geometry.js: the cover fix above.

Size

49 files, +1229 −893. Runtime JS is about +28 lines of code and +116 of comments: floating-panel.js −81, thread-card.js +227. What this buys is one owner for each part of a thread, not fewer lines.

Checks

  • Firefox stills of 45 card, seat and panel states show 0 px change; Chromium's retained-quote and retained-quote-full are unchanged. An independent review of each commit's code and the held-Resolve captures found nothing left to fix.
  • pnpm run check:browser and pnpm run test:runtime pass, as do the focused browser tests for panel threads, held news, Resolve, Reopen, Undo, quotes, seats and package threads.
  • test_a_resolve_s_notice_stands_for_that_resolve_alone now expects the notice's Undo to take back a Resolve the agent picked up at once, the rule Let z take back a sent message or reaction, whatever the agent has done with it #5320 set; main never reaches that step, since it stops at the Resolve bug fixed here.
  • Inherited, failing on main too: tests/browser/test_render_outbox.py::test_z_takes_back_the_thread_the_user_just_resolved (main's push runs, ci failing on main (push) #3985), tests/journeys/test_render_anchors.py::test_a_data_bound_diff_aims_and_selects_one_source_line (a comment's anchor now carries prefix and suffix; it fails at that assertion on main, before the lines this branch changes) and tests/browser/drafts/test_reply_sessions.py [margin-accepted].

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

The panel drew a thread from parts of it: the primary reader's transcript,
news and reply parts, with its own quote, to-dos and Resolve around them, so
the panel and a card kept two copies of a thread's shell. The panel now
nominates the whole thread (`parts.thread`) and says where the parts it
draws apart stand (`ThreadOutlets`): the notice and Resolve on its view's
head line, the reply box in the row's field, the quote over the messages,
and where Resolve takes the user. ThreadView draws each of them there, so a
card and the panel share one notice, one Resolve, one reply box and one
rewrite owner. The panel keeps what makes it the panel: its head line and
way back, Next unread, Show on page and Close, its height holds, the New
reply foot (`fitAnswer`, through the thread's `drawn(answer)`), and its
landings after Resolve and Reopen.

Deleted: `parts.transcript` and `parts.news` and their parts, the panel's
`quoteHead`, its to-dos, its Resolve and its settlement wiring, and the
transcript's head-notice option nothing else used.

What changes for the user, all in the panel's Resolve, which is now
ThreadView's:
- Where the agent resolved the thread, its name and tooltip say
  "✓ Resolved by <agent> · Reopen", as a card's do.
- It declares `thread.resolve` and `thread.reopen`, so Enter on it runs the
  command; the press still holds the view's height, now from the
  settlement's landing rather than the head line's click.
- It draws from the thread's held reading: a settlement the panel holds as
  news leaves Resolve as it stood until the user shows the news, as a card
  does, where it flipped to Reopen at once.

Nothing else moves: stills of every panel thread state and every margin
card and seat state in Firefox show no pixel change; the to-dos keep the
inset they had outside the thread.

Tests: the panel's Resolve is `.lf-fp-thread-controls :is(.lf-resolve,
.lf-reopen)` and its quote `.lf-thread-quote`; the resolved-by-agent and
held-settlement expectations follow the change above; the test of a
package's transcript notice goes with the transcript part.
…imary parts in place

The panel takes the card's rule for a thread holding news. Its Resolve already
drew the thread as ThreadView draws it, held news included, while the field's
words read the thread as it stood: an agent's resolve the panel held left
Resolve unchanged and the notice saying "1 new" beside a field saying "Reply to
reopen". ThreadView now hands the reading it draws to the reply box's word
callbacks (`ThreadReplyOptions`), read as a signal, so the box draws its words
again with each reading; the panel's `whereTo` and `turnLead` take it, and
Resolve, the notice and the field change together when the user shows the
news. The card's own hint reads the same signal, which replaces the sync it
made when its settlement flipped. The decision is recorded beside the panel's
held-news notice (floating-panel.js), dated 4 November.

The primary reader drew each part before placing it in the outlet its
nomination named. A package that hands a new outlet on each render, as the
test's reader does, left a whole thread drawn out of the document: it read no
room for its held notice beside its first message's head, so the notice stood
at the head's start and moved 159px into place a frame later, which the shift
watch fails. This happened on main too. The reader now places every part, then
draws each where it stands; the panel, whose outlet stands still, is
unaffected.

Tests: `test_news_in_an_open_thread_moves_none_of_its_controls` asserts the
field's words and the turn's word agree with Resolve while the news is held and
after it shows; `test_a_package_s_whole_thread_takes_its_notice_where_a_card_does`
returns as the regression test for the notice's move.
…y box, and keep the quote's face

Review of the first two commits found six things; this fixes them.

- A thread drawn apart (`ThreadOutlets`) rendered its notice, Resolve and
  reply box straight into the places its container named. The primary reader
  checked and slotted only the outlet, so a place outside the widget did not
  refuse the update, and in a widget whose places stand in its shadow tree,
  as the gallery workspace's do, those parts stood where the document's
  stylesheets don't reach. ThreadView now draws each part apart in a box of
  its own (`apart`, laid out as what it holds), and the reader places every
  box it is handed through one path, `placesOf`: the same check, the same
  slots and the same removal as the thread's own box.
- With `head` or `reply` and no `settles`, Reopen looked for focus and the
  reply box only inside the thread's own box, so it never landed in a reply
  standing apart. ThreadView's landing now reads focus across every box it
  draws and lands in its own reply box wherever it stands. That makes the
  panel's `reopenLanding` a copy of it, so it goes. `settles: {landing,
  reader}` becomes `landing(resolved)`, which may return null to leave the
  user to the thread, and a container with a landing is the reader the way
  back reopens the thread in, so `reader` goes too.
- Fixed: Resolve on a thread opened from Threads went back to Threads where
  the 3 November rule says it moves on to the next thread, whenever the
  reading had replaced the thread's record since the panel last drew, as
  reading its reply does, after `t` then Enter on ✓, or after the user's own
  send: `openThreads().indexOf(thread)` missed it. The first commit finds it
  by key. `test_resolve_opens_the_next_thread_as_tall_as_it_holds` now gives
  each thread a reply, and fails on main.
- Full quote drew in the thread's face (14px) inside ThreadView's box, where
  it drew in the quote's (13px) in the panel, so the view grew by a pixel or two. The
  quote's rules move beside `.lf-quote` in chrome.css, in its face, with the
  thread's text inset in place of the panel's, and apply wherever a thread
  draws its quote.
- A thread the agent resolved names the agent before Reopen, so
  `test_reply_sessions`' `expect_resolved` expects a name ending in Reopen.
- module-annotations.md lists `parts.thread`'s options one by one, says
  `landing` gets the state before the press, that every place is held as an
  outlet is, and that a whole thread takes the reply being written in it.

Tests: `test_a_package_s_places_for_a_thread_s_parts_take_them_as_its_outlet_does`
covers the first two: a place outside the widget refuses the update, places
in a shadow tree take their parts through slots, and Reopen lands in the
reply box there; it failed on the second commit on all three.
…ly words a small reading

A second review found two things left.

- `quote: true` drew a quote only in the floating panel. Its rules, and the
  `.lf-quote` face they build on, stood in chrome.css inside
  `@scope (.lf-chrome)`, so a package's whole thread in the page drew its
  quote with no face, no three-line clamp and no Full quote. The quote's face
  (`.lf-quote`, its label and status) and the thread quote's rules move to
  surfaces.css, where every surface's thread rules are, and the chrome keeps
  only its own rule that leaves a quote selectable. The chrome's guard rolls
  its elements back to these layered faces, so the panel and the comment box
  draw their quotes as before. Full quote was fitted a frame after the quote
  painted, so in a reader drawing the thread without a gesture its arrival
  moved what stood below it, which the shift watch caught in the package
  test; it is now fitted as the quote first paints, and the panel's opening
  shows it from its first frame too. The
  `retained-quote-full` still clicked Full quote as soon as it showed, which
  now comes before the view has finished arriving and the reply has been
  read, so the expanded quote pushed the reply out of view unread and offered
  Next unread; the state waits for the reply to be read first, as a reader
  would.
- The reply box's word callbacks were handed ThreadView's internal model,
  and the reference said `reply.options` takes the options `parts.reply`
  documents. They now get `{resolved, attention}` of the thread as drawn
  (`DrawnThread`), the reference names only `hint` and what it gets, and the
  panel reads the open thread's id for a walk's position from the live
  thread, since an id is never held.

Tests: `test_a_package_s_places_for_a_thread_s_parts_take_them_as_its_outlet_does`
asks for the quote of a thread whose words are gone, and checks it clamps to
three lines and opens whole on Full quote; on the third commit its clamp read
`none`.
…does

The margin card handed ThreadView its presses and hooks as MarginControls, and
ThreadView chose the card's notice and Resolve placement, its landing and its send
hook by asking whether the reading's surface was "margin". The card now gives the
same ThreadOutlets the floating panel gives: `head` places for the notice and the
settlement on its own row of presses, which it builds and gives as `head.line`
since that row stands in the thread and shares the heads' grid track; `landing`
for where Resolve takes the user; `reply.options.sending` for the send it
presents; and `anchor`, its CardAnchor. The seat places the thread's apart boxes
before drawing it, through the same `apartPlaces` the primary reader uses.

ThreadView's placement is now a question of which outlets it was given: a head
line inside it, a head line outside it, or none, where the notice stands beside the
first message's head. Two branches stay because they are the card's own job, not
placement: `anchor` decides when news may grow the floating card, keeps a send's
foot and skips scrolling a landing into view; and `surface === "margin"` still
names the page as the reader a way back reopens the thread in. `surface` stays in
the reading, since read tracking reports it and it sets a margin message's
authored rank. The card declares its own scrolling transcript as an append region,
so Transcript loses its `appends` option. `reply.outlet` is optional: without it
the box stays at the thread's end with the container's options.

The three ways of fitting the notice stay: the card's fit reads every shown head
while only the ones beside its row keep to the shared track, so grid tracks would
change the notice's width as the user scrolls; the page thread's holds measured
widths while news waits; the panel's line is plain flex. Its header now says why.

No visible change: Firefox stills of 42 card, seat and panel thread states, and four
under touch, are 0 px against c77e4f7, as are Chromium's retained-quote states.
…ets off packages

The reader a way back reopens a thread in is now a fact the container states
(`ViewOutlets`, `reader`) rather than one ThreadView inferred from the surface and
from a landing: the margin card passes "page", and the primary reader passes
"primary" for a whole thread whose nomination lands the user elsewhere, the rule
module-annotations.md already gives packages. ThreadView now decides nothing by
the reading's surface; read tracking and the authored rank keep it.

The card's own fields move to `CardOutlets`, and the primary reader forwards to
ThreadView only what a package may pass (`head: {news, controls}`, `reply`,
`quote`, `landing`), so a package's `head.line` no longer moves its element into
the thread. The card's `line` is now a function of the thread's apart boxes: the
card arranges its row around them as the thread paints, before the notice and the
settlement are drawn, so the place spans, their `display: contents` rule and the
seat's placing loop go, and `apartPlaces` folds back into the primary reader.

No visible change: Firefox stills of the card, seat and panel states are 0 px
against c77e4f7.
Conflicts, resolved:
- Thread to-dos: main took a thread's to-dos and their Done away (#5331), and this
  branch had moved them into ThreadView. They go from ThreadView, its commands and
  surfaces.css, with the panel's inset rule for them; the quote stays.
- The panel's ✓: main gave its own Resolve button a disc and a tone (#5329); the
  panel's ✓ is ThreadView's on this branch, which already has them.
- floating-panel.css: main renamed the reply's outlet to `.lf-fp-reply-outlet` and
  dropped the Threads row's mark wash; this branch dropped the panel's quote rules
  and the reply part's wrapper. Both removals stand.
- Tests: main's new held-news test and rewritten `z` reply test stand beside this
  branch's renamed drawn-commit test and selectors.

`test_a_resolve_s_notice_stands_for_that_resolve_alone` expected the notice's Undo
to show a gesture the agent had picked up before taking it back, the rule #5320
removed; main never reached that step, since its Resolve went back to Threads
there (fixed on this branch). It now expects the press to take the Resolve back.
#5361 made the panel declare one box it covers, its row and any view open above it,
and `shownWindow` takes every declared cover from the room it reads. `motionBand`
reads that room for a node to decide whether its growth would be seen, and for a
node inside the panel's own view the room came out empty, since the view covered
itself. So news in the open thread never counted as moving what the user reads, and
the panel stopped holding it: on main, `test_held_news_reads_whole_among_the_thread_s_controls`,
`test_on_a_phone_held_news_gives_way_before_close` and
`test_threads_grow_in_place_and_hold_news_until_asked` fail, and on this branch so
does `test_news_in_an_open_thread_moves_none_of_its_controls`.

`coverBoxes` already leaves a surface's own box out for a node it holds; `shownWindow`
now takes the node it reads for (`item`) and passes it on, and `motionBand` gives it.
All four tests pass.
leaf-agent
leaf-agent previously approved these changes Nov 4, 2026
…ed-resolve test

A thread the agent resolved names the agent before Reopen on the panel's ✓, as a
card's does, so test_failed_resolve_candidate_restores_focused_reply expects a name
ending in "Resolved by <agent> · Reopen".
@max-sixty
max-sixty merged commit f140fc2 into main Nov 4, 2026
3 of 4 checks passed
@max-sixty
max-sixty deleted the one-thread-view branch November 4, 2026 19:43
max-sixty added a commit that referenced this pull request Nov 5, 2026
…lick opens in the reply (#5410)

A margin card now behaves like the floating panel where the two differed
without a reason. This is step 2 of one thread view: #5390 had both draw
a thread through `ThreadView`, and this makes them act alike, on the
user's two picks from 4 November.

**Resolve in a card moves on.** At a passage with several threads the
card shows the thread after the one resolved, else the one before, and
stands the user on it, so the page doesn't move. A passage with one
thread closes the card, and Undo opens the thread again in the card.
`buildThreadCard` and `landing` in `thread-preview.js` own this. After a
step the card places itself as any new selection does, so a shorter
thread brings it back beside its passage; the user asked for that over a
hold of its own that would have kept ✓ under the pointer.

**A click opens a thread in its reply.** `openingPart` in
`thread/focus.js` holds the one rule: a click lands in the reply, and a
key or a finger lands on the thread, where keys act. It covers the
margin marker, the passage's mark, ‹ and ›, a Page Map row and Show on
page, and `destination.js` defaults to it. Enter on a row of Threads or
On me keeps the caret in the reply, as on main, because otherwise the
next words typed would run as commands (`r` resolves, `?` opens the
command list).

**A reply session begins only on the user's own act.** Typing, pressing
in the box, Tabbing into its row, or `c` or Enter on a thread begin one;
a caret left by an opening, a send or a pass begins nothing.
`CardAnchor` reads the session instead of keeping its own account of
writing, so an agent's Resolve still moves a card a click opened with
nothing typed.

**Next unread and New reply move from the panel into `ThreadView`**, so
both surfaces draw them from one place. A card names its transcript as
the box that scrolls the thread, and tells the thread each time a
placement lands. An answer past a capped card's foot now takes the
panel's rule: the user's turn stays in sight above it, with New reply at
the foot, where before the card's own scrolling hid the turn. That goes
further than the user's 31 October note on cards, and `card-anchor.js`
records that it was done to unify the two rather than picked.

Every card offers Next unread, as the user picked. It shows only while a
reply the opening left unread remains. Its words stand on a card with
one thread; beside ‹ 1/2 › it stands on its chevron alone, with the
words as its tooltip, and under a finger there it draws nothing, because
even the chevron left a head no room for the author's name.

## Testing

`pnpm run check:browser`, pre-commit and `pnpm run test:runtime` (810)
passed just before the last merge with main, as did the card's Resolve
and reply tests in Chromium (60), and the tests that open a thread (16)
pass after it. An earlier reviewer used the branch cold in Firefox by
click, key and touch, in two passes, the second finding nothing new; the
hold's removal since then is a small subtraction that I read myself and
checked with a Firefox probe of a Resolve.

Before the last merge with main, a focused selection failed only on
tests that also fail on a clean copy of main or passed on rerun.
`test_reopening_a_library_select_keeps_its_options_visible` fails on
main itself.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 8, 2026
…he next thread Resolve opens isn't a flicker (#5691)

Since #5390, Resolve in the floating panel's thread view moves on to the
next open thread, which is the behavior the user chose and #5390
restored. On `thread-panel-gallery` and `feature-gallery`, the next
thread puts a message's picture button (`.lf-picture`, `cursor:
zoom-in`) under the pointer while the Resolve is still travelling.
`press_each_control` compared only the face before the press with the
face while the gesture travelled, so it reported the panel moving on as
a flicker on Resolve.

The check now reads the face at the pointer a third time, after the
answer has landed, and reports a failure only when the face seen while
the gesture travelled is different from both the face before the press
and the face after the answer. A flicker, such as a busy cursor or a
disabled face for one round trip, is gone once the answer arrives, so it
is still caught. A face the press drew and the answer keeps is the
press's own result. A refused gesture puts the page back as it was, so
for those presses the check still holds the travelling face to the face
before the press.

Verification:
- On `02cd6bdff` (main),
`tests/journeys/test_pressed_controls.py::…[thread-panel-gallery]` fails
with the message in #5682. With this change,
`tests/journeys/test_pressed_controls.py` and
`tests/browser/widgets/test_pressed_controls.py` pass (48 tests).
- To confirm the check still catches a flicker, I temporarily injected
`cursor: wait` from the press until the answer landed. The journey then
failed on "Resolve thread" and on "✓ Resolved by Codex · Reopen".

Closes #5682 — 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