Repository navigation
Give a settled thread back in the reader the user had it in when it is undone or refused - #5286
Merged
Merged
Conversation
…s undone or refused `z` on a Resolve, and the log refusing one, returned the user to the thread by a route that chose a surface from the thread as it then stood, not from where the user had it. A thread resolved in its margin card came back in the floating panel, where resolved threads open: the reported case, in which the agent had picked the Resolve up, so `z` showed it before taking it. A thread about a passage that the user resolved in the panel's view came back in a card beside the passage, after `z` and after a refusal alike. The surface that settles a thread now names the reader the user had it in (`reader`, thread/folding.js): the panel's view names the primary reader, a margin card the page. folding.js returns the user there when the log refuses the settlement, and undo.js keeps the reader under the gesture's attempt: showing the settlement opens it there, and so does taking it back, by any of `z`'s three ways or the notice's Undo. The thread destinations own the route: `openPageThread`'s `page: true` becomes `reader: "page"`, and the new `reader: "primary"` asks the primary reader to show the thread as its last resort is asked, without handing it back to the page once the page could draw it, and closes the page's card, so one thread stands open. Seats and a primary reader's parts name no reader and keep the route's own choice. A settlement from another tab or before a reload has no reader and opens as a route opens it. Behavior changes: - Resolve in the panel's view, then `z` or a refusal: back in that view, not in a card. - Resolve in a card, then `z` once the user has scrolled away or the agent has picked it up: the first press shows the passage and the second opens the card, with no turn through the panel. - Taking back a settlement this tab made returns the user to its thread even when its place was already in view, as when a small scroll cleared the landing's arm. - A settlement's notice names the thread by its name, as `z` names the same gesture; it named it by the words it is about, so the two notices gave one thread two names. The panel row's notice now ends long words in an ellipsis before Undo, where it wrapped to two lines and stood Undo over its key. Known gap: resolve in a card, narrow the window until no card can stand, then `z`: the thread reopens and the user lands on its margin marker, as Show on page lands on a narrow window, rather than in the panel. Tests: `test_a_thread_resolved_in_the_panel_comes_back_to_the_panel` and `test_z_shows_a_thread_resolved_in_its_card_by_its_passage` fail on the base and pass here. Undo, resolve, refusal, notice, row and fold selections in test_resolving.py, test_render_outbox.py, test_render_floating_panel.py, test_render_aim.py and test_render_reactions.py pass, except five that fail the same way on the base: `test_a_remote_resolve_disarms_the_open_reply_list_it_takes_away`, `test_z_names_what_it_takes_and_how_long_ago_in_a_fresh_tab`, `test_a_pointer_folds_the_panel_from_its_corner` and both `test_borrowed_scroll_stops_leave_code_selection_and_marks_with_their_owners` cases. `pnpm run check` and `pnpm run test:runtime` pass.
# Conflicts: # dist/kernel/kernel.json # dist/kernel/runtime/bundle-data.js
Only the rebuilt kernel conflicted; it is main's, rebuilt from the merged sources. Brought this branch's additions up to main's conventions: the two new tests read the panel's thread by `data-lf-thread` (#5244), and the two comments that pointed at destination.js's `page` option now name `reader: "page"`, its name on this branch. test_z_shows_a_thread_resolved_in_its_card_by_its_passage now waits for the page to scroll to the card before resolving it. After this merge, Shift+t focused the card before the page had scrolled there, and Home pressed during that scroll lost to it in two runs out of three under xdist.
leaf-agent
approved these changes
Nov 4, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 4, 2026
…dot still after a refused Resolve (#5319) Two fixes that came out of the undo review ([#5286](#5286)). ### Home pressed before a glide has moved the page keeps it at the top Shift+t, then Home before the page had started moving, left the page at the card. Home at the top scrolls nothing, and a glide stood down only when another hand moved its box, so it carried the page down regardless. A probe that sends Home 0–300 ms after the t keydown lost Home in 15 of 21 Chromium runs before this change and in none of 21 after; in Firefox, with frames held so Home lands before the first, none of 8 lost it. A wheel, a touch, or one of the browser's scroll keys pressed outside a field that takes it now stops every glide in a box on the event's path (`aimsScroll` in `scrolling.js`). Keys Leaf binds, such as `r` or `d`, leave a glide running. A hand that moves the box without an input Leaf sees, such as a scrollbar's drag, still stops it as before. `test_keys_pressed_while_the_page_moves_act_as_if_it_had_landed` gains a phase: `d` then Home, pressed before a frame runs, end at the top. It failed before this change, with the page one step down. ### A refused Resolve no longer sets and clears the leaf's error dot in one task After the server refused a Resolve in the panel's thread view, its error stood in the field. The next Resolve closed the view, and the paint that closed it read the field before moving the page's editor in: `sayable` required the editor to be connected, found the departing reply's place empty, and counted the error as unsaid. The error dot was set for that paint and cleared by the next one in the same task, which the write watch reports as an unchanged write. `sayable` now reads the editor `fieldInput` names, the one the paint stands in the field. A folded panel, a search and a view with no editor still say none. `test_a_thread_resolved_in_the_panel_comes_back_to_the_panel` now resolves once more after the refusal, which failed on the write watch before this change. ### Testing The two tests above, the other glide, wheel and scroll-key tests in `test_obligation_walk.py`, `test_panes.py`, `test_covering.py` and `test_render_send_placement.py`, the error and refusal tests across the panel and drafts, `pnpm run test:runtime` and `pnpm run check:framework`. Two of those fail locally with and without this change: `test_a_wheel_return_attaches_the_comment_box_in_the_first_visible_frame[combined-selection]` (#5182) and `test_a_click_on_a_panes_words_makes_it_the_subject_of_every_scroll_key`. > _This was written by Claude Code on behalf of max-sixty_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the user resolves or reopens a thread and then takes it back with
z, the notice's Undo or a server refusal, the thread now comes back where they had it: in the card beside its passage or in the floating panel's thread view.The user resolved a thread in its margin card, pressed
z, and the thread opened in the floating panel. Undo and refusals both returned the user by the ordinary route to a thread, which picks a surface from the thread as it stands when the route runs. No margin card draws a resolved thread, so that route's last resort for one is the panel. The same choice sent a thread resolved in the panel's thread view back to a margin card, afterzand after a refused Resolve. Only the surface the user pressed Resolve in knew where they had the thread.zzHow it works
settleThread(thread/folding.js): a margin card names the page, the panel's thread view names the primary reader. A seat names none, since a route to a seated thread finds its seat.undo.jskeeps that reader with the gesture (retainGesture'ssettled).z, the notice's Undo and a refusal all reopen the thread there throughreturnToThread. Showing the gesture first, for a gesture out of view or one the agent has picked up, uses the same reader.thread/destination.js) does the opening, so a return still closes any other open card and checks that the user hasn't acted since the press. Itspage: trueoption becomesreader: "page" | "primary". Show on page passesreader: "page".Notice naming
The Resolve notice quoted the passage, and the
znotice for the same gesture quoted the thread's name. Both now use the thread's name (threadName), as Threads and the panel's head do. A long name ends in an ellipsis before Undo; it used to wrap to two lines and stand Undo over its key.Testing
tests/browser/threads/test_resolving.pyfail on main and pass here: a thread resolved in the panel comes back to the panel afterzand after a refusal, andzshows a thread resolved in its card by its passage, then reopens the card with no panel.pnpm run test:runtimeandpnpm run check.leaf-dev probe.Left as is
z: the thread reopens and the user lands on its margin marker, as Show on page does on a narrow window, rather than in the panel.zfrom another tab or after a reload falls back to the route's own choice.