Skip to content

Let Back return to the item each walk left, and list it in the command reference - #5232

Merged
max-sixty merged 9 commits into
mainfrom
back-to-item
Nov 3, 2026
Merged

max-sixty merged 9 commits into
mainfrom
back-to-item

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

After t to a thread and m to an obligation, browser Back skipped the thread and went to where the user was before t: consecutive navigation steps shared one history entry while the last landing still showed, whatever trip each was. Rather than add a g b key with its own record of where the user had been, Back itself now returns to the item, and the ? reference lists it.

Back returns to the item each step left

Every navigation step that arrives and moves the page adds an entry where the user stood, as a followed link does. The navigation group is gone: its state, the reading-input listener that ended it, the landing and intent arguments every caller passed, the replace path in prepareEntry, and openingPassage. browser/runtime/anchor-travel.js's header records the decision and the alternative it rejected.

A first version kept one entry per run of one walk, on the grounds that Shift retraces a walk. Review found two cases it still got wrong: answering an obligation takes it out of On me, so neither Back nor Shift+m returned to it, and an lf-tally Next on me merged with m though its stops differ. Both come from sharing an entry, so no steps share one.

navigateToDatum keeps main's #5034 behaviour: its entry names the widget key, and a step that doesn't move renames the current entry to that URL.

A Back stop records where the page is headed. With an entry per step, m m typed quickly left a stop wherever the first m's glide had reached when the second left: Back put the page at 42px with focus on the first obligation 3,100px below. Following #5227's rule that keys pressed while Leaf moves the page act as if the motion had landed, readPlace (history.js) records the offset as scrollGoal(pageScroller), so Back returns to the obligation the first m landed on, as typed slowly (3146px in Chromium and Firefox).

Behavior that changed:

  • t then m, then Back, returns to the thread's place, and Back again to where the user was reading. Main returned straight to the reading place (measured with leaf-dev probe in Firefox and Chromium).
  • A run of m or t takes one Back per stop to undo, where it took one. Back after answering an obligation and stepping on returns to it.

The command reference lists Back and Forward

keyboard/page.js declares a run-less page row beside caret browsing's F7, in the platform's spelling: ⌘[ and ⌘] on a Mac, Alt+← and Alt+→ elsewhere. A run-less row never matches in the dispatcher, so the press still reaches the browser. Back's description reads "Return to the place the last walk, Go-to or link left". bindings.js exports its MAC check so the row uses the platform reading the key spelling already does.

Tests

  • test_back_returns_from_an_obligation_the_walk_travelled_to covers t then m, and an m walk across an answered obligation; it fails on main (one entry where it asserts two).
  • test_back_returns_from_a_thread_the_walk_travelled_to asserts a t walk adds an entry per thread and Back and Forward retrace it.
  • test_a_new_reading_passage_ends_a_travel_group is now test_back_returns_the_passage_chosen_between_trips, with the same assertions.
  • test_same_passage_and_controls_keep_a_mixed_travel_group is deleted: it held clicks and controls from ending a group that no longer exists.
  • test_keys_pressed_while_the_page_moves_act_as_if_it_had_landed adds Back after a quick m m; it fails with the checkpoint reading scrollY (Back lands at 0).
  • test_an_option_that_runs_from_nowhere_still_says_its_keys_and_why also checks that Back is a disabled option whose accessible description gives its key and description.
  • pnpm run check:browser and pnpm run test:runtime (754) pass, as do the Back, keys-during-motion, widget-key URL and hidden-fragment browser tests.

docs/ui.html "Back and Forward" states the rule; the glossary drops Navigation group.

Inherited: six keyboard tests fail locally on main's own tree as on this branch (checked by node id with this branch's files checked out from main): test_the_reference_runs_available_commands_and_explains_the_rest and test_the_reference_keeps_local_search_state_on_one_lit_surface in navigation/test_command_reference.py; test_a_command_button_owns_activation_and_the_native_form_default, test_a_text_box_keeps_its_keys_from_the_widget_around_it and test_a_focused_scope_owns_its_declared_key_while_the_command_is_unavailable in navigation/test_key_scopes.py; and test_route_corner_hint_overrides_the_rows_face_in_obligation_and_widget in controls/test_command_routes.py.

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

After `t` to a thread and `m` to an obligation, browser Back skipped the
thread and went to where the user was before `t`: consecutive navigation
steps shared one history entry while the last landing still showed,
whatever trip each was. Rather than add a `g b` key with its own record of
where the user had been, Back itself now returns to the item.

