Repository navigation
Say in a thread how its question ended once the agent ends it - #6051
Merged
Merged
Conversation
An agent that asks the user something in a thread with `--obligation`, hears the answer in the terminal and ends the question with `leaf task end <page> message:<id> done|dropped --text …` took it off On Me, but the thread kept reading as an open question: its last message was the question, and the "Waiting on me" beside it just disappeared. The thread's reading already held how the question ended. `end_question` (obligations.py) sets the record's status to `answered_elsewhere` or `withdrawn` and stores `--text` as `end.detail`, and the browser receives that record in `thread.obligations`. The thread card labelled a message only while its question was the user's (`next_actor === "user"`), so nothing replaced the label. Now `threadReading` (thread-card.js) gives the asking message's head the ending in On Me's words for it, from their one home (`obligationEnding`, obligations/answer.js), then the agent's `--text` in its own voice: "Answered elsewhere · Answered in the session: go ahead once Y lands." or "Withdrawn · The region list moved to the config, so this no longer applies." No event is added, `task end --text` keeps its meaning, and `task end` still posts no reply. The head is one line, and a margin card at 1280 px cuts a note of about 45 characters, so the label's span now declares its words to the preview: pointing at cut words reads them whole, and words the head shows whole preview nothing (preview.js, `beyondFace`), which also covers "Waiting on me" and "Still to do". `test_an_answer_says_what_it_leaves_while_that_stands` now ends the question with a long note and checks the head reads "Answered elsewhere · <note>" and that pointing at the cut note previews it whole. On main it fails with the label not found; with the preview declaration removed, it fails with no preview shown.
The previous commit put the ending in the message head, where "Waiting on me"
stood. The head is one line: in a margin card at 1440–1600 px it kept only
"Answered elsewh…" or a few characters of the agent's note once the time and,
on hover, the message's controls took their room, the phone kept about ten, and
the keyboard had no route to the cut words.
The ending now stands on a line of its own at the end of `.lf-msg-body`, under
the question's words, and wraps, so the whole note shows on every surface.
`messageReading` carries it as `endings`, separate from `leaves`, which goes
back to a single `Said` ("Waiting on me" or "Still to do"), and the preview on
the head's label is gone. The line is `lf-ui`, so a passage inside the message
never takes its words, and it is set in `--font-small` and `--ink-2`.
A message that re-asked several questions the agent then ended gets one line for
each, in the order the questions were asked; the `ended` map no longer keeps
only the last.
`test_an_answer_says_what_it_leaves_while_that_stands` now checks, in a margin
card at 1440x900, that the line reads "Answered elsewhere · <note>" and that
every box which clips it, up to the card, holds its words whole. It fails on
main with the line not found, and with the line set `nowrap; overflow: hidden`
it fails on the cut.
leaf-agent
reviewed
Nov 15, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The description says Closes #5804, but its Not built here section leaves the issue's second half open: the turn-end check doesn't yet catch a thread whose question later work overtook. Merging would close the issue that holds that pending decision. If the decision should stay tracked there, change this to Part of #5804 and say what's left. If it should move to its own issue, file that issue before this merges.
max-sixty
marked this pull request as ready for review
November 15, 2026 19:31
leaf-agent
approved these changes
Nov 15, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 15, 2026
#6051 added `.lf-msg-ending`, the line under a question the agent ended that says how it ended, with `var(--sp-1)`, `var(--ink-2)` and `var(--font-small)`. #6025 landed beside it and renamed every theme token to `--lf-`, so on main nothing sets those three names and all three declarations are invalid at computed-value time. The line drew in the face of whatever holds it, with no gap above it. Each PR passed its checks against a base without the other. The rule now reads `--lf-sp-1`, `--lf-ink-2` and `--lf-font-small`. No other line added since #6025 names a bare token: a sweep of `git diff a6533b5..HEAD` against the rename list in #6025's message finds only these three. ## Evidence A `.lf-msg-ending` element added to `heat-loss`'s `main` (`leaf-dev probe heat-loss --base --js …`), beside a reference element that reads the three tokens directly: | | margin-top | colour | font | | --- | --- | --- | --- | | main | 0px | `rgb(28 27 24)`, the page's ink | 17px Charter serif | | this branch | 4px | the second ink | 11.5px system-ui | The branch's values are identical to the reference element's. ## Tests Main fails three model tests on this rule. All three pass here: - `test_every_rule_of_the_interface_names_a_declared_font` and `test_every_font_size_names_a_theme_token` (`tests/model/test_interface_fonts.py`) - `test_every_token_a_sheet_reads_is_set_somewhere` (`tests/model/test_interact_layer.py`), which reports all three names on main, not only the font Also run: `tests/model/test_theme_tokens.py` (passes), and `tests/browser/threads/test_agent_replies.py -k test_an_answer_says_what_it_leaves_while_that_stands` (passes; it reads the line's text and clipping, not its style, so it passed on main too). Not checked: the line inside a real margin card. The probe placed the element in the page's `main`, which shows the rule now resolves but not what the card's own face around it looks like.
max-sixty
added a commit
that referenced
this pull request
Nov 16, 2026
…thread message later work overtook, at each turn end (#6087) Part of #5724. Closes #5804, whose first half #6051 landed. Max chose to try three new turn-end findings on replays, keeping each only if replays of the turns where it should have fired catch it, a replay of ordinary recent turns stays near today's noise, and the fork takes no longer. Two of them share one property and pass as one finding. The third, from #5401, is dropped. ## What changes `skills/leaf/references/turn-end-check.md` asks the fork for a fourth kind of finding, `overtaken`: an open thread that Leaf's thread guidance has the agent bring current. It names the two cases and leaves the rule to that guidance: - The thread's latest message, such as a question or the state of some work, has been overtaken by later work or the conversation (#5804). - The agent posted a correction as a new reply to its own unanswered one (#5724). The fork now reads two more paragraphs of the agent's own guidance (`clerk.GUIDANCE`), so its summary tells the agent how to fix the thread in the words the agent's references use: - `threads.md`: a correction to the agent's still-unanswered reply goes into that reply with `leaf thread edit`. Where the agent already posted the correction as a new reply, it now folds both into one current answer with `leaf thread summarize <page> --from <earlier-reply> --through <correction> --text "<the current answer>"`. This sentence is new, and agents read it too. - `authoring-revisions.md`: once the work a thread discusses is done, the agent replies there with the result. Of the sessions that piled replies, package-interface had lost the `threads.md` rule through compaction. agent-launch-wait first read `threads.md` 18 minutes after its pile, and triager-health (4 Nov) predates #5726, which added the rule. The fork reads the rule at every turn end either way. In `clerk.py`, `FOUND` is now the one list of kinds: `ANSWER`'s enum and `answer_form()` derive from it, so a kind can't pass validation and then miss its line in `_found`. The agent's line names the new kind "a thread of yours the user would misread". Leaf makes no edit for this kind; the agent edits, replies or summarizes itself. `guidance()` now names the reference and the opening it can't find, where it used to fail with a bare "substring not found". `fork_eval.PARTS` and the judge's rubric know the kind. Three constructed cases protect it: `overtaken-correction`, `overtaken-news` (a guardrail where the second reply is the result the first one promised) and `overtaken-question`. ## Evidence I replayed the real fork: each session's transcript cut at the row the live fork read, its pages copied as they stood then, resumed once per arm with that arm's question, at the session's effort with every tool refused. Base is main at 8f24459. **Turns from #5724 sessions where the agent left a correction beside its unanswered reply**, with this PR's wording: | Turn | Pile | `overtaken` named it | Base | |---|---|---|---| | triager-health, 4 Nov 10:43 | "I've changed my recommendation: no limit" under its unanswered case against | 2 of 2 | live fork: no | | agent-launch-wait, 11 Nov 15:41 | the merge question's description and "CI is running" both out of date after a correction reply | 1 of 1 | replay: 0 of 1; live fork (low effort): yes, as `stale` | | package-interface, 14 Nov 18:20 | "One of the three names did turn out to be confusing" under "It isn't that HTML's names confuse" | 0 of 1 (it named another thread, whose dispatched question has since finished, as `overtaken`) | live fork: no | Every pile summary in this round names `leaf thread summarize`: the three replays above that named the pile, and both `overtaken-correction` runs. In the first round, before `threads.md` named a repair, two of six pile summaries told the agent to "withdraw" or "remove" the correction, which no command does. The other four said to edit the earlier reply, which leaves the correction standing. Run through the real CLI on `overtaken-correction`'s page (a user question, a wrong reply and its correction posted with `leaf thread reply`), `leaf thread summarize --from r1 --through r2 --text …` exited 0 and folded both replies under the question. Two more corrections from the #5724 survey were no longer piles when the fork ran, because the agent had edited its first message within seconds (hover-places and red-suite-owners, 9 Nov). **Ordinary recent turns** (14–15 Nov, 10 sessions, 105k–215k context): - The wording before this one, which differed only in how it phrased the two cases, ran on 17 of the 20 turns. A separate review ran 15 of them and I ran 2. It named no `overtaken` on 15. On n08 and n19 it named a thread whose 8:30 pm launch timer the replay itself had stopped: a resumed session hears that its background tasks stopped, which a live fork never does. - Against base run hours earlier: wall time 1.13× (95% bootstrap interval 0.94–1.34), output tokens 1.12× (0.89–1.42), cost 1.04× (1.01–1.07). - The first wording, run in pairs with base on all 20 turns: base named 14 items and head 18, 2 of them the dropped `unsupported` kind. 5 of each arm's older-kind items rest on the replay artifact. `overtaken` fired 4 times. One was a thread the user had already closed, so the finding now covers only open threads. The other three were artifacts: two about a review the replay had stopped (n05, n20) and one about the timer (n09). Wall time was 1.06× (0.91–1.19). - This PR's wording adds about 1,500 characters (about 380 tokens) to every fork's question, which the cache never serves. Live forks' uncached input is a median 24,000 tokens. **Constructed cases** (`leaf-dev eval run 'turn-end-check/overtaken*' --harness claude-code`): - `overtaken-correction`: 2 of 2 with the current text. In the paired run against main, the first wording passed 2 of 2 and main 0 of 2. - `overtaken-news` and `overtaken-question`: 2 of 2 each after fixing two flaws in the cases. One had the agent promise both reruns and run one. The other's label lacked words the fork quoted. - Base named only the lede on `overtaken-question`. - `settled`, `settled-open`, `ask-follow-up` and `ask-on-me` each passed their one run on head, so the new kind didn't take their findings. ## Dropped: a section without the material it rests on (#5401) `unsupported` asked for a section reporting a finding without the wording, case, command or source it rests on, where the conversation held it. #5401's own session isn't on this machine: no transcript, page or revision holds its "Today"/"Bare fact" table. The closest real case was worktrunk-feedback on 9 Nov, where "Pre-1.0 churn: two posts cite fast releases changing behavior" went on the page while a subagent's report naming the posts was in the conversation, and Max later asked "links?". The finding missed it in 1 of 1 runs. On 4 of 24 other turns it fired, each time asking for the CI run or `.tmp` script behind a count or table. That is far more often than Max asks for material, which the #5401 survey put at about 15 of 1,200 comments. #5401 stays open. ## Calls Max may reverse - One kind covers both #5724 and #5804, since both are the agent's own thread messages reading wrong. Two kinds would let the line name each. - `overtaken` covers only open threads. - Where the pile starts at the thread's first message, as on agent-launch-wait, the fork's summary folded the agent's own question into the summary. Editing the question and folding only the replies after it keeps the question as the thread's first message. - The package-interface pile was missed in every run, so the #5724 failure is only partly caught. - `leaf thread reply` gives no advice about a pile when the reply is posted: the #5724 evidence measured that advice's precision at 13%. ## Checks - `uv run pytest tests/model/test_clerk.py dev/tests/test_evals.py`: 56 passed. - `pre-commit` on the changed files. - Replays: 71 runs of mine ($82.75 at list price, 5-minute cache writes; one arm can't read another's cache, since Claude Code appends its own context after the prompt), plus the review's 15 ($14.37). The eval runs cost about $4 more. ## Not verified - This PR's wording on ordinary turns. The wording before it, measured above, phrased the same two cases at more length. - A live session after landing. Its `turn_end_check` notes will show `overtaken` findings as they fire.
max-sixty
added a commit
that referenced
this pull request
Nov 16, 2026
…'s question end Max asked, of the Settled line #6106 put under a question the agent ended: why have this other categorization and UI, rather than marking the thread resolved? A thread's resolve already took its questions off On Me (next actor none, until it reopens). `leaf task end message:<id> done|dropped` was a second mechanism for the same end, with its own statuses (`answered_elsewhere`, `withdrawn`), an `end` record with the agent's note, a Done row and, since #6051, a line under the question. It also left the thread open. Of 215 such ends in the logs on this machine, the thread was never resolved after 108, already resolved before 47 (the end only bookkeeping), and resolved later by the user after 45. So the agent now ends a question the user answered elsewhere, a step whose effect it saw, or a question that no longer applies, by resolving its thread, after a reply saying how where the thread should record it. - `todo_end` names only a to-do; an obligation id is refused with how the obligation ends (`obligation-end`). The `answered_elsewhere` status, the obligation record's `end`, `end_question` and the thread's ending line go. A question in a resolved thread stays `open` with no next actor, lists under no Done, and a plan step naming it reads done. - The clerk tells the agent to resolve the thread of a question it put On Me that isn't the user's, and shows the fork such a question as closed unanswered. - The delivery clauses for `waiting` questions, `conversation-loop.md`, `threads.md`, `authoring-on-me.md`, `module-reading.md`, `events.md`, `task end --help` and How it works say to resolve the thread. - Protocol 45: a `todo_end` on a question that a Leaf at 44 wrote would read as nothing here, so the question would wait on the user again. The evals that asked for `task end` on a question (`settle-conversational-obligations`, `answer-settles-what-it-carried`, `assessment-surfaces-pending-decisions/settled-review`) now ask for the resolve, and `overtaken-question` in the fork eval has the user answer in the thread instead of the agent ending the question.
max-sixty
added a commit
that referenced
this pull request
Nov 16, 2026
…nd drop the agent's question end (#6106) The agent now ends a question the user answered elsewhere (or a step whose effect it saw, or a question that no longer applies) by resolving its thread, after a reply saying how where the thread should record it. `leaf task end` names only to-dos. The `answered_elsewhere` status, the obligation record's `end`, and #6051's line under the question are gone. Max asked for this: why keep a second categorization and UI when resolving the thread already takes its questions off On Me? `task end message:<id>` was that second way, and it left threads open: of 215 such ends in the logs on this machine, the thread was never resolved after 108, was already resolved before 47, and the user resolved it after 45. What to weigh: - A resolve ends every question asked in its thread before it (at most 32 of the 215 had another question there). Threads keep their closings in force (`closings`), so a later reply that reopens the thread brings none back; asking again with `--obligation <id>` or undoing the resolve does. The user's Reopen no longer restores them. - A pick the user answered in words beside a follow-up question that still stands can't be ended alone; the agent resolves and asks the follow-up again, or the user presses the pick. - A question in a resolved thread stays `open` with no next actor: no Done row (the thread is under Resolved), and a plan step naming it reads done. - Protocol 45. A Leaf at 44 writes `todo_end` on questions that this one ignores, so on pages taken to 45 those questions wait on the user again until their threads are resolved: about 20 on 12 pages in the state home here. - The delivery clauses for `waiting` questions, the clerk's line, `conversation-loop.md`, `threads.md`, `authoring-on-me.md`, `module-reading.md` and `events.md` now say to resolve. The evals that asked for `task end` ask for the resolve. Evals on Claude Code with this branch: `settle-conversational-obligations` 2/2, `answer-settles-what-it-carried` 5/6 (the miss judged the pick didn't settle a message about every prototype) and `still-asking` 4/4, `settled-review` resolved both threads 2/2 (one run missed its separate `page state` check), `turn-end-check/overtaken-question` 2/2. Not run on Codex. Ran `uv run pytest tests/model` (3,587 passed), the turn-end check's `settled` and `settled-open` cases 4/4, `pnpm run test:runtime`, `pnpm run check:browser`, and the two touched browser tests. > _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.
Part of #5804
An agent that asks the user something in a thread with
--obligation, hears the answer in the terminal and ends the question withleaf task end <page> message:<id> done|dropped --text …took it off On Me, but the thread kept reading as an open question: its last message was the question, and the "Waiting on me" beside it just disappeared.The thread now says how the question ended, on a line under the question's words:
task end … done --text "Answered in the session: go ahead once Y lands."→ Answered elsewhere · Answered in the session: go ahead once Y lands.task end … dropped --text "The region list moved to …"→ Withdrawn · The region list moved to …The first words are Leaf's (italic), from On Me's one home for them (
obligationEnding,obligations/answer.js). The note after the dot is the agent's--text(end.detail), in the agent's upright face. The line wraps, so the whole note shows. A message that re-asked several questions the agent then ended gets one line for each.How
The thread's reading already held the ending:
end_question(obligations.py) sets the record's status andend.detail, and the browser gets the record inthread.obligations.threadReading(thread-card.js) labelled a message only while its question was the user's. It now collects each ended question asked in words under the message that asked it, andmessageReadingcarries them asendings, whichMessageViewdraws as.lf-msg-endinglines at the end of.lf-msg-body.leavesstays the head's single label ("Waiting on me", "Still to do"). The line islf-ui, so a passage inside the message never takes its words. No event, no server change, andtask end --textkeeps its meaning;task endposts no reply.The line stands under the words rather than in the head, where "Waiting on me" stood, because the head is one line. Review measured that in a margin card at 1440–1600 px the head kept only "Answered elsewh…" or a few characters of the note once the time and, on hover, the message's controls took their room; the panel's wider view showed a whole note only under about 65 characters; the phone kept about ten; and the keyboard had no route to the cut words.
Not built here
The issue's second half is a thread whose question later work overtakes, which the turn-end check could catch by also reading threads. It is not built here. It changes shipped instructions and needs a
turn-end-check*eval before and after, so it goes to Max as a separate decision.Evidence
Repro from the issue, run through the CLI on a one-section page served by
leaf-dev preview --source … --base 5cc9aef6a7, main and this branch side by side: twothread create --obligationquestions, thentask end … doneon one and… droppedon the other, whose note runs to two lines. Captured light and dark in the margin card at 1440×900, the panel's thread view at 1440×900, and the phone at 390×844. On main each thread reads "Claude · 4m ago" over the open question. On this branch each shows its ending line under the question, the long note wrapped whole on every surface. A second repro, where one agent message re-asks two questions and the agent ends one done and one dropped, shows both lines under that message.test_an_answer_says_what_it_leaves_while_that_standsnow ends the question with a long note and checks, in a margin card at 1440×900, that the ending line reads "Answered elsewhere · " and that every box which clips it, up to the card, holds its words whole. On main it fails with the line not found; with the line setnowrap; overflow: hiddenit fails on the cut.Ran:
uv run pytest tests/browser/threads/test_agent_replies.py tests/browser/widgets/test_on_panel.py tests/browser/threads/test_summaries.py -k "obligation or question or leaves or asks or ends"(13 passed)uv run pytest tests/model/test_interface_fonts.py tests/model/test_interact_layer.py(178 passed)pnpm run test:runtime(982 passed), the runtime type check (tsc -p browser/types/tsconfig.json), and pre-commit on the changed filesgit merge-treeagainst #5979 (fable-work-state) adds no conflict beyond the one main already has with it (tests/browser/startup/test_activity.py). After #5979,obligationEndingreadsoutcomeandend; this change selects onend, which #5979 keeps.Checked in Chromium and Firefox at 1440 (margin card and panel, light and dark) and on a phone; not checked in WebKit.
Calls Max may reverse
obligationEndinguses before an answer, since the agent's note often holds a colon of its own.