Skip to content

Let the user choose whether threads open beside their passages or in the panel - #6796

Merged
max-sixty merged 5 commits into
mainfrom
agent-a4523407b408e9c57
Nov 23, 2026
Merged

max-sixty merged 5 commits into
mainfrom
agent-a4523407b408e9c57

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

A thread about a passage can now be read beside the passage, as before and by default, or in the floating panel, and a card's Open in panel and the panel's Show on page switch between them. Until now each route picked a reader by the thread's kind, so a thread moved into the panel came back as a card on the next t. One setting, kept for the tab, now decides every route to a passage's thread: t, a press on the passage, Threads, On Me, a ?thread= link, Resolve's move to the next thread and Undo. The panel's reveal takes the thread or declines it by the setting, and the margin draws no card under the panel setting (thread/threads-in-panel.js).

  • Each switch raises a notice, "Threads open in the panel" or "Threads open beside their passages", whose p switches back and moves that thread back.
  • Under the panel setting, a route scrolls the passage into view above the panel, only as far as needed. landing-scroll.js judges what the panel covers by where its opening animation ends, and history adds a Back step only where the page moves.
  • Placements Leaf forces, such as a thread about the whole page, a resolved thread, a passage the page doesn't draw or a window too narrow for cards, put the thread in the panel without changing the setting.
  • Undo no longer records which reader a thread was settled in (settled.reader), since it reopens the thread by the route.

To weigh: a switch lands on the thread so its notice shows, unless the user was writing in the reply, where the caret stays. On a touchscreen the notice shows no press, following the rule from #6483 and #6687; a finger switches back with the thread's own button. The Back/Forward pull request, #6799, also changes anchor-travel.js and floating-panel.js, so whichever lands second will conflict there.

Max asked for this. A blind UX review shaped it: the page still scrolls under the panel setting, the notice offers the way back, forced placements leave the setting alone, and one setting decides every route. A fresh agent used it in Chromium and Firefox, and Codex reviewed it twice; their findings are fixed. Tests: tests/browser/threads/test_threads_in_panel.py is new, tests that opened a passage's thread in the panel from Threads now choose the panel first, and test:runtime and pnpm run check pass.

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

…the panel

Max asked for two places to read a thread about a passage, beside it on the page
(the default) and in the floating panel, switched by a card's Open in panel and the
panel's Show on page. Until now the route to a thread picked a reader by the
thread's kind, so a thread moved to the panel with Open in panel came back as a card
on the next `t`, and `t` threw a thread opened from Threads onto the page.

What the user sees now:

- A card's Open in panel moves its thread into the panel and opens the threads
  after it there too: `t` and Shift+t, a press on a passage's words, a row of
  Threads, On Me or the menu's search, the next thread a Resolve in the panel moves
  on to, a `?thread=` link, Page Map and Undo's return. The panel's Show on page puts
  the thread back in its card and later threads beside their passages again. Each
  switch says so in a notice ("Threads open in the panel", "Threads open beside their
  passages") offering `p`, which switches back, and each control's preview says the
  effect lasts "from now on". The choice lasts for the tab, across reloads.
- `p` on a thread presses whichever of the two it shows.
- A walk, a row or a link that opens a thread in the panel also scrolls its passage
  into view above the panel's view, only as far as needed, and not at all where the
  passage already shows. This holds on narrow windows and phones too, where every
  thread opens in the panel and the page used to stay where it was. A press on the
  passage's words leaves the page where it stands.
- Under the cards choice, a row of Threads, On Me's Reply and Discuss, a thread in
  the menu's search and Resolve's move to the next thread open a passage's thread in
  its card, or in the seat a widget draws it in, and put the list away; they used to
  open every thread in the panel.
- Placements Leaf forces change nothing: a thread about the whole page, a resolved
  thread, one whose passage the page doesn't draw, and every thread on a window too
  narrow for cards open in the panel whatever was chosen, and Show on page there
  goes to the passage without choosing cards. A widening window gives a thread back
  to its card only under the cards choice. Show on page no longer stands in a thread whose passage no longer resolves.
- Under the panel choice no card opens by itself as the user arrives at a commented
  target, as on a phone.

How it works: the floating panel's `reveal` takes a passage's thread at the first
ask under the panel choice and declines it under the cards choice, and the margin draws no card under the panel choice (`showPreview`), so its
marker press and arrivals fall through to the same route. The review's rule that `t`
from a thread in the panel stays there needs no code of its own: under the cards
choice only forced placements put a passage's thread in the panel. A route to the
page alone, as Show on page is, now asks the primary reader with `request.page`
once the page shows the thread, so the panel puts its view away under either choice;
module-annotations.md documents the field for a package's reader.

Removed: Undo's record of the reader a settlement was made in (`settled.reader`,
`ViewOutlets.reader`). Taking a settlement back opens the thread by the route, which
reads the choice; `foldThreads` already folds a pending undo, so the route reads the
thread open again.

Tests: `test_threads_in_panel.py` covers the two presses, `p`, the routes under the
panel choice, the passage landing, reload and a narrow window. Tests that opened a
passage's thread in the panel from a Threads row now choose the panel first
(`choose_threads_in_panel`), or use a thread about the whole page where the panel
wasn't their subject. `test_a_thread_walk_shows_one_thread_at_a_time` starts from
the thread about the whole page, since `t` from a passage's thread in the panel now
stays there; `test_a_reply_link_moves_the_thread_walk_to_its_destination` expects
the walk to go on in the panel after a panel thread; the collapsed diff's
superseded case reopens its thread from Threads into the seat its file draws, since
under the cards choice a row opens a seated thread in its seat; the Back test's
Show on page case scrolls away after opening, since opening the thread now brings
its passage into view; and `thread_head` in `test_render_anchors.py` opens a thread
by its route without travel, so reading a quote no longer loads a collapsed diff's
file.
…e switch's way back work