Every navigation step that arrives and moves the page adds an entry where
the user stood, as a followed link does. The navigation group is gone: its
state, the reading-input listener that ended it, the `landing` and unused
`intent` arguments every caller passed, the replace path in
`prepareEntry`, and `openingPassage`.

A first version kept one entry per run of one walk, on the grounds that
Shift retraces a walk. A review found two cases it still got wrong:
answering an obligation takes it out of On me, so neither Back nor Shift+m
returned to it, and an `lf-tally` Next on me merged with `m` though its
stops differ. Both come from sharing an entry, so no steps share one.

Behavior that changed:
- `t` then `m`, then Back, returns to the thread's place, and Back again
  to where the user was reading. Main returned straight to the reading
  place (measured with `leaf-dev probe` in Firefox and Chromium).
- A run of `m` or `t` takes one Back per stop to undo, where it took one.
  Back after answering an obligation and stepping on returns to it.

Tests:
- `test_back_returns_from_an_obligation_the_walk_travelled_to` covers
  `t` then `m`, and an `m` walk across an answered obligation; it fails on
  main (one entry where it asserts two).
- `test_back_returns_from_a_thread_the_walk_travelled_to` asserts a `t`
  walk adds an entry per thread and Back/Forward retrace it.
- `test_a_new_reading_passage_ends_a_travel_group` is now
  `test_back_returns_the_passage_chosen_between_trips`, same assertions.
- `test_same_passage_and_controls_keep_a_mixed_travel_group` is deleted:
  it held clicks and controls from ending a group that no longer exists.

docs/ui.html "Back and Forward" states the rule; the glossary drops
Navigation group.

Inherited failures, also failing on the merge base locally:
`test_an_obligation_walk_glides_within_a_view_and_opens_other_tabs_at_the_question[True-False|False-True]`
and `test_a_deferred_diff_renders_only_opened_files_and_hydrates_comment_travel`.
# Conflicts:
#	dist/kernel/kernel.json
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-data.js
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-data.js
# Conflicts:
#	browser/runtime/anchor-travel.js
#	browser/runtime/reading-place.js
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-data.js
Back now returns to the item each walk, Go-to or link left, but nothing
in Leaf said so: the `?` reference listed every Leaf key and none of the
browser's history keys, which is why a `g b` key looked necessary.

`keyboard/page.js` declares a run-less page row for them, beside caret
browsing's F7, in the platform's spelling: ⌘[ and ⌘] on a Mac, Alt+←
and Alt+→ elsewhere. A run-less row never matches in the dispatcher, so
the press still reaches the browser. Back's route carries the
description "Return to the place the last walk, Go-to or link left".
`bindings.js` exports its `MAC` check so the row reads the one platform
reading the key spelling already uses.

Test: `test_an_option_that_runs_from_nowhere_still_says_its_keys_and_why`
now also checks that Back is listed as a disabled option whose
accessible description gives its key and description.
leaf-agent
leaf-agent previously approved these changes Nov 3, 2026
# Conflicts:
#	dist/kernel/kernel.json
leaf-agent
leaf-agent previously approved these changes Nov 3, 2026
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-data.js
With an entry per navigation step, `m m` typed quickly left a Back stop at
wherever the first `m`'s glide had reached when the second left: Back
put the page at 42px with focus on the first obligation, 3,100px below
(Chromium; Firefox the same at 627px). #5227 made keys pressed while
Leaf still moves the page act as if the motion had landed, and the
working-place checkpoint now follows that rule: `readPlace` records the
page's offset as `scrollGoal(pageScroller)`, so Back after a quick `m m`
returns to the obligation the first `m` landed on (3146px, as typed
slowly, in Chromium and Firefox).

Test: `test_keys_pressed_while_the_page_moves_act_as_if_it_had_landed`
adds Back after a quick `m m`; it fails with the checkpoint reading
`scrollY` (Back lands at 0).
@max-sixty
max-sixty merged commit 9a72f6a into main Nov 3, 2026
4 checks passed
@max-sixty
max-sixty deleted the back-to-item branch November 3, 2026 20:30
max-sixty added a commit that referenced this pull request Nov 4, 2026
)

Everything On me is now answered by the widget or thread that asks it.
Leaf no longer puts a to-do on the user with a Done of its own, so a
widget is never given an answer it doesn't declare. A step such as
trying a build is asked in a thread, and the user's reply or a 👍 answers
it.

