Repository navigation
End a question the user answered elsewhere by resolving its thread, and drop the agent's question end - #6106
Merged
Merged
Conversation
…d shows #6051 put a line under a thread question the agent ended with `leaf task end <page> message:<id> done --text …`: *Answered elsewhere* · <note>. Two things read wrong on real pages. The word repeated the note. Of 114 distinct notes agents wrote ending a question `done` across the pages on this machine, 53 begin "Answered…", as the instructions' `--text "<where the answer is>"` invites, so the thread read "Answered elsewhere · Answered in chat with /merge-pr." The word also claimed more than Leaf knows. `done` records a question the user answered elsewhere, and equally a step the agent asked for and saw take effect (`leaf task end --help`), and agents also end questions the user settled on the page. Notes such as "The staging build ran clean for an hour", "You ran /merge-pr in the terminal; #5805 merged" or "Picked A, full lines" read as false under "Answered elsewhere". An ended question now reads *Settled* · <note>, the word Leaf already shows for a decision the agent acted on (`lf-options` "Settled: Ship Friday"), and the shipped instructions' own phrase for this act ("an On Me item the user settled elsewhere"). *Withdrawn* · <note> is unchanged. A fresh review of the first candidate, Done, found it read as "landed" under "Run /merge-pr to land it, or tell me what to change first" when the user's answer was a change, and repeated the heading of On Me's Done list. On Me's Done card showed only "Answered elsewhere", so the user had to open the thread to learn how a question ended. `obligations/answer.js` now holds both forms: `obligationOutcome`, the word, which a folded Done row shows so its question keeps the row's width, and `obligationEnding`, the word and the note, which the opened Done card, a place's preview and the thread line show. The thread card drops its own copy of the composition. The served status keeps its name, `answered_elsewhere`; #5979 replaces the status with `outcome` and `end`, and this change reads only the browser's word. Checked with `leaf-dev probe --base` on a page with four questions (settled after a chat answer, settled after a step, withdrawn with a note, settled with no note) at 1440×900: each margin card, On Me's Done rows, and an opened Done card. `tests/runtime/obligation-ending.test.mjs` holds the words and their voices, and fails on main. Ran `pnpm run test:runtime`, `pnpm run check:browser`, `test_an_answer_says_what_it_leaves_while_that_stands`, and pre-commit on the changed files.
leaf-agent
previously approved these changes
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.
leaf-agent
reviewed
Nov 16, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The new obligation-end refusal builds the message to resolve from the obligation id, which is only right for message:<id>. A question asked by a widget frozen in a thread has thread set (so in_thread is true) but an id of widget:<unit> or widget:<owner>:<unit>, so leaf task end <page> widget:x done now tells the agent to run leaf thread resolve <page> x, naming a widget where thread_addressed expects a message, and the agent's next attempt fails too. That is the case the old waiting delivery clause steered the agent to task end, so an agent working from an earlier reading will meet it. The record already carries the asking message in item["message"]; passing it through fixes both kinds.
Review found that a later plain reply, which reopens a resolved thread, put the question the agent had ended back On Me (the fold read only whether the thread stood resolved now). A closing still in force after the message now asking a question now ends it, so only asking it again under its id (`--obligation <id>`) or taking the resolve back brings it back. The user's Reopen no longer restores the questions their resolve ended. Threads keep their closings in force (`closings`), server-side like `closures`. The clerk shows the fork such a question as closed, by whoever the thread stands resolved by, rather than "unanswered", since the agent now resolves when the user answered elsewhere.
…ended pick as waiting Review found two more ways a question the agent ended came back: the user's first message after the resolve answered it, putting it in the delivery's `settled` and in Done, and a frozen pick it ended still read as waiting in the next delivery. Only an answer before the first closing in force after the asking message now counts, and `waiting` skips a pick nobody owes a move on.
…end refusal A frozen widget's id is not a message id, and a bound record's names its owner and unit, so the refusal names the message the record carries.
leaf-agent
approved these changes
Nov 16, 2026
This was referenced Nov 16, 2026
max-sixty
pushed a commit
that referenced
this pull request
Nov 16, 2026
…rowth journey (#6185) `test_the_envelope_stops_growing_with_the_thread` has failed since #6106, which removed the agent's way of ending a question (`todo_end` on `widget:wN` is now refused) and directs it to resolve the question's thread instead. The journey still ended each answered pick with `task end`, so admission raised `EventRefused` on the first turn. It now resolves the thread with `thread.cmd_resolve`, as the delivery tells the agent to; the user's next reply reopens it. What the test protects — a delivery's thread digest staying flat across 30 exchanges, with the opening message kept and 52 elided — is unchanged. Run by node id, the test fails on `main` (`f1b367375`) with the refusal and passes with this change; the file's other two tests also pass. Closes #6174 — automated triage Co-authored-by: leaf-agent <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Nov 17, 2026
…moved No behavior changes; each line now describes the current code. - The obligation statuses and the agent's way of ending a question the user answered elsewhere (`docs/how-it-works.html`, `lf-tabs.js`): #6106 removed the `answered_elsewhere` status, so the agent resolves the question's thread. - `relabel` pointers in `state.css`, `defaults.css` and a journey's docstring: #6134 deleted the function, and control-labels.js holds the markers' contract. - The served-state schema told a package to ask `quietSince`, which #6134 un-exported; packages read `readWork`'s `quiet`. - `application.js` said a registry entry names the thread-surface widgets; `thread/surfaces.js` asks every module's element for `threadOutlets`. - The render check's description in `how-it-works.html` named Chrome and both colour schemes; it reads one light page in the reader's browser. - `presence.py` named `full_state` as what spreads presence into the state answer; `read_served_page` does. - `text-document.css` pointed at the removed `inRuns`; restore the bullet list `aimableAt`'s doc lost in a rewrap; drop a contradicted comment in `thread-workflow.test.mjs`.
This was referenced Nov 17, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 17, 2026
…moved (#6268) Comments and docs that still describe code recent changes removed, found by the nightly review of the last two days' commits. No behavior changes: each edited line now says what the current code does, so the next reader isn't sent after a function, status or export that no longer exists. - **Ending a question answered elsewhere** — `docs/how-it-works.html` still listed an "answered elsewhere" obligation status and said the agent "records" such an answer; `lf-tabs.js` had a comment to the same effect. #6106 removed that status: the agent resolves the question's thread (the `src/leaf/obligations.py` header). - **`relabel`** — `browser/state.css`, `packages/default/defaults.css` and a docstring in `tests/journeys/test_render_commands.py` pointed at it; #6134 deleted it, and `control-labels.js` holds the markers' contract. - **`quietSince`** — the served-state schema (`state.schema.json`, `working_grace_ms`) told packages to ask it, but #6134 took it off `widget-api.js`; packages read `readWork`'s `quiet`. - **Thread surfaces** — `application.js` said a registry entry names the widgets with `threadOutlets`; `thread/surfaces.js` asks every module's element. - **Render check** — `how-it-works.html` said `page check --render` opens Chrome in both colour schemes; it reads one light page in the reader's browser (`render_gate/command.py`, `user_engine`). - Smaller: `presence.py` named `full_state` where `read_served_page` spreads presence; `text-document.css` cited the removed `inRuns`; `aimableAt`'s doc list in `widget-elements.js` had been reflowed into one paragraph; a comment in `thread-workflow.test.mjs` contradicted a test below it. Checked: `tests/runtime/thread-workflow.test.mjs` and `tests/model/test_product_page.py` pass, `leaf-dev generate record-types --check` is clean, ruff passes. The glossary's Obligation row (`.claude/skills/developing-leaf/references/glossary.md`) has the same stale "answered elsewhere" sentence; it's agent instructions, so it's left for a separate change that needs the control-plane owner's approval. --------- Co-authored-by: leaf-agent <[email protected]>
max-sixty
pushed a commit
that referenced
this pull request
Nov 18, 2026
… by resolving its thread (#6269) The glossary's **Obligation** row still says "the agent records an answer given elsewhere". #6106 removed that path — the `answered_elsewhere` status and the agent's question end — so the agent now ends a thread question the user answered elsewhere by resolving its thread (the `src/leaf/obligations.py` header; `todos.py` refuses the old end with `obligation-end`). This one-sentence correction brings the row in line, so a session reading the vocabulary isn't pointed at a command that refuses. It's an agent-instruction file, so it needs the control-plane owner's approval; the same stale wording in `docs/how-it-works.html` and `lf-tabs.js` is corrected in #6268. No score was run: per `AGENTS.md`, correcting a fact needs none. Co-authored-by: leaf-agent <[email protected]> Co-authored-by: leaf-agent <[email protected]>
max-sixty
added a commit
that referenced
this pull request
Nov 21, 2026
567 commits on main, 50 conflicted files. What the merge decided where the two sides met: - main ends a question the agent asked by any resolve of its thread (#6106, `closings`) and deleted the agent's question end. The branch keeps its own rule beside it, that the user's resolve settles nothing the agent owes (`answered_by`, `owed_turns`): one ends what the user owes, the other what the agent owes. `obligations` loses `end_question`, `ended_as` and the answered-elsewhere ending; a question a resolve ended stands `waiting` with no next actor, and a plan step naming it reads done. - main deleted Leaf's working fork and `holding.py` (#6574). `activity` drops the fork holder, agent turns and `agent_holds`; the line fork's On it (`served_state.work.lined`) reaches the fold as `on_it`, so a waiting update a progress message came after reads `running`. - main's `start_holds` (#6593) replaces the branch's turn-only start rule in `_start_age`, `in_hand` and the Stop hook, and `Turn.busy` (#6334) replaces `Turn.background`. - The neighbor row moved to `LivePage` in the schema and keeps the branch's fields; its record format moves to 53, the current protocol. - `threadRecord` (main's kept reading) takes the branch's obligation-record attention and to-dos as obligations. - Tests take main's fixtures (`lf-group`, `selected`, thread markup in the message text) with the branch's fields. Scenario S12 ends its question by resolving the thread, and the liveness scenario no longer re-dates the harness's `busy` after a start, which `start_holds` reads.
max-sixty
added a commit
that referenced
this pull request
Nov 21, 2026
The review bot's finding on the merge: root AGENTS.md now keeps a decision's date and what it replaced in the commit message. `standing.py`'s header drops the list of vocabularies it replaced, `owed_turns` the date of the user's choice, and `standing.answered` an ending #6106 removed.
This was referenced Nov 22, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 23, 2026
…6710) The served state named where work stands in thirteen enumerations: a delivery stage, a failure condition and its operation, a to-do's state, a plan step's, an obligation's status, a thread's attention, the page's activity kind and seven counts. `waiting` meant the user's turn on the page and the agent's in a thread. Every obligation record, every update's delivery, every to-do, every plan step, each thread and the page now say it in the same fields: `next_actor`, `state` (`waiting`, `running`, `blocked`, `done`), the `reason` a state leaves out, and how a done one ended (`outcome`). This answers the entry "Make tasks and work in progress clear" in `notes/TODO.md`. This is the first of two pull requests, split at Max's request. Here a to-do keeps its own served list and takes the new fields; #5979, on top of this one, makes a to-do an obligation record and deletes that list. ## Where to look - `src/leaf/standing.py` is the contract: the vocabulary, which record speaks for a place, and what a job that outlives a turn is (whatever holds an item's start other than the turn that wrote it). - `src/leaf/activity.py` is the one producer of `running` and `blocked`, for each delivery, each update's record, each to-do and the page. The page reads the agent's side of all of it beside `presence` (here, away, gone, closed). - `src/leaf/served_state/state.schema.json` loses `Stage`, `Attention`, a workflow's `condition` and `at_work`, `Obligation.status`, `Activity.kind` and a plan step's `owner`, and gains `WorkState`, `WorkReason` and `Outcome`. - In the browser, `thread/workflow.js` words every standing and `activity-words.js` the page's. ## A thread the user resolves Two rules, both from a week of Max's own use: on the 13 pages he used that week, 63 threads were resolved over a message the agent had not answered, 50 of them within four seconds of sending. By my reading 39 ask for work or an answer and 24 close the exchange. - The request stays owed (`events.owed_turns`). The user's resolve takes a thread off their list and settles nothing the agent owes in it: the message keeps its record and its place on the agent's list and holds the Stop hook. The agent's own resolve still answers for a thread. This stands beside #6106, under which either side's resolve ends the questions the agent asked there. - The thread stays closed until someone reopens it (`thread.post_reply`, a reply's `unannounced`). What the agent says in a thread the user resolved goes into it without reopening it, the status line announces none of it (`announces` in `thread/model.js`, which `isNews` reads too), and the reply's record says so (`stays-closed`), since the user's resolve reaches the agent only where it retires a question the agent asked. `leaf thread reopen` is the agent's choice to bring the thread back, with the `unresolve` event the user's Reopen writes. `threads.md` gives the goal and no rule: the user closed the thread, so it returns only for news they would want to stop and read, such as that the agent could not do what they asked. A question to the user there reopens it by itself. A Codex turn's final message prints its agent nothing, so the turn's handling has it post such news by command. Max picked both halves: the answer leaves the thread closed, and bringing it back is the agent's call (root `AGENTS.md`, "Leaf's role"). What follows: when this lands, each session still holding a page is asked to answer the old messages its user resolved this way, among them `/gpk` and `/dispatch` commands. A logged user `resolve` takes a new meaning, a `reply` gains a field and an `unresolve` may be the agent's, so the page protocol moves from 53 to 54; the plan-outline work in #6707 also takes 54, so whichever lands second moves to 55. ## What users see differently The research note's scenarios S1–S15, built as real logs with 62 checkpoints, ran on `main` and here; their builders have left the tree since and are at d986f9c. The words on every surface are identical at 40. At 11 the live words change: the 5 where the panel and the thread contradict each other about the same work, an update the agent started whose turn then ended with nothing watching (the panel now asks for a nudge), a dialog open in the agent's own window (the thread says Waiting in the terminal), and the 4 where the user resolved a thread before the agent answered. At 11 only the Done list changes: at 10 a request answered with a promise no longer reads Answered while its to-do is open, and at 1 the request the user resolved is listed as Answered once the agent answers it in the closed thread. A to-do whose start stopped or went quiet keeps the line it last said under Stopped or Gone quiet, and the receipt word Up next is gone. ## A preview fix that rides along A pointer moved onto a control whose face redraws within the preview's 200 ms dwell got no preview until it left and came back: the `pointerover` the browser sends for the new node under the resting pointer cancelled the dwell, whatever had arrived (`preview.js`). The dwell now ends only when another target arrives under the pointer, or the pointer carries a press. This pull request's `test` job met it in the feature gallery's journey, which the change edits. On Linux a margin entry's centre lies on the edge of its icon's stroke, and the innermost node there flips between the icon's `svg` and its `path` as the entry repaints. The journey failed in 5 of 13 Linux runs of this branch and in none of 15 of `main` and #6762. Six traced copies of the step in the Linux job, [on this branch](https://github.com/max-sixty/leaf/actions/runs/45268635289) and [on `main`](https://github.com/max-sixty/leaf/actions/runs/45268643151), showed the dwell armed on the `svg` and cleared 6 and 9 ms later in the two that failed; they did not show why the `svg` comes first more often on this branch. [With the fix](https://github.com/max-sixty/leaf/actions/runs/45273513465) all six show the preview, four of them through a redraw that cancelled it before. `test_a_target_redrawn_under_the_pointer_that_came_to_it_still_previews` holds the fix in Chromium and Firefox and fails in both without it. ## What it costs - The public package API changes: an obligation record has `state`, `reason`, `outcome` and `answered` in place of `status`, and a thread's `attention` is a record or a to-do. `lf-deck`, `lf-tabs` and the feature gallery are updated. - A to-do in `leaf page state` says where it stands in the new fields, and `conversation-loop.md` teaches that reading. - The row record moves to format 54 with the protocol, so a page served by an older Leaf and one served by this do not list each other. - 133 files, +4,989 −2,732, and the code is no smaller. Python and JavaScript outside tests gain 125 lines of code, of which #5979 removes 76, and 92 decision points, 56 of them in `activity.py` and `activity-words.js`, which decide and word the liveness cases above. `canonical_activity` goes from 278 lines and 61 decision points to 298 and 82. Tests are +2,189 −1,212, and the new eval case is 709 lines. What shrinks is the contract: across the stack the schema's enumerations for where work stands go from 12, with 43 values, to 6 with 22. ## Checks - Evals, Claude Code against `main`'s instructions, three samples a case on the 22 cases whose tags cover the changed passages: 55 of 66 pass on the stack's text and 54 of 66 on `main`'s, and no case differs by more than one sample. `resolved-request-stays-owed`, new here, passes 10 of 10. After Max's call that the agent decides when a resolved thread comes back, that case ran again, five samples a variant: given a request it cannot carry out, 5 of 5 agents reopen the thread, both where the delivery shows it resolved and where only the reply's record does, against 0 of 5 under the rule before, where only a question reopened it; an answer that delivers what was asked leaves it closed 5 of 5 in each. On Codex, 5 of 5 turns post such a request by command, against 0 of 5 with the rule only in `harness-codex.md`, and 5 of 5 leave an ordinary answer to the final message. The suite read the stack's final wording; the wording of the to-do reading that only this pull request carries has no score of its own. - The Claude Code agent journey, which the change to `hooks/claude-code.ts` calls for, passes every step. Its `withdrawn` step changed: a resolve that changes nothing the agent owes reaches no hook here, so the step takes the comment back. - `tests/model`, `dev/tests/model`, `tests/smoke`, the runtime's Node tests and `pnpm run check` pass here. [A manual dispatch](https://github.com/max-sixty/leaf/actions/runs/44976806053) of every product test, on Linux and macOS, ran on the unsplit branch as it stood before the closed-thread rule was widened. 25 tests failed, 2 because of this change, and both are fixed: one passes under the rule as it now stands, and the other, the Undo row's age, assumed the user's resolve leaves nothing owed, so its fixture now has the agent answer first. The other 23 fail without this change: in `main`'s nightly run or another branch's full run on 21 November (9), on `main` until #6713 and #6717 (5), on `main` today, run there by name (7), or on macOS only (2). [A second dispatch](https://github.com/max-sixty/leaf/actions/runs/44996782669), of this branch beside [`main`'s own](https://github.com/max-sixty/leaf/actions/runs/44989336653), failed no test on Linux that `main`'s run passed. On macOS it failed six that `main`'s run passed, and none of the six fails in six runs by name on this tree on a Mac; `main`'s macOS job failed four that this branch's passed. - `test_an_exact_workflow_reports_stale_work_beside_a_live_page_claim`, a journey test this change edits, has failed on `main` since #6796, whose checks never ran it: its helper now opens threads in the panel, and the test goes on to read a card. Here it chooses cards again first. Max asked for this as one of the long-stuck design questions. No person has read it. Codex reviewed the model and the first resolve rule, the review bot the unsplit pull request and this one, and fresh agents the 21 November merge with `main`, the closed-thread rule and the agent's reopen; their findings are fixed. > _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.
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 endnames only to-dos. Theanswered_elsewherestatus, the obligation record'send, 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:
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.openwith no next actor: no Done row (the thread is under Resolved), and a plan step naming it reads done.todo_endon 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.waitingquestions, the clerk's line,conversation-loop.md,threads.md,authoring-on-me.md,module-reading.mdandevents.mdnow say to resolve. The evals that asked fortask endask for the resolve.Evals on Claude Code with this branch:
settle-conversational-obligations2/2,answer-settles-what-it-carried5/6 (the miss judged the pick didn't settle a message about every prototype) andstill-asking4/4,settled-reviewresolved both threads 2/2 (one run missed its separatepage statecheck),turn-end-check/overtaken-question2/2. Not run on Codex.Ran
uv run pytest tests/model(3,587 passed), the turn-end check'ssettledandsettled-opencases 4/4,pnpm run test:runtime,pnpm run check:browser, and the two touched browser tests.