Skip to content

Show a to-do on the user where they land on it - #3880

Merged
max-sixty merged 2 commits into
mainfrom
fix/3618-todo-words-where-you-land
Oct 25, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/3618-todo-words-where-you-land

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A to-do the agent opens on the user now shows its words where the user meets it. Its subject carries the margin's On me mark, named by the to-do's title. Wherever m, Show, a click or Tab puts the user on it, the floating panel's empty field reads "To-do · <title>" and the row's end offers Done as a check, so a finger ends it there instead of going back into On me. A to-do on a thread shows its title and a Done at the top of the thread, in a margin or page card and in the panel's thread view. This is presentation A from the triage of #3617 and #3618, which Max picked.

Closes #3617
Closes #3618

Supersedes #3620: its reproduction test is rewritten here to assert the fixed behavior.

How it works

The browser already received each user to-do as an obligation record (source.kind: "todo"). obligationPlace threw away its place, so nothing on the page knew where it stood, and the queue walk carried its own path for to-dos (page and widget stops, its own page head, its own rule for which to-do x ends).

  • obligations/place.js now places a to-do at its subject: the element or widget it names, or the page's head for a page to-do (subjectPlace). A to-do has a node and no source, since no element takes its answer. The page head is the first h1, else the first heading, else the first block of main; the walk used main itself, which would have put the user "on" a page to-do anywhere on a page with no heading.
  • With a place, a to-do gets what a widget obligation gets with no code of its own: the margin's On me entry, the location ring, obligationHolding, and arrival through the obligation view's arriveAtRecord. The walk's page stop and its to-do location rule are gone. One non-obligation stop remains, subject, for an update handed back to the user and for an On card's to-do, both arrived at where their subject stands.
  • obligationsIn still counts only widgets' obligations: a to-do has no source, so lf-tally, lf-tabs and work.js count what a region's widgets ask, as module-reading.md already says. The triage expected regions to count to-dos too; I left them out because work.js reads each member as a widget and a tally's "to answer" means a widget's answer.
  • The walk's todo scope is now a stance (keyboard/touch-controls.js): its x row is the scope's exit, which the panel's row offers at its end, and the scope's new says gives the field "To-do · <title>". An exit row can name its icon; the to-do's is a check, and every other stance keeps its ✕. The exit seat has a fixed width, so a worded "Done" would have moved the counts. The scope now stands outside Draw and Design mode in the keyboard stack, so a mode entered while on a to-do keeps its own ✕ and words; nothing else binds x.
  • Two to-dos on one element are one stop of the walk, as two on one thread already were. The user there is on the first, which x and the row's Done end, and then on the second.
  • A widget's digits follow the widget obligation the user is in, never a to-do: obligationContext asks only widgets' obligations, so a to-do standing inside an lf-ask, open or ended, leaves the question's number keys working.
  • The thread head's Done is worded rather than a check, because a thread head's check is Resolve. It ends the to-do through queueActions.done, so the line goes in the turn it is pressed.