Before, `leaf task create <subject> --on user` put a to-do on the user
on any thread, element or widget that had no open obligation, and the
turn-end check did the same for each step it found. On me then offered
that item a generic Done: on an `lf-code` block or a paragraph, the only
answer was a check mark the widget never offered. This reverses the
user's 2026-10 choice to keep such to-dos for steps.

## The rule, and where it lives

- **On me holds obligations only.** Each comes from a widget that
declares `x-awaits` (any widget: bundled, from a package or the page's
own), an agent message sent with `--obligation`, or an update to send
again. On the page, each is answered only through its source: the
widget's declared actions, or a reply or settling reaction in the
thread. A multi-select `lf-options` keeps its Done, since that is the
widget's own control. An answer the user gives elsewhere, such as in
chat, the agent still records with `leaf task end`.
- **Content that asks nothing** (a paragraph, a chart) and a step the
user takes get a thread whose message carries `--obligation`.
- The rule is stated in `obligations.py`'s header, the `x-awaits` key in
`browser/registry.json`, How it works ("On me and the agent's list",
with a new paragraph on what can ask), `conversation-loop.md` ("The On
lists", where the to-do row becomes an "action the user takes" row asked
in a thread) and `authoring-on-me.md`. `todos.py`'s header records the
decision.

## What goes

- **Protocol 39 → 40.** A `todo` event has no `owner`; `todo_end` is the
agent's alone, is no longer browser-postable or undoable, and its
handling clause for the user's Done is gone. A Leaf at 39 would misread
a 40 log and the reverse, hence the bump. (`main` took 38 → 39 for an
undoable edit in #5221.)
- **Model.** `user_task_obligations`, the `todo` obligation source,
`--on`, the `duplicate-obligation`/`users-question`/`agents-todo`
refusals, and `owner` on served to-dos. `queues.on_user` rows are
`widget`, `message` or `update`; to-do rows stay on On <agent>.
- **Clerk.** The fork's answer has no `kind`. Every ask, a step
included, is a thread question whose message says what to do and asks
for a reply. `turn-end-check.md` (#4900) asks the fork that way, and the
fork eval (`dev/leaf_dev/fork_eval.py`,
`evals/workflows/fork_eval.yaml`) labels the step cases as questions.
- **Browser.** The To-do Done on panel rows, On me cards and a thread's
head; the `x` key and its "On a to-do waiting on me" stance;
`queueActions.done` (public package API); local `todo_end` folding and
its undo words; `offers`; `showOnMe`, which #5223 had extended to land
`m` on a page to-do's card; the `done` action face and `checked` icon. A
stance's exit is always Close's ✕, since no stance names another action
now. The margin card's grid loses the row the to-do header held;
`leaf-dev probe review-a-plan --do drive:card-by-keyboard --base`
measures identical child boxes in both arms.

## A cost this keeps

A reply answers a step's question whatever it says. A to-do stayed open
until Done, so "where do I get the build?" left the step On me; now that
reply answers the question, and a plan step naming it reads done until
the agent asks again with `--obligation` and points the step at the new
question. `conversation-loop.md` tells the agent to ask again, and the
clerk's header records the trade.

## Tests and evals

Behavior changed on purpose:

- `todo-on-the-user` becomes `step-on-the-user-takes-a-thread` (pass: a
thread message with `--obligation`).
- `closeout-asks-take-their-route` now requires the `/reload-plugins`
step as a thread question.
- `on-lists-read-todo-records` puts the phone build on the user as a
question.
- Tests that protected to-dos on the user (their Done, `x`, undo of
Done, the To-do placeholder, the thread-head line, and #5223's page
to-do on its card) are deleted. Tests that used one as a convenient On
me item now use a question in a thread.

On the candidate tree (Claude Code, 2 runs each):
`step-on-the-user-takes-a-thread` 2/2, `closeout-asks-take-their-route`
2/2, `on-lists-read-todo-records` 1/2. The failed run listed both user
items correctly and failed on the agent side, doubting that the
benchmark re-run was under way. No base arm was run: the base
instructions route a step through `leaf task create --on user`, which
these rubrics now fail by construction.

`pnpm run check:browser`, `pnpm run test:runtime` (775) and the model
selections covering to-dos, the clerk, obligations, hooks, undo and the
protocol pass, as do the resolved browser tests and #5232's
Back-from-an-obligation tests.
`test_an_item_arriving_above_takes_its_walk_place_and_moves_no_card_read`
fails here and on `main` alike since #5318: the card read moves down by
the new card's height (116px on `main`, 95px here), so the list no
longer holds its place when an item arrives above.

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