Follow-up to the choice of where threads open, from a Codex review and a cold UI
review of the branch.

- Taking back a settlement opens the thread by the thread route, which reads the
  user's choice. Before, Undo focused a thread's seat on the page whenever the user
  could see it, so with the panel chosen the panel kept showing the thread a Resolve
  had moved on to. A thread the user sees on the page is still opened without travel.
- A route into the panel brings the thread's passage into view by the travel a card
  takes (anchor-travel.js, `scrollToThread`), so a widget that isn't drawing the
  part a thread is on draws it first (`lfRevealDatum`), as a trace selects the
  checkpoint a thread is on. The panel's own copy of the passage landing is gone;
  `scrollToThread` takes a `block` so the panel's landing still moves the page only
  as far as the passage needs, and a `drawn` mode for a route that doesn't travel,
  which lands the passage only where the page already shows it, asking no widget to
  draw it and opening nothing.
- A press on a passage's words or its marker, with the panel chosen, brings the
  passage clear of the panel's view when the view opens over it, scrolling only as
  far as that takes. A freshly opened card may scroll to open clear of its target
  (browser/AGENTS.md), and this is the same rule for the panel. Two causes kept the
  press from scrolling: `alreadyShown` read the panel's cover where its opening
  motion stood rather than where it rests, and the band the panel states for
  landings waited for the box's next size delivery. A landing now judges the chrome's
  covers at rest, and the panel states its band as soon as it draws a thread a route
  opened there.
- Travel that moves no one to the passage of the thread the panel shows leaves the
  panel's view standing, so the passage landing can't put away the thread it was
  for.
- A click on Open in panel or Show on page lands on the thread, unless its reply
  holds words, which the move carries along so the user goes on writing. On the
  thread, the panel's field shows the switch's notice and its press back; with the
  caret in a reply, the field showed the reply's words instead, so only `p` ever
  showed the notice.
- The notice's press moves back the thread it was raised for, captured when the
  notice was raised, and makes the other choice. Before, it pressed the control of
  the thread holding focus, which a press on the notice had just taken away, so the
  card closed and nothing changed. Open in panel now opens the thread by the thread
  route too.
- `p` declares that it travels.

Unchanged, and why: the notice's press still shows only where its key would make it,
so never to a finger, which Max chose in #6687; a finger reaches the same result by
the thread's own Open in panel or Show on page. The margin still reads the choice
before it opens a card (`showPreview`): a card that opens by itself as the user
arrives at a commented target is no route to the thread, and routing it would open
the panel on every arrival.

Tests: four new cases in `test_threads_in_panel.py`, each failing before its fix:
Undo of a Resolve in the panel's view of a seated thread, a walk to a part a widget
isn't drawing, a click on either switch and its way back, and a press on words the
panel opens over. The module's earlier cases no longer press Escape after a click
on either switch, which now lands on the thread, and the Back test's Show on page case
expects the card's thread rather than its reply.
…p by its landing

From Codex's re-review of the reader choice.

- A thread moved between its card and the panel, by Open in panel, Show on page or
  `p`, opens where the user was in it: in its reply while they are writing there,
  which the move carries with its caret and selection, and otherwise on the thread.
  The rule is `openingPart`'s (thread/focus.js), beside where any opening puts the
  user, and replaces the panel's own `movedPart`, which landed in the reply whenever
  it held saved words. With words left in a reply, the first `p` put the caret in the
  reply and the second typed a "p" into it instead of moving the thread back.
- `scrollToThread` plans its departure by the landing it makes, at its `block`, so a
  route into the panel that brings a passage into view nearest adds a Back step only
  where the page moves. Reopening the thread on an element taller than the window
  while reading inside it added a Back step and moved nothing, since the plan judged
  "already there" by the element's start. Travel to a card lands at the centre and now
  plans by the centre too.

Checked and left: a selection made in a reply and parked with Escape comes back as a
caret at the end of the words when the reply is entered again, on main as on this
branch (thread/replies.js keeps the selection only through a live editing session).

Tests: `test_p_moves_a_thread_whose_reply_holds_words_the_user_left` and
`test_reopening_a_thread_on_the_element_read_adds_no_back_step` fail before their
fixes; `test_a_move_while_writing_keeps_the_caret_in_the_reply` holds that a move
while writing keeps the caret and selection in the reply.
leaf-agent
leaf-agent previously approved these changes Nov 23, 2026
Three files conflicted. Each resolution keeps both sides' intent:

- browser/runtime/anchor-travel.js: main split `scrollToThread` into a wrapper
  that registers the travel (`travelTo`, which `travellingTo` reads) and
  `travelToThread(id, mayArrive, options)`, which draws the thread's part with
  `drawThread` and plans the departure with `awaitsDrawing`. This branch's
  `block` and `drawn` options now go to `travelToThread`, and both functions'
  option types name them. The `drawn` early return still runs before the plan
  and the drawing, so a route that doesn't travel asks no widget to draw a
  part. Its guard is now `(anchor.visual || anchor.datum) &&
  !targetElement(placement)`. Main stopped exempting a thread on earlier data
  from drawing, and dropping that exemption from the guard changes nothing,
  since an `outdated` placement is always an element placement. The
  departure plan keeps main's first argument (null where the part awaits
  drawing) and adds this branch's `there` judge at the landing's `block`.
  `plan` reads `there` only when it is given a destination, so travel to a
  part that awaits drawing still counts as moving the page. The arrival
  lands with `threadLanding(id, target, block)`.