Behavior changes beyond the to-do

  • obligationHolding breaks a tie between two obligations at one place in favor of the first the inventory lists (widgets' obligations come before to-dos), so a to-do on a widget never takes the widget's own question's ring and digits.
  • The walk's "which item am I on" now takes the innermost obligation on the list. Before, an answered inner obligation hid an open outer one: after ending a to-do on #step, the user standing there was on nothing rather than on the open to-do of the section around it. The same now holds for a widget: inside an answered question within an open proposal, m steps off the proposal instead of arriving at it.
  • A to-do's subject is an obligation the user can be in, so z (align current item) inside a section with a to-do aligns the section, as it does inside an lf-ask.
  • A to-do that ended still has its place, so On me's Done card can still Show it. Its subject therefore still counts as an obligation the user is in, for z and for the location ring when focus is on the subject itself.
  • Show on the second of two to-dos on one element lands where the first is named, since the field names the first to-do standing there.
  • A margin marker's accessible name now includes a lone item's own words when its subject doesn't already say them (markerName), which is how the to-do's title reaches a screen reader. Widget markers, whose words are their subject's name, read as before.

Tests

  • pnpm run test:runtime: 546 passed, and pnpm run check:browser matches the committed bundles, including a new obligation-place case for to-do placement, the page head, the widget tie and region membership.
  • tests/browser/navigation/test_on_panel.py: test: reproduce hidden to-do text after On me navigation #3620's test, rewritten as test_a_todo_on_you_says_its_words_where_you_land_on_it (margin marks named by title, then the field words and row Done after Shift+m and after Show), and test_a_finger_ends_a_todo_on_you_where_show_lands, which replaces the finger test whose docstring said the panel's row offers no step. The first also enters Draw mode on the to-do and checks the row offers the mode's exit. test_two_todos_on_one_element_are_one_stop_ended_in_turn covers the shared element; it fails with the stop dedupe removed. All pass, as do the other to-do, walk, tally and completed-obligation cases in the file.
  • tests/browser/threads/test_agent_replies.py::test_a_thread_heads_with_the_task_it_holds_on_me: the thread's line and Done, gone before the server answers.
  • tests/browser/margin/test_entries.py marker label and selection cases pass.

skills/leaf/references/conversation-loop.md now says where a to-do's press lands and what the user reads there, so the title must name the action on its own.

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

max-sixty and others added 2 commits October 24, 2026 21:08
A user to-do now has a place on the page (its subject, or the page's head),
so it gets the margin's On me mark named by its title, the location ring and
the obligation view's arrival, and the queue walk's private to-do path goes.
Standing on an open to-do is a stance: the panel's field reads
"To-do · <title>" and the row's end offers Done. A to-do on a thread shows
its title and Done at the top of the thread.

Closes #3617
Closes #3618

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/leaf.js
#	dist/kernel/runtime/bundle-surfaces.js
@max-sixty
max-sixty merged commit c7e3d23 into main Oct 25, 2026
3 checks passed
@max-sixty
max-sixty deleted the fix/3618-todo-words-where-you-land branch October 25, 2026 04:24
max-sixty added a commit that referenced this pull request Oct 25, 2026
main's #3850 renamed `leaf task open` to `create` with `--title`, and `start` now
takes its status line as `--text`, so the On Claude test creates its to-dos that way.
main's #3880 test pressed Show on a folded On me card; it now opens the card first.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 25, 2026
The thread-head to-do test added in #3880 called `todos.cmd_open`, which
#3850 had renamed to `cmd_create`. It failed during setup before
exercising the title and Done control in [main
CI](https://github.com/max-sixty/leaf/actions/runs/40161766827).

Use the current creation API, as the adjacent thread-task test already
does. The focused test fails with `AttributeError` before this change
and passes afterward, including immediate removal of the to-do line
while delivery is held. Product behavior is unchanged.

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Nov 3, 2026
…lace on the page (#5223)

Things Leaf couldn't place collected at the top. A to-do on the page as
a whole stood at the page's first heading. In an `lf-text-document`
bound to page data, the first data update took every comment off its
lines, unchanged lines included, and their margin entries gathered at
the document's top as one cluster. A comment on a line the document
holds twice sat at the top from the start. Now what has a place keeps
it, and what has none gets no pin: it lives in On me or Threads, as a
general thread does.

**Cause.** A comment in a text document anchors to a datum, here the
whole document, and a datum with no identity is bound to its revision,
so any update made each comment "Earlier data", which falls back to the
whole widget. A quote inside a datum recorded no surrounding words, so a
repeated line couldn't be told from its other copy and fell back to the
datum too. `subjectPlace` sent a whole-page subject to `pageHead()`, the
first heading (#3880).

**Text documents** (`lf-text-document.js`, `anchor-resolution.js`,
`passages.js`)

- `lf-text-document` gives its reading an identity, its key, so a
comment follows its words across source replacements. Unchanged lines
stay marked and their entries stay beside them.
- A quote inside a datum captures a prefix and suffix from the datum's
own words (`fencedAt`), and detaches where those can't tell it from
another copy, as a quote of authored text does.
- A quote captured with datum words around it names a passage in the
datum. Once a replacement takes its words, it resolves nowhere, and its
thread reads as page-level with no pin. A quote that was all of its
datum's words still falls back to the datum, as a row's changed label
does. `projection/data.js` and `events.md` state the rule.

**Page to-dos** (`obligations/place.js`, `queue-walk.js`,
`current-target.js`, `floating-panel.js`)

- `subjectPlace` gives the page as a whole no place, and `pageHead`
goes. A page to-do has no margin entry or ring; On me lists it under
"The whole page", after placed items.
- `m` arrives at it on its On me card (`showOnMe(obligation)`), and the
page doesn't scroll. A user on an On me card is on the item that card
shows (`ON_CARD` in `currentLocationOrigin` and `currentLocationStop`),
so the walk steps on from it and `x` ends it there. On a card, `x` ends
that card's to-do even where another to-do shares its place; it used to
end the first to-do there.

**Left as it was.** Comments on `lf-diff` and `lf-call-diff` lines still
go to "Earlier data" at the file header once the patch changes, since a
diff line's key is its line number in one revision of the patch. Page
to-dos come after placed items in On me, as general threads come after
placed ones in Threads. The text document's caption counts as words
around a quote, so a selection of a document's whole text is a passage
and loses its pin when that text is replaced.

**Test.**
`test_a_text_document_keeps_comments_on_their_lines_across_updates`
(Chromium and Firefox) comments on a line at a run's edge and on the
second copy of a repeated line, prepends one line and then 200, then
rewrites the first commented line, and checks that no entry stands at
the document's top. It and the rewritten to-do tests in
`navigation/test_on_panel.py` fail on main and pass here, and removing
the null rule in `resolveAnchor` or the card branch in `doneTodo` fails
them again. Tests that expected the old placements now expect the new: a
page to-do on its card, and a page-level quote where they expected
"Earlier data". `pnpm run test:runtime` and `pnpm run check:browser`
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

2 participants