Repository navigation
Answer a choice asked in a thread from its On Me card - #6056
Merged
Merged
Conversation
On Me's card for a choice the agent asked in a thread message (an `lf-options choose` group in `--markup`) offered only Discuss and Show while the thread wasn't drawn, and `1` did nothing. Once the user picked inside the thread, Done read a bare "Answered" until the thread was drawn again. The widget exists as one instance that its message keeps, and it is in the document only while a drawing of the message holds it (`authoredHolders`, thread/messages.js). `choicesOf` and `answerWords` looked it up by id in the document, so they found nothing. - The card now draws the message that holds the widget, as it already did for a question asked in words. The panel's drawing outranks a page thread card's, so the widget stands in the card while On Me shows it. With the card focused, the options show their digits, `1`-`9` pick through the widget's own controls, and the pick is the same `choose` action a pick in the thread records. Where one message holds several such widgets, the first card draws the message and the others answer their widgets through `choicesOf`, as a page choice's card does. A line in Done is named by its widget's own question. A record's obligation (`source.unit`, such as a review's cases) still draws no message, so a review in a thread keeps its cards as they were. - `answerWords` and `obligationWord` read the widget's markup where its message keeps it while no drawing shows it (`addressableAt`), so Done reads "Answered: Ship Friday" after the thread is put away and after a reload. This is design A in notes/on-me-widget-cards.md, which now says so. Evidence, from the issue's repro with `leaf-dev probe`: on main the card reads "Ship on Friday? Ship FridayWait a week · Discuss" with no options and `1` picks nothing; here the card holds both options, shows 1 and 2 when focused, and `1` picks Ship Friday. After picking inside the thread and closing it, Done reads "Answered" on main and "Answered: Ship Friday" here, also after a reload. `test_a_choice_asked_in_a_thread_answers_on_its_card` fails on main at the card's digits, and with only answer.js reverted at Done's "Answered". The stills state `on-me-thread-choice` shows the card. Part of #5404
With the thread drawn in the page, as on a diff's line, opening On Me took
the choice out of that thread into the card, and the paragraph after the diff
rose 212 px until On Me closed. With a margin card open, `g M` left the card
holding only the question, and its reply box, words in it, jumped. On Me's
card drew the message at the primary reader's rank, which outranks every page
drawing (`authoredHolders`, thread/messages.js). Main has the same flaw for a
question asked in words with markup: the paragraph rose 52 px.
- `HOLDS` (thread/messages.js) names each drawing's rank: the reader's view,
a margin card, a thread in the page, and a drawing aside from the
conversation. A primary reader's message part nominated with
`{aside: true}` ranks last, so it holds the message's widgets only while
nothing else shows the message. On Me's card nominates its messages that
way. `skills/leaf/references/module-annotations.md` documents the option.
- Where the widget stands outside the card, on the page or in another card,
the card answers it with the widget's choices (`choicesOf`), as a page
choice's card does. Where nothing else shows the message, the widget stands
in the card, as before.
- `authoredHolder` skips a drawing aside, since no thread opens there, so Show
reaches the page's thread without closing On Me first. That workaround in
floating-panel.js is deleted.
- `lf-options.answerWords` gives no words for a pick it can't name. A
user-added option picked in a thread choice, read while the thread is
undrawn, made Done read "Answered: No options selected"; it now reads
"Answered".
The card's description no longer claims a Done line is named by its widget's
own question: a row is named by the record's prompt, as on main.
Evidence from `leaf-dev probe`, main against this branch: a choice on a diff
line keeps the widget in the diff's thread with On Me open and the paragraph
after the diff stays at y 538, where the previous push moved it to 326; `1`
on the card picks in the thread. A question in words with markup: main moves
the paragraph from 378 to 326, this branch keeps it at 378. A margin card with
typed words and `g M`: the reply box stays at 452 and keeps its words. Show on
an anchored thread's card lands on the page's widget with On Me closed.
`test_a_choice_in_a_thread_the_page_shows_stays_there_with_on_me_open` fails
when On Me's card ranks as the reader. `tests/runtime/options-answer.test.mjs`
fails on the old answer words.
Part of #5404
leaf-agent
reviewed
Nov 15, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
Two points, both inline: the card's choices row reads where the widget sits in the DOM at paint time, and answerWords/obligationWord now scan every kept message for each obligation that isn't on the page.
… package API
The previous commit gave `parts.message` a public fourth argument,
`{aside: true}`, whose only caller is Leaf's own panel. Leaf's package interface
stays small, so the low rank now comes from the panel's runtime-only
registration instead: `registerChromeThreadPresentation`'s spec takes
`messagesAside` (typed on `YieldingSpec`), `attachPresentation` passes it to
`createPrimaryReader`, and that reader's message parts rank as `HOLDS.aside`.
The `MessageOptions` typedef, the fourth argument and the
module-annotations.md paragraph are gone. Behavior is unchanged:
`test_a_choice_in_a_thread_the_page_shows_stays_there_with_on_me_open` passes,
and fails with `messagesAside: false`.
Also rewraps the holder comment in thread/messages.js and the primary reader's
header to the wrap width.
Part of #5404
max-sixty
marked this pull request as ready for review
November 15, 2026 20:27
…ments by id On Me's card chose between showing the widget and showing its choices from where the widget stood when the panel painted. Which drawing holds a message's widgets changes without a panel paint (`settleAuthored`, thread/messages.js), as when a margin card on the thread opens or closes while On Me stands open, so the card could show both or neither until On Me repainted. The card now draws its choices wherever the widget stands, and floating-panel.css hides them while the card's own drawing of the message holds the widget. Each message drawing exposes that as `data-lf-holds`, which `HOLDS` settles, so the rule can't go stale. A message the card carries is marked `data-lf-carried`, since its widgets are not the card's. `messageHolding` walked every prepared message with a `querySelector` for each lookup. `answerWords` and `obligationWord` now reach it for a widget in an undrawn thread, once per Done row and per walk stop, so a paint cost obligations times messages. Prepared messages now record their elements by id as they are prepared, and the lookup is one map read for these callers and for anchor-placement.js and undo.js. `test_a_thread_choice_s_card_shows_the_choice_once_as_its_thread_opens_and_closes` opens On Me on an anchored thread choice, lets `m` open the thread's margin card and Escape close it, and checks that the card shows the options or its choices, exactly one, at each step. It and `test_a_choice_asked_in_a_thread_answers_on_its_card` fail without the CSS rule, where the card shows its choices beside the options. Part of #5404
leaf-agent
previously approved these changes
Nov 15, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The description says Part of #5404, which fits: this finishes its section 2 (On Me answering a thread's choice). Could it also name what's left there? That's section 1, the turn-end check asking with choices (clerk.py's ANSWER schema), and the --help clauses under "Smaller". Then the review of the last part can tell when it closes the issue.
Keyed on the held widget's own `data-lf-awaits` mark instead of the drawing's `data-lf-holds`, the rule hiding On Me's card's choices fails in Playwright Firefox 159.0 (build 1572): after `m` moves the widget out of the card, the choices stay `display: none` though the card no longer matches, so the card shows neither the options nor its choices. Chromium 158 restyles at once, and a minimal page restyles in Firefox too. The floating-panel.css comment now names that reason, and notes/browser-support.md records the gap with its recheck. `test_a_thread_choice_s_card_shows_the_choice_once_as_its_thread_opens_and_closes` now runs in Chromium and Firefox; its Firefox arm fails under the `data-lf-awaits` variant and its Chromium arm passes. The new tests no longer count the card's hidden choices, which pinned how the card hides them; they wait for the page to render and check what is visible. Part of #5404
leaf-agent
approved these changes
Nov 15, 2026
This was referenced Nov 15, 2026
Merged
test_show_from_on_me_lands_in_the_card_it_opens: On Me's Show leaves focus on body since #6056
#6081
Closed
leaf-agent
added a commit
that referenced
this pull request
Nov 16, 2026
…s, matching #6066's URLs (#6080) #6066 moved a revision's resources from `/revisions/<a>/<b>/…` to `/revisions/<identity>/…`. The write watch's stack-frame cleaner ([`tests/write_watch.js`](https://github.com/max-sixty/leaf/blob/052cfd55dc1d3cb8b0c6184cb738bbb0473a2669/tests/write_watch.js#L518)) still stripped two path segments after `revisions/`, so it also cut off `runtime/` and `vendor/`. The two allowed no-op scroll writes, `stopWhereItStands` in `runtime/arrivals.js` and CodeMirror's measure in `vendor/codemirror.*`, stopped matching `EXPECTED_SCROLLS`. Every test whose page stopped a scroll under way, or measured a scrolled editor, then failed its teardown with `unmoved scroll: … from stopWhereItStands (arrivals.js:379:7)` or `… LeafEditorView.measure (codemirror.esm.js…)`. That covered 20 of the 23 teardown errors in [run 43766062952](https://github.com/max-sixty/leaf/actions/runs/43766062952). The cleaner now strips the single identity segment, so the watch judges the same writes it did before #6066. On current `main`, `test_the_reading_keys_accumulate_and_reverse` and `test_a_tall_local_comment_survives_its_panes_scroll_behavior_and_return` fail with those teardown errors. With this change they pass, along with both browsers of `test_a_landing_that_moves_nothing_stops_a_scroll_still_under_way` and `tests/browser/test_render_write_watch.py` (which checks that a genuine `unmoved-scroll` is still reported). This fixes one of the run's causes. `test_show_from_on_me_lands_in_the_card_it_opens` is a separate regression from #6056, filed as #6081. The colour failures are fixed on `main` by #6075. Refs #3985 — automated triage Co-authored-by: leaf-agent <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Nov 16, 2026
…rawing of the message (#6083) On Me's Show on a question asked in a thread's words has left focus on `body` since #6056, instead of in the margin card it opens. The panel's reader declines an anchored thread, so the route opens the thread's margin card and travels to it (`onPage` → `scrollToThread`). Both chose their focus target through `threadFocusTarget`, which prefers the primary reader's destination, and the panel's reader still draws the message in On Me's card. So the arrival landed on that `lf-msg` (stack: `scrollToThread`'s `arrive` → `focusForNavigation`), and On Me closing then dropped the user on the page. #5039 had worked around this by closing On Me before the arrival; #6056 removed that close on the premise that a drawing aside receives no arrival, which holds for `authoredHolder` but not for this target lookup. An arrival on the page now asks `threadFocusTarget` for the page's drawings only (`page: true`): in `onPage`'s non-travel branch and in `scrollToThread`, whose three callers are all page routes in `destination.js`. That route runs only after the primary declined the thread, drew nothing for it, or is about to put its view away (`reader: "page"`), so its view is never the right target there. The early close stays deleted. Verification: `tests/browser/controls/test_focus.py::test_show_from_on_me_lands_in_the_card_it_opens` fails on current main (timeout waiting for focus in `.lf-margin-preview`) and passes here. The 86 browser tests selected by `-k "show_from or show_on or on_me or (on_panel and show) or arrival or arrives or walk_to"` pass. One of them, `test_render_floating_panel.py::test_an_arrival_the_opening_view_will_cover_puts_it_away`, errors in the teardown shift watch the same way on main without this change. `pnpm run test:runtime` and `pnpm run check:browser` pass. Closes #6081 — automated triage Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 16, 2026
…esses (#6202) When an agent's reply leaves the user a question with a short, fixed set of answers and puts nothing On Me, the turn-end check now opens the thread with those answers as an `lf-options choose` group, the way `threads.md` ("Ask for a pick") tells the agent to ask. Before, it asked in words with an obligation. A clarifying reply such as "how stale can a result get?" then answered the question, On Me moved it to Done while the decision was still open, and `1`–`9` couldn't answer it. Part 2 of the issue (On Me answering a thread's choice) landed in #6056. ## What changes - **The fork writes the choice in its message.** The fork already writes each ask's `text` as the agent's guidance has the agent write a message. It now also reads `threads.md`'s "Ask for a pick" and #6208's paragraph on HTML in a message (`clerk.GUIDANCE`), so where the agent offered answers the user picks among, the text holds the `lf-options` group, as an agent's own `leaf thread` message would. Nothing in core names the widget, and the fork's answer schema is unchanged. "Ask for a pick" now names the group's elements in its own sentence (`<lf-options id="…" choose>` holding an `<lf-option id="…">` for each answer), since the fork reads the paragraph without the example below it. - **Leaf posts the text as the agent's command does.** `_ask` checks the text as an agent's (`checked_text(..., html=True)`) and draws its HTML (`thread.drawn_markup`), and `open_thread` validates that with `check_markup` and marks the message `html`. A widget in it that asks (`thread.markup_asks`) asks the question, and otherwise the message carries an obligation, so HTML that asks nothing, such as a `<details>` quote, still leaves the question On Me. - **A refused choice is still asked.** The fork has no next attempt, so where Leaf refuses the HTML, the ask is posted again in words with `--obligation`, showing the HTML as text, and the agent's line says why. Before, a refusal reached `apply_answer`'s re-raise and the ask was lost. - **Asking again.** The fork's page facts now list every question a thread message asked and On Me no longer holds, choices included. A choice is named by the message holding it (`thread.widget_question`), the id `thread.ask_again` takes. An `again` ask goes into that question's thread and reopens it: with its choice where the text holds one, under its own id where it was first asked in words, and as a new question in words otherwise. `thread_questions` reads what a thread asks. Its words part is `obligations.questions_in_words`, which admission's `_named_question_error` now reads too, so `leaf thread reply --obligation <id>` and the fork agree on which questions a thread asks. An `again` naming anything else is refused with `unasked-obligation`, so the ask opens its own thread. - **Dedupe.** `_ask` already skipped an ask whose title matched a thread the agent opened to ask something. It now also counts a thread opened with a widget that asks (`thread.widget_asks`, through the cached `thread_context.logged_fragment`). - **The agent's line** names the question's id: the reply's own where a closed choice is asked anew in words. - **The fork's view of On Me** for a widget in a thread message used to read `decision: ` with no words. It now reads `decision in the agent's message in "<thread>": <words>`: the widget's own prompt where it has one, such as an `lf-ask` heading, and otherwise the message's text. ## Evidence `leaf-dev eval run 'turn-end-check/ask-*' --harness claude-code --repeat 3 --base`, on this branch against main with #6208 (`ed71a3cc9a`). A question label's `choice` (`fork_eval.py`, check `choices-right`) says whether the ask must be asked by a widget in its text or in words. `ask-question`, whose reply offers "the LRU cache … or the TTL cache", now expects a choice. The new `ask-choice` leaves a three-way timing question with the agent's advice ("I'd go tonight"). `ask-step` and `ask-follow-up` expect words. | case | main | this branch | |---|---|---| | ask-question (two answers, `choice: true`) | 0/3 | 3/3 | | ask-choice (three answers and advice, new) | 0/3 | 3/3 | | ask-step (a command to run, `choice: false`) | 3/3 | 3/3 | | ask-follow-up (`choice: false`) | 2/3 | 2/3 | | ask-on-me, ask-answered, ask-step-done | 3/3 each | 3/3 each | - Main's failures on `ask-question` and `ask-choice` are all `choices-right`: it asked in words, and the judge passed its wording. - Every head run of those two cases wrote a valid `lf-options choose` group with new ids, so none fell back to words. Every `ask-choice` run marked "tonight" as recommended, in the option's words rather than the tag. - No step became a choice: all six head runs of `ask-step` and `ask-follow-up` asked in words. - `ask-follow-up` fails once on each arm, on the wording faults #6079 described: a reply asked for that the agent could check itself, and the agent's inference that the flag "went to dev". - Head over main, paired by case, with 95% bootstrap intervals: fork cost 1.07× (1.03–1.11), wall time 1.14× (0.95–1.33), output 1.19× (0.91–1.46). - The prompt gains about 515 tokens (9,281 → 9,795 on `ask-answered`), the two paragraphs of `threads.md` the fork now reads. A live fork reads the conversation from the cache: over 325 live forks in 10 days, a median of 17,500 input tokens were uncached beside 257,000 cache reads. So the added prompt is about 1% of a fork's cost. - A fork that asks with a choice writes the group, about 400 more output tokens, about $0.01. It often also lists each option's case in words above the group, which the judge passed and "Ask for a pick" advises against. - This round's paid runs cost about $9: $4.90 for the forks at list price, about $3.10 for the Opus judge, and a one-run sanity check before #6208 landed. Rendered with `leaf-dev probe evals/turn-end-check/pages/reindex-staged.html --log <the fork's ask from a run> --do press:m --shot`, the thread card shows the message, then the three options with digits 1–3, and the footer reads "Your turn · 1 of 1 waiting on me · Options". ## Tests - `tests/model/test_clerk.py`: - `test_an_ask_with_listable_answers_is_a_choice_the_user_presses`: the message is `html` with no obligation, the choice is On Me, a reply in words leaves it open, and the agent's line, the next fork's On Me line and the title dedupe all hold. - `test_a_choice_leaf_refuses_is_asked_in_words`: a choice reusing a taken id is asked in words with an obligation, and the agent hears why. - `test_a_closed_choice_asked_again_with_html_leaf_refuses_is_asked_in_words`: the same refusal on a re-ask lands in words in the earlier question's thread. `ask_again` returns None where the thread can't take the question and lets an HTML refusal through, so the title check can't drop the ask. - `test_a_question_asked_again_with_listable_answers_is_a_choice_in_its_thread`, `test_a_choice_the_user_closed_is_asked_again_in_its_thread` (as a choice and in words), `test_an_ask_again_naming_a_message_that_asks_nothing_opens_its_own_thread`, `test_a_widget_in_a_message_reads_as_its_own_question`. - `dev/tests/test_evals.py`: the replay test hands an ask whose text holds a choice through the arm's Leaf and checks `choices-right`. - Ran `tests/model/test_clerk.py`, `test_thread_titles.py`, `test_thread_reading.py`, `test_obligations.py`, `interact_contract/test_admission.py`, the `unasked-obligation` cases of `test_todos.py`, and `dev/tests/test_evals.py`. ## Not verified - A live Claude Code session's fork. The evals replay constructed conversations through the real fork path. ## Calls to reverse - A refused choice is posted in words with its HTML shown as text, rather than with the HTML removed. - An `again` ask with a choice is posted as a choice in the earlier question's thread, rather than in words under the question's id. A closed choice re-asked without one becomes a new question in words in its thread. - `ask-question` now requires a choice, so base fails it by design. Closes #5404
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.
On Me's card for a choice the agent asked in a thread message (an
lf-options choosegroup in--markup) offered only Discuss and Show while thethread wasn't drawn, and
1did nothing. Once the user picked inside the thread,Done read a bare "Answered" until the thread was drawn again. The widget exists as
one instance that its message keeps, and it is in the document only while a
drawing of the message holds it (
authoredHolders, thread/messages.js).choicesOfandanswerWordslooked it up by id in the document, so they foundnothing.
How the card behaves now:
closed): the card draws the message, and the widget stands in it. With the card
focused the options show their digits,
1-9pick through the widget's owncontrols, and the pick is the same
chooseaction a pick in the thread records.The card shows no second set of choices beside the options.
card draws the message's words and answers with the widget's choices
(
choicesOf), as a page choice's card does. The widget stays in the page'sthread, so nothing on the page moves, and
1on the card picks there.its choices, and floating-panel.css hides them while the card's own drawing of
the message holds the widget (
data-lf-holdson the drawing, whichHOLDSsettles), so the card shows the options or the choices, exactly one, without
waiting for On Me to repaint. The rule reads that mark rather than asking where
the widget stands, since Firefox 159 kept the choices hidden after the widget
moved out under such a rule (recorded in notes/browser-support.md).
The mechanism:
HOLDS(thread/messages.js) names the rank of each drawing that can hold amessage's widgets: the primary reader's view, a margin card, a thread in the
page, and a drawing aside from the conversation. The panel registers its reader
with
messagesAside(runtime-only, onregisterChromeThreadPresentation'sspec), so the message parts it draws in On Me's cards rank last. The package
interface is unchanged. This also fixes main's shift for a question asked in
words with markup, where opening On Me raised the paragraph after a diff by
52 px.
authoredHolderskips a drawing aside, since no thread opens there, so Showreaches the page's thread without closing On Me first; that workaround is
deleted.
answerWordsandobligationWordread the widget's markup where its messagekeeps it while no drawing shows it (
addressableAt), so Done reads "Answered:Ship Friday" after the thread is put away and after a reload. Prepared messages
record their elements by id as they are prepared, so that lookup
(
messageHolding) is one map read rather than a walk of every message, forthese callers and for anchor-placement.js and undo.js.
lf-options.answerWordsgives no words for a pick it can't name, so auser-added option read from that copy leaves Done at "Answered" rather than
"Answered: No options selected".
and the others answer their widgets through their choices. A record's
obligation (
source.unit, such as a review's cases) still draws no message.Done rows are named by the record's prompt, as on main.
This is design A in notes/on-me-widget-cards.md, which now says so.
Evidence from
leaf-dev probe, main against this branch:FridayWait a week · Discuss" and
1picks nothing; here the card holds bothoptions, shows 1 and 2 when focused, and
1picks Ship Friday. After pickinginside the thread and closing it, Done reads "Answered" on main and "Answered:
Ship Friday" here, also after a reload.
the paragraph after the diff stays at y 538, and
1on the card picks there.g M: the reply box staysat 452 with its words, and the card offers the choices.
to 326 as On Me opens; here it stays at 378.
Tests:
test_a_choice_asked_in_a_thread_answers_on_its_cardfails on main at thecard's digits, and with only answer.js reverted at Done's "Answered".
test_a_choice_in_a_thread_the_page_shows_stays_there_with_on_me_openfails whenOn Me's card ranks as the reader (the choice moves into the card).
test_a_thread_choice_s_card_shows_the_choice_once_as_its_thread_opens_and_closesopens On Me on an anchored thread choice, lets
mopen the thread's margin card andEscape close it, and checks the card shows exactly one of the options or its choices
at each step, in Chromium and Firefox; its Firefox arm fails with the rule keyed on
the widget's
data-lf-awaitsinstead.tests/runtime/options-answer.test.mjsfails on the old answer words. The stills
state
on-me-thread-choiceshows the undrawn card.A call Max may reverse: with the thread undrawn, the card shows the widget as the
thread draws it, as full option cards with their pick marks, rather than the
compact buttons a page choice's card shows. Compact buttons there would need the
widget in the document somewhere else, or a second copy of it (design C in the
note).
Ran:
tests/browser/widgets/test_on_panel.py,tests/browser/navigation/test_on_panel.py,tests/browser/navigation/test_obligation_walk.py,tests/browser/projection/test_visual_review.py,tests/browser/projection/test_thread_replies.py,tests/browser/threads/test_targets.py,tests/browser/threads/test_agent_replies.py,tests/model/test_interact_layer.py(the stylesheet
:has()rules), the primary-reader and frozen-widgettests in
test_render_application_boundary.py, the On Me tests intest_render_floating_panel.py,test_current_location.py,test_agent_replies.py,test_card_reply.py,test_targets.py,test_key_scopes.py,test_reading_place.pyand
test_render_anchors.py;pnpm run test:runtime;pnpm run check:browser.The review verified the undrawn and drawn-thread cases in Chromium and Firefox,
at desktop and phone widths. Not verified: WebKit.
Part of #5404