Skip to content

Say what z takes and how long ago, in every tab - #3586

Merged
max-sixty merged 6 commits into
mainfrom
undo-says-what-z-takes
Oct 22, 2026
Merged

max-sixty merged 6 commits into
mainfrom
undo-says-what-z-takes

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Undo now names the gesture it would take back, and how long ago it was made, in every tab and after a reload. This is the first half of the undo design the user chose on 21 October (notes/undo-reach/README.md); "Show, then take" remains.

What the user sees. The leaf's menu row, the command reference and the undo notice read, for example, "Undo: resolved “Rollout safety” · 21d ago", then "Undid: … — sent". Before, they named only the gesture's kind, except for a widget gesture in the tab that made it (#3271).

  • The menu row shows the age at its end and wraps its words to a second line, rather than cutting the gesture's name at 248px.
  • Every command's menu row now carries the command's description as its hover text, as the command reference already did.

How.

  • browser_undo_candidates (served_state/document.py) gives the head candidate, the one z takes, its gesture reading.
  • That reading is the one history rows already use, moved from history._gesture to GestureWords.gesture, so both share it.
  • Threads, to-dos, approvals and reactions are named from what the browser already holds.
  • The age is the gesture's ts, rendered with the runtime's ago().
  • Only the head gets words. On a 1,010-event page a state read took 23.8 ms against 23.4 ms without, interleaved in one process. Words for every entry would add about 2 ms per read.
  • No protocol bump. Gesture is now a shared schema definition, and the baseline is accepted with --accept-served; earlier runtimes ignore the new optional field.

Evidence.

  • test_z_names_what_it_takes_and_how_long_ago_in_a_fresh_tab opens a page holding a three-week-old resolve. It checks the menu row, its age and hover text, and the notice, then an action's wording. It fails on the old runtime.
  • Model and process tests for history, gestures and undo pass (62), as do pnpm run test:runtime (522), the floating panel's menu tests (15) and the reactions and tabs cases updated for the new wording.
  • Hand-checked in a review-a-plan preview in light and dark, after the wrap change too.

events.md's Undo section, the undo.js header, gesture_words.py, module-state.md, the undo-reach note and its TODO item describe the new contract.

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

max-sixty and others added 4 commits October 22, 2026 09:49
Undo used to name only the gesture's kind ("Undid the latest update",
"Reopened the thread"), except for a widget gesture in the tab that made
it, and never its age. On a page left for weeks, `z` could reopen a
thread resolved then without saying which one or when.

Now the command reference, the leaf's menu row and the undo's notice
name the gesture and its age in every tab and after a reload: "Undo:
resolved “Rollout safety” · 21d ago", then "Undid: resolved “Rollout
safety” · 21d ago — sent". The browser names a thread, to-do, approval
or reaction from what it already holds. For an action, the served undo
list's head carries `gesture`, what the action did in its own
document's words. That reading moved from `history._gesture` into
`GestureWords.gesture`, so history rows and undo share it, and one
`GestureWords` per state read serves both. A widget's own `says` still
names its gesture where the tab holds it, now with the age.

Only the head pays for the words. On a page with 1,010 events, 1,000 of
them undoable actions over ten revisions, a state read took 23.8 ms with
the head's words and 23.4 ms without, measured in one process with the
two arms interleaved. Wording every candidate cost about 2 ms. A
widget's own Undo of an older entry names only the widget after a reload.

The menu is 248px wide, so its row cuts long words. The age stands at
the row's end, in the value slot, through a new `touchValue` on page
commands. Each command row's menu tooltip is now the command's
description, as in the command reference, so the cut words are whole
on hover.

State schema: `Gesture` is now a `$defs` entry that `HistoryRow.gesture`
and the undo item's new optional `gesture` reference. Accepted as a
served change with --accept-served. HistoryRow.gesture has the same
shape as before. The comparator compares a reference by its text, so it
named the move. lf-activity, its only runtime reader, reads the same
fields. Older runtimes ignore the undo item's new field.

Behavior changes in tests: test_tabs expects the age in the widget undo
notice. The reactions test now reads the reference row's tooltip. Its
old innerText check failed on the base too, because descriptions show
inline only under `hover: none`. A new browser test reopens a page with
a three-week-old resolve and checks the menu row, tooltip and notice,
then checks an action's words. It fails with the base runtime. The
process test checks that the head carries `gesture` and older entries
don't.

notes/undo-reach records that Say what z takes landed. Show, then take
remains, and TODO.md says so.

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