- browser/runtime/floating-panel.js: this branch moved the band statement out
  of `followBox` into `stateBand`, which now carries main's rewritten comment.
  That comment no longer mentions the root's `scroll-padding-bottom`, which
  main removed. `clearFor` keeps this branch's `ownPassage` early return and
  main's `onMeHolds`, and both helpers stand beside it.
- browser/runtime/icon-paths.js: both actions stay, this branch's
  `open-in-panel` and main's `open-latest`.

> _This was written by Claude Code on behalf of max-sixty_
@max-sixty
max-sixty merged commit aa34b6b into main Nov 23, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-a4523407b408e9c57 branch November 23, 2026 20:07
max-sixty added a commit that referenced this pull request Nov 23, 2026
Main gained #6796, the user's choice of where threads about a passage open
(thread/threads-in-panel.js), which every route now follows. Three files
conflicted; the rest merged cleanly.

- browser/runtime/floating-panel.js: a Threads row, Resolve's move to the
  next thread and a card's Open in panel take main's route
  (`threadActions.open`), which follows the choice and takes the route's
  own departure. That left the panel's own departure (`departing`, `open`'s
  returned `landed`, `transition`'s and `focusView`'s `landed`) with no
  caller that committed it, so it goes, with the panel's
  `prepareNavigationStep` dependency. `open` keeps `travel` for a package's
  reader, so a send's thread still adds no Back step there.
- browser/runtime/undo.js: main's `returnToThread`, which opens the thread
  by the route and doesn't travel to one drawn in view, keeps this branch's
  `travel` and `history` options: a return the log's refusal began adds no
  Back step, and Undo travels only to a place out of view.
- browser/runtime/thread/folding.js: main dropped the settlement's reader;
  the refused settlement's return keeps `history: false`.

thread/destination.js merged cleanly but lost this branch's plan of the
route's departure on the primary's view: main plans it only through the
passage's landing (`scrollToThread`), so a thread about the whole page
opened from a Threads row or by Resolve's move on added no Back step
(`test_a_threads_row_and_resolve_s_move_on_are_back_steps` failed). A thread
with no passage now plans its departure on the view again.

#6796's `test_reopening_a_thread_on_the_element_read_adds_no_back_step`
asserted the step rule this branch replaced (a step only where the page
moves). Under this branch's rule a Threads row lands the user in a thread
they weren't in, a step, so the test, renamed
`..._moves_nothing`, still asserts the page doesn't move and now expects
the one step.