The Undo row now names its gesture, which a single 248px line cut to
“Undo: resolved “Th…”. Menu rows wrap to two lines; the value keeps the
first line.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	tests/browser/test_render_reactions.py
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The undo menu's age can become stale while a page stays open.

… the clock

The menu row's value and hover were snapshots from the repaint frame, so a
page left open kept saying "just now" as the gesture aged. They are now
read where the panel paints, which follows the page's clock.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 22, 2026
# Conflicts:
#	skills/leaf/kernel/kernel.json
#	skills/leaf/kernel/runtime/bundle-document-identity.js
@max-sixty
max-sixty merged commit fa3aad5 into main Oct 22, 2026
3 checks passed
@max-sixty
max-sixty deleted the undo-says-what-z-takes branch October 22, 2026 18:27
max-sixty added a commit that referenced this pull request Oct 22, 2026
Undo now shows a gesture before taking it back whenever the user
couldn't see what it would change. This completes the undo design the
user chose on 21 October (the "Show, then take" half; "Say what z takes"
landed in #3586), so `notes/undo-reach/` is deleted.

**What the user sees.**
- When the gesture `z` (or the menu's Undo row, its touch route) would
take back is out of view, or the agent has already picked it up, the
first press only shows it. It opens the thread, travels to the widget as
its fragment so Back returns, or opens the message holding an agent-sent
widget. It then says "Press again to undo: resolved “…” · 21d ago". The
second press takes it back.
- Another key, a press on the page, or a scroll taking the shown place
out of view clears the arm. Modifier keys, wheel scrolls that keep it in
view, and presses in Leaf's chrome don't, which lets the menu route work
in two presses.
- A gesture in view and not picked up is taken in one press as before.
So is a gesture this tab holds a reversal for, since taking it back
already lands the user on it.
- A resolved thread in the floating panel now shows a passing notice in
place of its fixed "Resolved · reopen to reply" line. Without that,
"Press again" wasn't visible there.

**How.**
- `browser_undo_candidates` (`served_state/document.py`) marks
`picked_up` from `delivery.opened_input_ids`: the opened-pickup evidence
the workflows read as Delivered, which had no callers until now.
- `undo.js` holds the armed state.
- No protocol bump: `picked_up` is optional, and earlier runtimes ignore
it.

**Evidence.**
- New browser tests in `test_render_outbox.py` cover:
- an old resolve below the fold, shown then taken, with nothing written
to the log on the first press;
  - the arm clearing on a key and on a scroll;
  - a picked-up gesture in view showing first;
  - the menu route taking two presses.
- All fail on the base runtime; the in-view control passes on both.
- A new process test checks that an opened pickup marks the gesture and
a queued one doesn't.
- After merging main: `pnpm run test:runtime` (519), outbox `-k "undo or
z_"` (23), the floating panel `-k menu` (15) and the process undo tests
pass, and `check:browser` is clean. Three existing tests now press
twice, as the new behavior asks.
- Hand-checked in a `review-a-plan` preview with a 21-day-old resolve
below the fold, and with a picked-up one.

`events.md`'s Undo section, the `undo.js` header, the `history.undo`
description and `docs/how-it-works.html#undo` describe it. Redo and a
Changes panel move to a TODO item that points at the deleted note.

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

---------

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

The leaf's menu wrapped a row's words to a second line where they ran
past the panel's width, so Undo naming a long comment (`Undo: commented
“The CLI exiting does not mean its background…”`) pushed every row below
it down. The row now stays on one line: its words are cut with an
ellipsis where the line runs out, the age and `⌘Z` chip stay beside
them, and hovering the row reads the words whole, as it already does for
every other row the panel cuts. This reverses the wrap #3586 chose; the
user asked for the cut.

The change deletes the two-line clamp on `.lf-fp-item > .lf-fp-label`,
so every menu row takes the panel's existing one-line cut, a thread's
name or version note among the menu's search results included. Under a
finger, with no hover to read cut words, a row still wraps to say its
words whole. The version rows' own one-line override existed only to
undo the clamp and goes with it.

Requested by the user on a Leaf page. `leaf-dev stills` shows the Undo
row on one line in `plan-more` and `panel-errors`, with the Versions
view unchanged on desktop and phone; Firefox hover reads the whole
label. `test_undo_names_what_it_takes_and_how_long_ago_in_a_fresh_tab`
now checks a long comment's row is cut and as tall as its neighbours,
and fails on the old rule; the floating panel's menu, version and finger
tests pass.

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