The history record keeps the `reader` of the view the user stood in, which
this branch had planned to drop once #6796 landed. The choice says where
routes open a thread from now on, not which view the user was in:
without the record, Back after Show on page no longer reopened the panel's
view the user had left, which main's
`test_back_reopens_the_thread_its_departure_put_away[Show on page]` asserts
and which failed. thread/address.js's header now says why.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 23, 2026
The merge of #6796 planned a thread route's departure on the floating
panel's view only for a thread about the whole page, and left a thread
with a passage to the passage's landing (`scrollToThread`) to plan and
commit it. A thread whose passage a revision removed has an anchor but no
passage to land on, so its route committed nothing: opened from a row of
Threads, or by Resolve's move to the next thread, it added no Back step
(Codex's review; history.length 2 where 3 is due).

The route now plans its departure on the view for every thread, the
passage's landing plans it again by whether the page moves, and the route
commits once the last landing it reached stands. A step commits once
(anchor-travel.js, `prepareNavigationStep`), so the landing's own commit
and the route's leave one entry.

`test_a_threads_row_and_resolve_s_move_on_are_back_steps` now also runs
on threads whose passage is gone.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 23, 2026
… its URL (#6799)

Following a link from a thread in the floating panel and then pressing
Back didn't reopen the thread. The cause was wider than that route:
history recorded the open thread view only where a route scrolled the
page, and the panel, thread cards, revisions and Undo each remembered a
thread their own way. An independent review of the Back/Forward design
proposed one place to return to; this is the first of its two pull
requests.

- **A Back step for every stop.** A route that travels adds an entry
where it moves the page or puts focus somewhere the user wasn't
(`anchor-travel.js`, `prepareNavigationStep`). So each `t` and `m` stop,
a followed link, a Threads row and Resolve's move to the next thread are
steps. Only a user's gesture adds one: a refusal's restoration, a
traversal's claim and a reload's arrival don't.
- **`?thread=<id>` names the thread an entry shows**
(`thread/address.js`). History writes it into every entry (`history.js`,
`nameThread`), renames the current entry as a thread view opens or
closes, and a traversal opens or puts away the named thread once the
page is placed. Escape renames the entry and never traverses. A reload,
or Forward into the page, reopens the thread with focus and without
moving the page. The thread opens where #6796's choice of where threads
open puts it, except that history keeps which view the user stood in, so
Back after Show on page returns to the panel's view they left.
- `notes/browser-support.md` corrects Firefox's account: stock Firefox
names Forward's destination, and drops focus as it applies a return,
which this puts back.

To weigh: the address bar now changes as threads open and close; every
`t` and `m` stop adds a step, even one already on screen ("one Back per
stop", #5232), and so does a Threads row that opens a thread the page
already shows, which #6796's test of that case now expects; Back from a
thread opened from Threads closes the panel, as Escape does, and a Back
to a place in the panel's Threads or On Me list, which #6778 reopens on
`main`, leaves the panel shut, until the second pull request records the
panel's view in entry state; a history write the browser refuses past
its rate limit isn't retried.

Max asked for this. Codex reviewed it four times, the merge with #6796
included, and a fresh agent used it in Chromium and Firefox; their
findings are fixed. Tests: new cases in `test_threads`,
`test_reading_place`, `test_obligation_walk`, `test_navigation` and
`test_tabs`; `test:runtime` and `pnpm run check` pass.
`test_render_floating_panel::test_an_open_view_covers_the_page_beneath_it`
fails on `main` too.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 23, 2026
…ad's card

`test_an_exact_workflow_reports_stale_work_beside_a_live_page_claim` ends by
pressing the comment's margin marker and reading the card that opens beside the
passage. Since #6796, `open_panel_thread` chooses the panel for threads about a
passage, so the press opened the thread in the panel and the card never came:
the test fails every time on main too, where #6796's own checks never ran it.
It now chooses cards again after closing the panel, as #6796 did in
`test_widget_actions.py`. No behavior changes.
max-sixty added a commit that referenced this pull request Nov 23, 2026
…ad's card

`test_an_exact_workflow_reports_stale_work_beside_a_live_page_claim` ends by
pressing the comment's margin marker and reading the card that opens beside the
passage. Since #6796, `open_panel_thread` chooses the panel for threads about a
passage, so the press opened the thread in the panel and the card never came:
the test fails every time on main too, where #6796's own checks never ran it.
It now chooses cards again after closing the panel, as #6796 did in
`test_widget_actions.py`. No behavior changes.
max-sixty added a commit that referenced this pull request Nov 23, 2026
…6710)

The served state named where work stands in thirteen enumerations: a
delivery stage, a failure condition and its operation, a to-do's state,
a plan step's, an obligation's status, a thread's attention, the page's
activity kind and seven counts. `waiting` meant the user's turn on the
page and the agent's in a thread. Every obligation record, every
update's delivery, every to-do, every plan step, each thread and the
page now say it in the same fields: `next_actor`, `state` (`waiting`,
`running`, `blocked`, `done`), the `reason` a state leaves out, and how
a done one ended (`outcome`). This answers the entry "Make tasks and
work in progress clear" in `notes/TODO.md`.

This is the first of two pull requests, split at Max's request. Here a
to-do keeps its own served list and takes the new fields; #5979, on top
of this one, makes a to-do an obligation record and deletes that list.

## Where to look

- `src/leaf/standing.py` is the contract: the vocabulary, which record
speaks for a place, and what a job that outlives a turn is (whatever
holds an item's start other than the turn that wrote it).
- `src/leaf/activity.py` is the one producer of `running` and `blocked`,
for each delivery, each update's record, each to-do and the page. The
page reads the agent's side of all of it beside `presence` (here, away,
gone, closed).
- `src/leaf/served_state/state.schema.json` loses `Stage`, `Attention`,
a workflow's `condition` and `at_work`, `Obligation.status`,
`Activity.kind` and a plan step's `owner`, and gains `WorkState`,
`WorkReason` and `Outcome`.
- In the browser, `thread/workflow.js` words every standing and
`activity-words.js` the page's.

## A thread the user resolves

Two rules, both from a week of Max's own use: on the 13 pages he used
that week, 63 threads were resolved over a message the agent had not
answered, 50 of them within four seconds of sending. By my reading 39
ask for work or an answer and 24 close the exchange.

- The request stays owed (`events.owed_turns`). The user's resolve takes
a thread off their list and settles nothing the agent owes in it: the
message keeps its record and its place on the agent's list and holds the
Stop hook. The agent's own resolve still answers for a thread. This
stands beside #6106, under which either side's resolve ends the
questions the agent asked there.
- The thread stays closed until someone reopens it (`thread.post_reply`,
a reply's `unannounced`). What the agent says in a thread the user
resolved goes into it without reopening it, the status line announces
none of it (`announces` in `thread/model.js`, which `isNews` reads too),
and the reply's record says so (`stays-closed`), since the user's
resolve reaches the agent only where it retires a question the agent
asked. `leaf thread reopen` is the agent's choice to bring the thread
back, with the `unresolve` event the user's Reopen writes. `threads.md`
gives the goal and no rule: the user closed the thread, so it returns
only for news they would want to stop and read, such as that the agent
could not do what they asked. A question to the user there reopens it by
itself. A Codex turn's final message prints its agent nothing, so the
turn's handling has it post such news by command. Max picked both
halves: the answer leaves the thread closed, and bringing it back is the
agent's call (root `AGENTS.md`, "Leaf's role").

What follows: when this lands, each session still holding a page is
asked to answer the old messages its user resolved this way, among them
`/gpk` and `/dispatch` commands. A logged user `resolve` takes a new
meaning, a `reply` gains a field and an `unresolve` may be the agent's,
so the page protocol moves from 53 to 54; the plan-outline work in #6707
also takes 54, so whichever lands second moves to 55.

## What users see differently

The research note's scenarios S1–S15, built as real logs with 62
checkpoints, ran on `main` and here; their builders have left the tree
since and are at d986f9c. The words on every surface are identical at
40. At 11 the live words change: the 5 where the panel and the thread
contradict each other about the same work, an update the agent started
whose turn then ended with nothing watching (the panel now asks for a
nudge), a dialog open in the agent's own window (the thread says Waiting
in the terminal), and the 4 where the user resolved a thread before the
agent answered. At 11 only the Done list changes: at 10 a request
answered with a promise no longer reads Answered while its to-do is
open, and at 1 the request the user resolved is listed as Answered once
the agent answers it in the closed thread. A to-do whose start stopped
or went quiet keeps the line it last said under Stopped or Gone quiet,
and the receipt word Up next is gone.

## A preview fix that rides along

A pointer moved onto a control whose face redraws within the preview's
200 ms dwell got no preview until it left and came back: the
`pointerover` the browser sends for the new node under the resting
pointer cancelled the dwell, whatever had arrived (`preview.js`). The
dwell now ends only when another target arrives under the pointer, or
the pointer carries a press. This pull request's `test` job met it in
the feature gallery's journey, which the change edits. On Linux a margin
entry's centre lies on the edge of its icon's stroke, and the innermost
node there flips between the icon's `svg` and its `path` as the entry
repaints. The journey failed in 5 of 13 Linux runs of this branch and in
none of 15 of `main` and #6762. Six traced copies of the step in the
Linux job, [on this
branch](https://github.com/max-sixty/leaf/actions/runs/45268635289) and
[on `main`](https://github.com/max-sixty/leaf/actions/runs/45268643151),
showed the dwell armed on the `svg` and cleared 6 and 9 ms later in the
two that failed; they did not show why the `svg` comes first more often
on this branch. [With the
fix](https://github.com/max-sixty/leaf/actions/runs/45273513465) all six
show the preview, four of them through a redraw that cancelled it
before.
`test_a_target_redrawn_under_the_pointer_that_came_to_it_still_previews`
holds the fix in Chromium and Firefox and fails in both without it.

## What it costs

- The public package API changes: an obligation record has `state`,
`reason`, `outcome` and `answered` in place of `status`, and a thread's
`attention` is a record or a to-do. `lf-deck`, `lf-tabs` and the feature
gallery are updated.
- A to-do in `leaf page state` says where it stands in the new fields,
and `conversation-loop.md` teaches that reading.
- The row record moves to format 54 with the protocol, so a page served
by an older Leaf and one served by this do not list each other.
- 133 files, +4,989 −2,732, and the code is no smaller. Python and
JavaScript outside tests gain 125 lines of code, of which #5979 removes
76, and 92 decision points, 56 of them in `activity.py` and
`activity-words.js`, which decide and word the liveness cases above.
`canonical_activity` goes from 278 lines and 61 decision points to 298
and 82. Tests are +2,189 −1,212, and the new eval case is 709 lines.
What shrinks is the contract: across the stack the schema's enumerations
for where work stands go from 12, with 43 values, to 6 with 22.

## Checks

- Evals, Claude Code against `main`'s instructions, three samples a case
on the 22 cases whose tags cover the changed passages: 55 of 66 pass on
the stack's text and 54 of 66 on `main`'s, and no case differs by more
than one sample. `resolved-request-stays-owed`, new here, passes 10 of
10. After Max's call that the agent decides when a resolved thread comes
back, that case ran again, five samples a variant: given a request it
cannot carry out, 5 of 5 agents reopen the thread, both where the
delivery shows it resolved and where only the reply's record does,
against 0 of 5 under the rule before, where only a question reopened it;
an answer that delivers what was asked leaves it closed 5 of 5 in each.
On Codex, 5 of 5 turns post such a request by command, against 0 of 5
with the rule only in `harness-codex.md`, and 5 of 5 leave an ordinary
answer to the final message. The suite read the stack's final wording;
the wording of the to-do reading that only this pull request carries has
no score of its own.
- The Claude Code agent journey, which the change to
`hooks/claude-code.ts` calls for, passes every step. Its `withdrawn`
step changed: a resolve that changes nothing the agent owes reaches no
hook here, so the step takes the comment back.
- `tests/model`, `dev/tests/model`, `tests/smoke`, the runtime's Node
tests and `pnpm run check` pass here. [A manual
dispatch](https://github.com/max-sixty/leaf/actions/runs/44976806053) of
every product test, on Linux and macOS, ran on the unsplit branch as it
stood before the closed-thread rule was widened. 25 tests failed, 2
because of this change, and both are fixed: one passes under the rule as
it now stands, and the other, the Undo row's age, assumed the user's
resolve leaves nothing owed, so its fixture now has the agent answer
first. The other 23 fail without this change: in `main`'s nightly run or
another branch's full run on 21 November (9), on `main` until #6713 and
#6717 (5), on `main` today, run there by name (7), or on macOS only (2).
[A second
dispatch](https://github.com/max-sixty/leaf/actions/runs/44996782669),
of this branch beside [`main`'s
own](https://github.com/max-sixty/leaf/actions/runs/44989336653), failed
no test on Linux that `main`'s run passed. On macOS it failed six that
`main`'s run passed, and none of the six fails in six runs by name on
this tree on a Mac; `main`'s macOS job failed four that this branch's
passed.
- `test_an_exact_workflow_reports_stale_work_beside_a_live_page_claim`,
a journey test this change edits, has failed on `main` since #6796,
whose checks never ran it: its helper now opens threads in the panel,
and the test goes on to read a card. Here it chooses cards again first.

Max asked for this as one of the long-stuck design questions. No person
has read it. Codex reviewed the model and the first resolve rule, the
review bot the unsplit pull request and this one, and fresh agents the
21 November merge with `main`, the closed-thread rule and the agent's
reopen; their findings are fixed.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty pushed a commit that referenced this pull request Nov 24, 2026
… test past the comment box's hold (#6917)

The six failures in [run
45263521603](https://github.com/max-sixty/leaf/actions/runs/45263521603)
come from two changes that meant to move the behavior these tests read.
The tests now follow those changes, and no runtime code changes.

- **#6796 (`aa34b6b22`)**: a Threads row now opens a passage's thread
beside the passage unless the tab chose the panel.
`test_whatever_the_field_holds_the_row_keeps_its_line`,
`test_a_thread_s_head_names_the_headings_over_its_words` and the
`rewritten-keyboard` case of
`test_original_quoted_words_remain_readable_after_the_page_rewrites_them`
still expected the panel's view. They pass at its parent `9da5040d6` and
fail from it on. Each now calls `choose_threads_in_panel` first, as
#6796 did for its other Threads tests, so they check the panel's row and
quote head again. The quote test drops its margin-card branch, which
expected `role="button"` on `.lf-thread-quote`. `thread/thread-card.js`
never sets that role.
- **#6892 (`624f947b5`)**: the comment box now waits at the window's top
while its target is in sight, which #6892 says covers the open box too.
So the beacon test's single wheel by the field's height leaves the field
72% in the window. It passes at `8c9a570ba` and fails at `624f947b5`.
The test now scrolls the paragraph out first, then the field. It still
checks that the beacon shows once the field leaves while the frame's
rows reach in.

On current main, the six cases fail without this change and all ten
cases in those tests pass with it, in Chromium and Firefox.

Closes #6909 — automated triage

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 24, 2026
…d from Threads

Since #6796, a press on a row of Threads opens a thread about a passage beside
its passage unless the user chose the panel, and main's own tests choose the
panel first where they mean the panel's view. This branch's tests of Back to
Threads' row and of a reload's return to a panel thread view do the same
(`choose_threads_in_panel`). `test_a_reload_keeps_a_thread_in_the_reader_it_showed`
then turns the choice back to cards before the reload, so it still checks
that the entry's record, not the choice, keeps the view the user stood in.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 24, 2026
…ut them in

`test_open_in_panel_and_show_on_page_choose_where_threads_open` (#6796) pressed
`t` straight after a reload and expected it to walk from the panel's thread.
The row's press had put the user in the thread's reply, and a reload now
returns them there (history.js), where `t` is a letter. The test now checks
that return, leaves the reply with Escape, and walks on as before; the choice
of the panel still lasts across the reload.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 24, 2026
An entry's record named the panel's view of a thread as the reader `primary`,
but a card as no reader at all, which since #6796 means "follow the choice of
where threads open". So after reading thread A in its card, walking to B and
pressing Open in panel there, Back opened A in the panel. thread/address.js
says the record, not the choice, names the view the user stood in, and the
merge of main (6bb2626) kept that only for the panel's direction.

The record now names a card as `card` (leaf.js, `openThreadView`), and a route
asking for `card` (thread/destination.js) opens as a route under the cards
choice does, whatever the choice now: the panel declines it as it declines a
route to the page (`request.page`), the margin draws the card under either
choice (margin-projection.js, `showPreview`), and where no card can stand by
then, as on a window too narrow for the rail, the panel takes the thread as
the placements Leaf forces have it. Routes that name no reader, `returnToPage`
among them, still find no card under the panel's choice.

`test_back_returns_to_the_card_a_later_open_in_panel_left` (Chromium and
Firefox): on a wide window Back opens A's card and no panel view; on a window
narrowed before Back, A opens in the panel. The wide case fails in both
engines without this change.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 24, 2026
…t by its source text (#6987)

`test_sample_browser_boundary_contains_focus_scroll_and_parent_access`
has failed on main since #6951 (`fb8b0cc1e7`): it passes at that
commit's parent and fails from it on. #6951 made
`Element.prototype.scrollIntoView` Leaf's wrap around the browser's
method in every Leaf document, a live sample's included, and the test
asserted that the method's source text reads `[native code]`.

What that assertion stood for still holds: a reveal a sample's script
makes itself does what the browser's does. The test now makes that call
and checks what it moves, which is the sample's own page and, through
the sample's frame, the page around it. Leaf's own `scrollIntoView`
leaves the page around the sample still, as the test already checked.
`focus` keeps its source-text check, since nothing wraps it. No runtime
code changes.

To weigh: the new check relies on the browser scrolling the host page
for a reveal made inside a sandboxed frame, as Chromium and Firefox both
do today. `module-scroll-and-motion.md` already says that Leaf's
`scrollIntoView`, unlike the native one, stays inside a live sample.

The session running the package-interface redesign asked for this, after
an agent found six browser tests failing on main. This is the only one
of the six that a pull request of the redesign caused; the others trace
to #6796, #6947 and #6009 and are left alone. Max hasn't read the diff.

Tests: the test by node id in Chromium, also under `--cpu-throttle 8`,
and its body in Firefox with the fixture swapped by hand. It fails when
the wrap drops the browser's call, and when the script's call is swapped
for Leaf's contained one.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 24, 2026
… reload return there (#6860)

Each history entry now keeps where the user was in the entry's own
Navigation API state: the place on the page, the place read to in an
open thread and the view it was read in (the panel or its card), what
had focus and its caret, the selection, and the panel's list (which
list, On's tab, the row, how far it was read). Back, Forward, a reload,
the reload a new revision or a restarted server asks for, and a return
from another site put the user back there. It is the second of the two
pull requests the Back/Forward design review proposed, after #6799, and
replaces history's map of places, its pixel offsets and its fallbacks
for a missing Navigation API.

- **When the record is written** (`history.js` header): as the user
leaves the entry. A route's push writes it, `beforeunload` writes it for
a reload or another document, and so does hiding the page.
`history.replaceState` drops an entry's state, so `bootstrap.js` renames
the URL through one `rename` that keeps it.
- **One restoration at a time** (`beginRestoration`): a document's
arrival and each same-document traversal return to the destination's
record under one intent, aborted by a newer one or any navigation and
ended by the user's own input within the entry, counted from their
latest step to it (`document-inputs.js`, `entered`). Leaving the window
is no such input, any more than a step Back or Forward is
(`document-inputs.js`, `away`). A departure while one is pending writes
the record it still owes. A Back taken before Leaf starts returns to the
entry it reached.
- **One owner of the user's place across reloads:** #6778's copies (the
panel list's capture, the reply's reader, keys released at
`landArrival`) are gone. A reload Leaf asks for adds a handoff
(`version.js`) of what the record doesn't hold: values typed into the
page's inputs, the words being written, the comparison and the pointer.
Values stay out of the record, since Back to an older entry would put
older values back; the arrival puts them back on every control except
one the user has changed since the document started
(`document-inputs.js`, `edited`), so what the user types while the page
starts stays, and a value the page's own script sets as it loads gives
way to the carried one. The handoff names its entry and applies its
place only there. `prepaint.js` alone writes and reads it (its header):
each document's first script takes it from the tab and keeps it only
where the document stands at the history entry it was written at
(`navigation.currentEntry.id`), as after a reload, a discarded tab's
return or Back to a page the browser didn't keep, so the tab holds one
only while a document that would hand it on is going, hidden or starting
hidden, until the next document starts or the page shows again. What a
document going or hiding hands on is, before the runtime starts, the
handoff it came with, if any, plus the current state of each control the
user changed, with the place only until the user acts within the entry;
once the runtime starts, the handoff it came with while its arrival is
still owed, else, on a reload Leaf asked for, what the document then
holds, else nothing. The arrival puts back what the handoff carries of
the document, the values, the comparison and the pointer, whatever
becomes of its claim on the place. Where the handoff puts the user back
at this entry (`prepaint.js`, `placesUser`), keys typed meanwhile wait
in a queue of their own (`bootstrap.js`), kept in the tab until each is
pressed where the user is put back or let go, so a second reload before
then loses neither. The user's own step Back or Forward lets held keys
go on any load, those Leaf is still pressing included, so they don't run
at an entry they weren't typed at; the user's step is one the Navigation
API marks `userInitiated`, and any other step, such as one the page's
script takes, lets none go. Where the browser can't say who stepped,
held keys stay and run at the entry the step reached: in an opaque frame
such as a live sample, which hears only `popstate`, and in Firefox,
which reports no step as the user's, the toolbar's Back included ([Gecko
bug 1903552](https://bugzilla.mozilla.org/show_bug.cgi?id=1903552)). The
words are kept either way.
- **How each part is named:** focus by carry's keys (`data-lf-carry` on
Leaf's thread controls, `data-lf-key` on Versions rows); a page
selection as a passage; a selection in a message as a quote with the
context that tells it apart (`findQuote`), dropped rather than landing
on another copy. That context widens through one loop (`passages.js`,
`passageContext`) moved out of `anchorForPassage`.

To weigh: Back returns to the view the user read a thread in, whatever
#6796's threads-in-panel choice now says, so Back to an entry read in a
card draws a card under the panel choice (`reader: "card"`), and a
draft's restore goes to whichever view already shows its thread, a card,
the panel or a widget's seat, and follows the threads-in-panel choice
only where none does (`reader: "standing"`). Focus returns to the exact
control left, so Back to a thread put away by Show on page lands on Show
on page. A composer the user put away stays shut on a reload, a widget's
Feed view isn't kept, nor is a caret in a message. A handoff whose
arrival is still owed when the page goes passes whole to the next
reload, the browser's reload button included, so keys typed through the
first reload still land. Since leaving the window ends no return, a
find-in-page search made while one is still under way can be moved off
its match. The runtime grows by about 660 lines of code and 520 of
comments net, and the scripts inlined in every page (`bootstrap.js`,
`document-inputs.js`, `prepaint.js`) by 12.9 KB raw (4.2 KB gzipped);
most of it returns the user after a reload and from another site, which
the plan hadn't covered. In Firefox, CodeMirror's reply editor raises a
scroll-linked warning when the page goes while the travel to a thread
still glides; the test that met it now lets the glide land, so the
warning still fails every test.

Max asked for this on the Back/Forward review page, which lists the card
return as a call he may reverse. Codex reviewed it repeatedly, and each
finding it reproduced has a test that failed first. Tests: new cases in
`navigation/test_arrival_record.py`, `navigation/test_reading_place.py`,
`startup/test_readiness.py`, `threads/test_navigation.py`,
`threads/test_rewrites.py`, `threads/test_seated_threads.py`,
`threads/test_threads_in_panel.py` and `drafts/test_revisions.py`, in
Chromium and Firefox; the focused selections around them, `test:runtime`
and `pnpm run check` pass. A tab the browser discards while hidden has
no test, since the suite can't discard one: the hide tests check what
the tab holds after the hide, and Back to a page the browser didn't keep
stands in for the return. A probe with Chromium's `chrome.tabs.discard`
showed the returning page at the same entry, with the tab's storage
intact; Firefox's discard is unmeasured. A same-page frame, which no
page has, can still remove the page's handoff or write its own over it,
which the page's next document then drops. A page script that steps Back
after the runtime loads but before the first state arrives lets held
keys run in the box they were typed for, and that typing then supersedes
the return to the entry the script reached.

> _This was written by Claude Code on behalf of max-sixty_
leaf-agent added a commit that referenced this pull request Nov 24, 2026
…ch in the thread row's own press (#7046)

#6796 made "threads open in the panel" a choice the tab keeps. Sixteen nightly journeys still assumed the old routing, and #6796's own CI didn't run them, because `journeys/` runs only nightly. Each repair keeps #6796's intent: the default is cards, the panel route chooses the panel, and Show on page chooses cards and lands on the thread. One fix is in the runtime: under the panel choice, a Threads row press cleared a diff's search after the route's awaits rather than in the press's task, so the typed-words watch reported the search's words as lost. All sixteen cases fail on `main` and pass on this branch, together with the browser tests of the thread routes (`test_threads_in_panel`, diff travel in `test_seated_threads` and `test_render_anchors`), `test:runtime` and `pnpm run check`.

**Runtime change.** Under the panel choice, a route that travels drew the passage's widget part only after the reader's awaits (`scrollToThread`). The card route and Show on page draw it in the gesture's own task. `inPrimary` now starts `revealThread` in the press's task too, and shares its condition with the card route as `partUndrawn` ([`thread/destination.js`](https://github.com/max-sixty/leaf/blob/2793181e244eca07c716afe32208f403cc869e29/browser/runtime/thread/destination.js#L284-L295)). What the user sees doesn't change: the search clears and the line shows, as #6796 intended. The clearing now belongs to the press.

**Test repairs**

| Tests | Cause | Repair |
|---|---|---|
| `test_pressed_controls`, 9 cases | `choose_threads_in_panel` called `window.__lfCheckApi`, which only a watched page defines | The helper imports the check API from the page's entry |
| `test_chrome_contracts` conversation, 2 cases; `test_render_anchors` diff lifecycle; `test_render_controls` focus rings | `open_panel_thread` chooses the panel, so a later marker press or `t` opened the panel instead of the card or seat | Choose cards again before that step, and before each focus-ring scope |
| `test_render_anchors` data-bound diff | Show on page chooses cards, so it lands on the thread, not its reply (`openingPart`). The row press now clears the search, so the test fills it again before Show on page to keep checking that press's clearing | Expect the thread focused; refill the search |
| `test_site` comment persistence | A Threads row opens a passage's thread in its card by default | Choose the panel before reading the panel's view |
| `test_demo_recording_drives_the_browser_journey` | Same: the reply shows in the card | Below |

**Decision for the maintainer: what the demo shows.** `leaf-dev site demo` now reads the agent's answer in the thread's card beside the passage, #6796's default, rather than in the panel. So the next published GIF and README stills will show the card. The panel's row then covered the board card the demo drags, so the demo now scrolls the board's section to the top before the drag. If the README should keep showing the panel, the demo can press the card's Open in panel first, which also puts that choice's notice on screen. The assets pin is unchanged, so nothing published moves until someone reruns the demo. The still this branch records:

![README still recorded on this branch, with the thread in its card](https://github.com/user-attachments/assets/d684c331-8317-49fd-a403-1a139598562d)

The macOS `test-macos` crash in the focus-ring sweep wasn't reproduced here. It ran the same sweep, so the next scheduled run will show whether it persists.

Closes #7017 — automated triage
max-sixty added a commit that referenced this pull request Nov 25, 2026
…eads about a passage now need (#7125)

Fifteen `leaf-dev stills` states that open a thread from Threads and
capture the floating panel's view of it failed in Chromium and Firefox:
`floating-thread` and the states built on it (`reaction-palette`,
`reaction-pressed`, `thread-code-copy`, `floating-thread-unread`,
`floating-thread-retitled`, `panel-resolved`, `panel-new-reply`,
`thread-reply-photo`), `progress-messages`, `thread-picture`,
`image-preview`, `summary-panel`, `plan-panel-reply-long` and
`plan-panel-reply-empty`. Since #6796, which lets the user choose where
threads about a passage open, a Threads row on a desktop window opens
such a thread as a margin card, so the drive's wait for the panel's
thread view timed out.

The panel's view of a thread still exists for a user who has chosen the
panel, so each drive now makes that choice first, as the browser tests
already do, and the crop shows what the state's docstring describes. The
helper that makes the choice moves from `tests/browser/threads` to
`leaf_dev.browser`, and every test imports it from there, so there is
one copy.

Max asked for this fix. Tests: every one of the 15 states, plus
`detached-thread` (unaffected, since a thread whose passage is gone
always opens in the panel), runs through `leaf-dev probe --state` in
Chromium and Firefox, and the screenshots show the panel's thread view.
`leaf-dev stills` runs for the three states first reported, two
`test_threads_in_panel` browser tests pass with the moved helper, and
the changed test modules collect.

> _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