Repository navigation
Make a to-do an obligation record - #5979
Conversation
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 its counts), and `waiting` meant the user's turn on the page and the agent's in a thread. `standing.py` is now the one contract: every obligation record, every update's delivery, every plan step, each thread and the page say `next_actor`, `state` (waiting, running, blocked, done), the `reason` a state leaves out and how a done one ended (`outcome`). A to-do is an obligation record whose source is the agent's own promise, so the lists, a thread's attention and a plan step read one inventory, and `activity.py` is the one producer of `running` and `blocked`. Removed: `Stage`, `Todo`, `TodoRow`, `DoneRow`, `Attention`, a workflow's `condition` and `at_work`, `Obligation.status`, `Activity.kind`, `held`, `dropped` and `awaiting`, the seven counts by stage, a plan step's `owner`, and the `todos` key of `leaf page state`. Behavior that changed, each held by a test: - An update the agent started whose turn was then seen to end reads blocked and stopped (it read Gone quiet), and counts as stranded, so an away page asks for a nudge over it. - A to-do whose start stopped or went quiet reads blocked and keeps the line it last said (it read Still to do with no line). - The stopped or quiet reading applies to every delivery serving an owed record, and a start on one input covers the record's other inputs, which read Delivered. - A dialog in the agent's own window makes the page, and what that turn has in hand, blocked with reason `terminal`; the thread says Waiting in the terminal. - A reply that promises work publishes no answered update record, so Done does not list the request as Answered while its to-do is open. - A harness-queued update's receipt reads Queued for <agent>; the receipt word Up next is gone. - A forked waiting input reads running. - A goal's progress counts the steps that ended done, so a failed to-do no longer counts; a plan step carries its item's reason. - With nothing in hand, the page says a stranded update's own reason and dates it by the turn's ending. `tests/work_scenarios.py` builds the scenarios of `notes/what-needs-you/research.md` as real logs, and `tests/model/test_work_scenarios.py` holds their 62 readings to the schema. The stills helper that opens the agent's list matched On Me; it now matches the agent's tab. The row record moves to format 43. No protocol bump.
leaf-agent
left a comment
There was a problem hiding this comment.
Under the old schema a package could ask whether an obligation was answered by reading one field, status === "answered". Now it has to know that the answer stands only when state === "done" && outcome === "done" && end === null, where end === null separates the user's own answer from an end the agent recorded. That rule is now written four times: standing.answered in Python, a private answered in framework/application.js, lf-deck's closed, and the feature gallery's hasAnswer. The third clause is the easy one to drop. A package that checks only outcome === "done" will treat an obligation the agent ended as answered elsewhere as if the user had answered it, and no check reports that. Either export the predicate from the package API beside answeredInWords, or keep a field on the record that says it, so packages read the rule rather than restate it (root AGENTS.md, "Fix the underlying issue": "a caller repeating its callee's rule").
…rule The rule that a done record was answered (it ended done and the agent recorded no end of its own) stood in `standing.answered`, in the publisher, in `lf-deck` and in the feature gallery. Every served obligation record now carries the result as `answered`, and those three browser readers take the field. A package that dropped the rule's last clause would have read a question the agent ended as answered elsewhere as one the user answered.
…ot run The pull request's gate runs a later-tier test only when its own body changed, so five kept readers of removed fields: a row's `activity.kind`, an obligation's `status` in three page scripts, and one wait the migration had replaced with a round trip, which read the page before it applied the server's answer. A start whose turn was seen to end reads Stopped beside its message, where the test expected Gone quiet.
…ad four words A reason has its own word on screen, such as Stopped or Gone quiet, so a reader meets about fifteen of Leaf's words, as before. The header claimed four.
The user's resolve took a request the agent had not answered off the ledger: no record, no receipt, no Stop-hook hold, and no way for the answer back to the thread. The user resolves to tidy their own list, often seconds after asking, and the result of the work then never returned to where they asked for it. They chose on 2026-11-14 that the request stays. `events.owed_turns` is the rule. The user's own resolve settles nothing the agent owes in the thread. Every other closing answers for it: the agent's own resolve, and the user's answer on a widget whose `resolves` names the thread. From such a closing until the thread reopens, nothing in it is owed (`answered_by`), so the user closing a thread the agent already closed revives nothing. Behavior that changed, each held by a test: - A message the agent has not answered keeps its record, its workflow and its place on the agent's list through the user's resolve; the Stop hook holds for it, its delivery carries `answer`, and the reply that answers it reopens the thread. - A pick the agent owes a reply, made on a widget in a thread message, stays owed the same way. - A page obligation the thread is about stays off On Me while the agent owes the thread an answer, resolved or not. - A summary cannot fold the request the agent still owes in a resolved thread. - Such a resolve changes nothing the agent owes, so admission gives it no attention and it is not delivered. One that retires a question the agent asked still is. - A harness failure that lands in a thread the user already resolved is handed back to them; resolving over a failure they already have retires it, for a frozen pick as for a message. - The refusal that names a resolution names only the agent's. `awaits_agent` is deleted; its two callers read `owed_turns`. The `resolve` handling clause and `threads.md` tell the agent that what it owes stays owed and that it closes a thread that asks nothing itself. Scenario S3 now has the agent answer the resolved request where it had to open a to-do by hand.
main's fork work (#5961) reads an agent's own turn in `activity`. Its additions are threaded through the branch's standing fold: `_stand_workflows` and `_stand_todos` take the running agent turns, an update an agent's running turn holds is in hand for that turn, and each owed answer names its `holder`. The fork's ending reads a to-do by the obligation record it now is, and three fork tests read `state` and `reason` where they read `stage`, `kind` and `running`.
main's one reading of who holds each thread (#6005) replaces the fold's own composition. The standing fold takes it as `holding`: the running agent turns and each owed answer's holder come from it, and a waiting update a fork has taken on reads `running` from `Holding.forked`, which presence no longer carries. A start on a to-do reads the to-do's thread from the obligation record it now is.
…amps from files.py (#6039) This is the weekly duplicate sweep of `src/leaf/` and `hooks/` (ISO week 46). It moves four capabilities that were implemented more than once to one home each, and moves every caller. Behavior does not change. Every replaced copy computed the same result as the home it now calls. - **Applying non-overlapping `(start, end, text)` edits to a source.** The new home is `structure.splice`, which is `revision_delivery._spliced` moved and generalised to str or bytes. It replaces five copies: - `revision_delivery._spliced`, from #3313, removed. - The reverse-slice loop in `revision_artifact.bind_imports`, from #1280. - The loop in `structure.rewrite_attribute_references`, from #1658. - The loop in `leaf_dev.docs.compose`, from #2660. - The loop in `leaf_dev.arrangement_eval`, from #4629. The four reverse-slice loops copied the whole source once per edit. Each of them applies edits that don't overlap and don't start at the same offset, so splicing them in one pass gives the same output. - **The file name of a stamped version.** `live_shell` wrote `f"v{version}.html"` inline, from #666. It now calls `files.version_name`. - **Whether a note stamps a revision.** `validation/source_history.py` scanned for the note inline, from fe4e8ea. It now calls `files.stamped_version`, which was added in the same commit. - **The `sha256:` digest of a revision's HTML.** `revision_artifact._capture_artifact` hashed `document.data` again, from #666. It now reads `SourceDocument.digest`, from #606, which holds the same value. I left `compose_document`'s two-insertion loop in `revision_delivery.py` alone. `splice` orders edits at the same offset by their text, but that loop relies on list order when `<html>` and `<head>` are both implicit. **Verification.** `ruff` and `ty` pass on the touched files. These model tests pass: `test_module_url_delivery`, `test_revision_delivery`, `test_live_shell_artifact`, `test_product_page`, `test_interact_document`, `test_interact_anchors` and `test_interact_layer`, 626 tests in all. In `dev/tests/model/test_product_page.py`, the second case of `test_a_composed_part_refuses_an_authored_copy` fails at `assert slot in authored`, before `compose` runs. Its fixture string expects `<img` followed by `alt="Sandbox` at 16 spaces of indentation, and `docs/index.html` on `main` now indents that line by 18. The failure is in the test's fixture, not in this change. <details><summary>Sets found but not consolidated here</summary> Another open pull request already changes each of these: - **Claude Code and Codex config homes, and the inline-delivery opening, repeated in `leaf_dev`.** #6014 moves them onto `harness.claude_code_config`, `harness.codex_home` and `hook_transport.INLINE_OPENING`. - **`hooks._awaits_agent` repeats `holding.running_turns`.** #6032 rewrites `running_turns`. - **The "N user updates with no answer" sentence**, written in both `activity.unanswered` and the `page-open-owes` finding. `activity.py`, `findings.py` and `session.py` are all being changed in #5979, #6018 and #6032. - **Raster magic bytes**, read in both `media._UPLOAD_TYPES` and `revision_delivery.media_size`. `media.py` is being changed in #6014. These are not worth a shared helper, because they are one-line stdlib idioms or the copies differ in meaning: - `json.dumps(..., sort_keys=True)` used as a cache key. - Compact `json.dumps` with `separators=(",", ":")`. - The `script_kind(...) in {"module", "classic"}` membership test. - `lock_is_held(page_dir / SERVER_LOCK)`. - Inline closed-object JSON schemas. **Not consolidated, needs a separate look.** `sample_content._non_json_number` repeats `http.reject_json_constant`. The real question is where Leaf refuses non-finite numbers. The HTTP path refuses NaN and numbers past a double's range. Sample fixtures refuse only NaN and infinity. No other reader of event JSON in `src/leaf/` passes `parse_constant`. Sharing the helper would change the `sample-json` message without settling that question, so it is left out of this PR. </details> Co-authored-by: leaf-agent <[email protected]>
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 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 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 and `end.detail`, and the browser gets the record in `thread.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, and `messageReading` carries them as `endings`, which `MessageView` draws as `.lf-msg-ending` lines at the end of `.lf-msg-body`. `leaves` stays the head's single label ("Waiting on me", "Still to do"). The line is `lf-ui`, so a passage inside the message never takes its words. No event, no server change, and `task end --text` keeps its meaning; `task end` posts 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 5cc9aef`, main and this branch side by side: two `thread create --obligation` questions, then `task end … done` on one and `… dropped` on 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_stands` now ends the question with a long note and checks, in a margin card at 1440×900, that the ending line reads "Answered elsewhere · <note>" 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 set `nowrap; overflow: hidden` it 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 files `git merge-tree` against #5979 (`fable-work-state`) adds no conflict beyond the one main already has with it (`tests/browser/startup/test_activity.py`). After #5979, `obligationEnding` reads `outcome` and `end`; this change selects on `end`, 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 - " · " joins the ending and the note, as a thread's preview joins its parts, rather than the colon `obligationEnding` uses before an answer, since the agent's note often holds a colon of its own. - Each line under a message that re-asked several questions doesn't name its question; the agent's note carries that context. - On Me's Done card for an ended question still shows only the ending, without the note.
…6368) Removes two runtime fields nothing reads and corrects comments that no longer describe the code, from the nightly sweep. No behavior changes. The On Me press the floating panel's field offers at rest no longer carries `stands`. `notifications.js` calls `stands()` only on notices posted through `offerNotice`, which never posts this press, and `pageOffer` already decides when it stands. The panel types the press as `NoticePress` without `stands`. The latest-version control's label is now null while the control isn't offered. Before, the label was the placeholder "New page available → open v999", which nothing showed: `version.js` offers the control only after a failed save or when the page is behind, and the panel prints `latest.label` only after a failed save. `projection/data.js` writes and removes `data-lf-source` and `data-lf-source-revision` through `PAGE_PAINT_ATTRIBUTE.source` and `.sourceRevision`, which every other writer uses, instead of string literals. Comments: since #6344 the sample's "quoted" note is only a pseudo-element, and full view reserves height for no label (`sample.css`, `lf-sample.js`). The reading package's serifs are chosen for their x-height, not "a large `height`". The panel's voice decision no longer carries a date. Not in this PR: `pageStatus` in `activity-words.js` repeats the agent-name rule that `semantic-state.js` owns (`agentName`). Because of that, an empty `agent` string would make the resting line read " awaits". Draft #5979 rewrites those lines, so the fix waits until it lands. The dates in that file's resting-line comment wait for the same reason. Verified with `pnpm run check` and `pnpm run test:runtime` (1012 pass), plus the two browser tests that exercise the latest control's label: `test_news_under_the_open_menu_moves_nothing_in_it` and `test_a_failed_save_is_an_error_until_the_next_valid_one`. Co-authored-by: leaf-agent <[email protected]>
…re-exports of them (#6366) `browser/runtime/shadow.js` re-exported sixteen helpers that `browser/runtime/shadow-tree.js` owns (`under`, `upFrom`, `renderedUnder`, `renderedOrder`, `renderedOrdering`, `byRenderedOrder`, `hostIn`, `composedParentNode`, `renderedParent`, `shadowHost`, `excludedByInert`, `overIn`, `SAID`, `UI_MARKS`, `uiInside`, `inUi`). This PR deletes those re-exports and points every import of them in `browser/` and `tests/runtime/` at `shadow-tree.js`, including `widget-api.js`'s public `under`. Now `shadow.js` keeps only its own exports. Why: `browser/AGENTS.md` ("One answer for each question") names `shadow-tree.js` as the owner of these helpers, but callers were split between the two import paths (for example, 23 imported `under` through `shadow.js` and 7 imported it directly). Importing through `shadow.js` also pulled `registry.js` and `arrivals.js` into modules that need neither. No package imports `shadow.js`. Verification: `pnpm run check` passes; it includes `test:runtime`, 1050/1050 on the head merged with current `main`. Pre-commit passes on the changed files, including eslint, prettier, dependency-cruiser and knip (unused exports and import cycles). A grep finds no import from `shadow.js` that names a shadow-tree helper. Behavior is unchanged, so no new test. Open PRs #6008, #5981 and #5979 touch some of these files; each overlap is a one-line import change. --------- Co-authored-by: leaf-agent <[email protected]> Co-authored-by: leaf-agent <[email protected]>
Rewrites the root `AGENTS.md` so a reader who has only the file can
parse each sentence on the first read. Below "Repository map" no rule
changes: pronouns give way to their nouns, a rule is split from its
mechanism and its reason, and Tend and the server's "reading" are
defined where they first appear. "Keep the layer open" now defines a
content widget, says what core code may not do, and limits the rule
against naming widgets to Leaf's own instructions (`SKILL.md`, its
references, and the entries in `browser/registry.json` and the kernel
registry), leaving a package's guidance free to name any widget, as the
maintainer decided. The defects a review reports in instruction text
become a list, with a new item for a sentence its reader can parse only
on a second read, and Tend's review threshold names that list instead of
the label "public surface traps". In the maintainer's sections above
"Repository map", only the three readings the maintainer picked change:
when Leaf adds code to prevent a failure ("Leaf's role"), that contract
prose may be edited for clarity ("Stage"), and that the code making a
change records it ("Responsiveness").
**To weigh:** Fresh readers given only the file flagged 60 and 72 of
about 250 sentences as needing a second read on `main`; on this branch
two readers of the draft flagged 31 each and a reader of the final text
28, none unsettled. Below "Repository map" that is 41 and 53 down to 13,
13 and 8. Most of what remains sits in the maintainer's sections, whose
proposed rewrite (9 flags in one read) waits on the maintainer. Asked
ten questions about rules the rewrite touched, fresh agents given only
the old file said it left the question open in 6 of 30 answers, and
given the new file in none; every new-file answer matched the code.
Codex compared old and new for changed rules and false claims, and its
eight findings on the first draft are fixed. The file grows from 5,538
to about 6,270 words, since a sentence that names its noun and splits
off its reason is longer. A full-file rewrite conflicts with the open
drafts that edit this file (#6023, #6024, #5979, #5970); it leaves the
`hooks/` line that #6574 edits alone.
Asked by max-sixty, who picked the three readings on the survey page; he
hasn't read this diff. Prose only; pre-commit passes.
> _This was written by Claude Code on behalf of max-sixty_
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.
leaf-agent
left a comment
There was a problem hiding this comment.
Two docstrings date a decision and describe what it replaced. Root AGENTS.md, "Where instructions live", puts both in the commit message: "Text in the tree, comments, tests and eval cases included, says what holds now rather than how it came to be. The date of a decision or change, … and the versions before it go in the commit message." The standing.py sentence lists the ten vocabularies this header replaced, and owed_turns dates the user's choice. The decision and the alternative it rejects can stay in owed_turns, since a header states those. The suggestions drop only the history.
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.
A fresh agent reviewed the merge with main (521ec2b). - `dev/tests/process/test_website_server.py`: the journey profile's fixture still gave the old activity words, so the test failed once main's fix let it run that far. - A waiting update a line fork's line stands after counted both as worked on and as awaiting delivery, so an All pages row said both of one message. `unseen` now counts what no turn has taken in and nothing is at work on. - Prose the merge left wrong: `events.md` said a reply restores the questions a resolve ended; `session-lifetime.md` named a page state `working`; the glossary and `workflow.js` gave On it to a fork that takes an update on, which #6574 removed; How it works still listed Up next, Conditions and an obligation's status; `queues.js` and `todos.py` each cited something gone. - The hooks module's process test and the on-lists eval fixture carry the fields the served state now has.
…nswers it Max picked this on 21 November over the rule built on 14 November, under which the answer reopened the thread. His own week of use showed why: of 63 threads he resolved over a message the agent had not answered, 50 were resolved within four seconds of sending, a last word and then Resolve. He is done with the thread, not with the request, so the request stays owed and its answer goes into the thread without bringing it back to his lists. `events._answers_closed` is the rule: a reply that answers (`is_answer`) in a thread standing closed by the user's own resolve does not resume it. Anything else the agent says there reopens it, as any spoken reply does, and a question the answer asks reaches the user on On Me while the thread stays under Resolved. A logged user `resolve` now means something an earlier Leaf at 53 would read differently, so the page protocol moves to 54, and the row record this branch reshaped takes `since=54` with it. Behavior changed in tests: an answer at its `answer.ref` in a thread the user closed leaves `resolved` as the user's, and a later plain message reopens it. Scenario S3's last checkpoint is the only one of the 62 whose words change.
… the status line Three findings from the review of #6710. The page's activity counted an update no turn had taken in twice: among the answers waiting or blocked, and again as `unseen`. The All pages row said both, so one undelivered update read "1 response owed on updates awaiting delivery" beside "1 response owed", or past the pickup grace "owed on updates that stopped", which an undelivered update hasn't done. `canonical_activity` now counts each owed answer once: as `unseen` where no turn has taken its update in and nothing is at work on it, else by where its update stands. The counts `main` serves are disjoint too. The status line announced the agent's words in a thread the user had resolved, which the reply's own record and `isNews` both say go unannounced: `unreadContent` read every unread version, whatever its thread. `announces` in thread/model.js now owns that only an open thread announces its words, and `isNews` and the status line's news both read it. A version waiting unread in a resolved thread is no longer recorded as seen, so it is news when the agent's `leaf thread reopen` brings the thread back. This also holds for a thread the agent resolved over its own unread words: the status line stays quiet about them, as the panel's dot already did. `module-annotations.md` still gave a receipt's shape as `{id, subject, stage, detail}`. `progressFace` reads `state` and `seen`, so a package following the reference drew no progress face.
`test_stop_guard.py` and `test_todos.py` held an update no turn had taken in as `waiting: 1` beside `unseen: 1`, the overlap the last commit removed. Each now holds it counted once, as `unseen`.
`test_stop_guard.py` and `test_todos.py` held an update no turn had taken in as `waiting: 1` beside `unseen: 1`, the overlap the last commit removed. Each now holds it counted once, as `unseen`.
…ad's card `test_an_exact_workflow_reports_stale_work_beside_a_live_page_claim` ends by pressing the comment's margin marker and reading the card that opens beside the passage. Since #6796, `open_panel_thread` chooses the panel for threads about a passage, so the press opened the thread in the panel and the card never came: the test fails every time on main too, where #6796's own checks never ran it. It now chooses cards again after closing the panel, as #6796 did in `test_widget_actions.py`. No behavior changes.
…ad's card `test_an_exact_workflow_reports_stale_work_beside_a_live_page_claim` ends by pressing the comment's margin marker and reading the card that opens beside the passage. Since #6796, `open_panel_thread` chooses the panel for threads about a passage, so the press opened the thread in the panel and the card never came: the test fails every time on main too, where #6796's own checks never ran it. It now chooses cards again after closing the panel, as #6796 did in `test_widget_actions.py`. No behavior changes.
A pointer the user moves onto a target reads it after a 200 ms dwell. A `pointerover` the browser sends while the pointer rests cancelled that dwell whatever stood under the pointer afterwards, and nothing armed it again. So where only the node under the pointer changed, inside the target the pointer had just come to, the preview never showed until the pointer left and came back. The dwell now ends only when another target arrives under the resting pointer, or the pointer carries a press. What arrives under a pointer the user hasn't moved still shows nothing. A margin entry meets this in CI. On Linux an 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` whenever the entry repaints. `test_the_feature_gallery_exercises _its_core_journeys` hovers the Inspect projection entry and failed there in 5 of 13 Linux runs of this branch on 23 November, and in none of 15 runs of main and of #6762. A traced copy of the step in CI's test job showed why: in both failing copies the pointer's arrival on the `svg` armed the dwell and a resting `pointerover` on the `path`, 6 and 9 ms later, cleared it. Where the first node was the `path`, the same flips came after the preview showed. The trace did not show why the `svg` is the first node more often on this branch than on main: the DOM under the entry is the same in both and does not change. `test_a_target_redrawn_under_the_pointer_that_came_to_it_still_previews` holds the behaviour in Chromium and Firefox, and fails in both without the change.
A pointer the user moves onto a target reads it after a 200 ms dwell. A `pointerover` the browser sends while the pointer rests cancelled that dwell whatever stood under the pointer afterwards, and nothing armed it again. So where only the node under the pointer changed, inside the target the pointer had just come to, the preview never showed until the pointer left and came back. The dwell now ends only when another target arrives under the resting pointer, or the pointer carries a press. What arrives under a pointer the user hasn't moved still shows nothing. A margin entry meets this in CI. On Linux an 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` whenever the entry repaints. `test_the_feature_gallery_exercises _its_core_journeys` hovers the Inspect projection entry and failed there in 5 of 13 Linux runs of this branch on 23 November, and in none of 15 runs of main and of #6762. A traced copy of the step in CI's test job showed why: in both failing copies the pointer's arrival on the `svg` armed the dwell and a resting `pointerover` on the `path`, 6 and 9 ms later, cleared it. Where the first node was the `path`, the same flips came after the preview showed. The trace did not show why the `svg` is the first node more often on this branch than on main: the DOM under the entry is the same in both and does not change. `test_a_target_redrawn_under_the_pointer_that_came_to_it_still_previews` holds the behaviour in Chromium and Firefox, and fails in both without the change.
…ocked answers truly Two findings from the review of the merge with main on 23 November. A line fork's progress line could hide a stopped update. One reply answers every input a record holds, so a start standing on one of them covers the rest (`_stand_workflows`). The set of covered records took every `running` item, including one that reads `running` only because a progress message came after it (`on_it`). So where a turn took in a message and ended without answering, and a line then stood after a newer message of that thread, the older message read `waiting` again and its thread stopped saying Stopped. Only an item a start holds covers its record now, as the docstring says and as `forks.py` promises of the line. The hover over a page in All pages said "owed on updates that stopped" for every `blocked` answer. `blocked` also holds an update gone quiet and one whose turn waits on a dialog in the agent's window (`terminal`). The second counted as being worked on before this branch, and here the hover contradicted "Approval needed in the terminal" beside it. The phrase is now "held up", which is true of each reason; the row and the thread still say which.
…ocked answers truly Two findings from the review of the merge with main on 23 November. A line fork's progress line could hide a stopped update. One reply answers every input a record holds, so a start standing on one of them covers the rest (`_stand_workflows`). The set of covered records took every `running` item, including one that reads `running` only because a progress message came after it (`on_it`). So where a turn took in a message and ended without answering, and a line then stood after a newer message of that thread, the older message read `waiting` again and its thread stopped saying Stopped. Only an item a start holds covers its record now, as the docstring says and as `forks.py` promises of the line. The hover over a page in All pages said "owed on updates that stopped" for every `blocked` answer. `blocked` also holds an update gone quiet and one whose turn waits on a dialog in the agent's window (`terminal`). The second counted as being worked on before this branch, and here the hover contradicted "Approval needed in the terminal" beside it. The phrase is now "held up", which is true of each reason; the row and the thread still say which.
…end check to the Claude Code contract, and name when to read the user's window (#6906) Five rules that `conversation-loop.md` or `threads.md` repeated from another reference now point at the rule's home, the paragraph on Claude Code's turn-end check moves out of "The On lists", which every harness reads, into `harness-claude-code.md`, and `SKILL.md` names when to open `conversation-loop.md` for the window the user reads the page in. A Codex or Pi session reads 241 fewer words; a Claude Code session reads 6 more. What the diff doesn't show: - **Two of the copies were wrong.** `conversation-loop.md` sent every harness to "your harness's Replies" for the `writer: "turn"` route, a section only `harness-codex.md` has. Its list of when `leaf page close` refuses left out an unread worker's report and a page error, which `page-checkpoints.md` and the command's help both name. - **One home gains a condition.** "The On lists" now says to resolve a question's thread if nothing else in it waits on the user. Only the copy in `threads.md` said so. - **The `SKILL.md` line repairs a failure that main has.** Asked what width the user reads at, an agent opened `page-checkpoints.md`, found the render check's desktop size, and said Leaf records no window. `user-view-context` passed 3 of 8 on main and 3 of 8 on this branch before the line, and in both arms the three passes were the three runs that opened `conversation-loop.md`. With the line, 8 of 8 opened it and passed. - **The moves score level with main**, Claude Code, 3 runs a case: 13 other cases covering the edited passages pass 34 of 39 on main and 33 of 39 here. The one-run difference is in `thread-choice-takes-a-press`, on a rubric about prose that repeats the options, which fails most runs in both arms and which no run opened an edited file for. Only four of the cases had runs that opened an edited reference, and all of those runs passed in both arms, so the scores rule out a large regression and not a small one. - **Three copies the survey called movable stay as they are**, since each tells its reader something at the point of use: `threads.md`'s "A promise declared `--done` reads as finished work", beside the three flags a replier picks among; `event-batches.md`'s `leaf page open` line, which is the step itself after every batch; and the paragraph of "The On lists" on a reply that leaves a question standing, which holds the `settled` field and an example its home lacks and already ends in a pointer. - **It merges cleanly with #6710 and #5979**, the two open drafts that edit the same files (`git merge-tree` against each head as of 23 November). max-sixty chose these moves from the session's Leaf page, which carries this account; the `SKILL.md` line is this session's addition. An independent reader checked every pointer against its home and found no fact lost. Tests: `tests/model/test_interact_layer.py` and `tests/model/test_clerk.py`, the tests that read the skill's files. > _This was written by Claude Code on behalf of max-sixty_
…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_
Main's work-state vocabulary (#6710) and to-dos as obligation records (#5979) meet this branch's plan. A heading now reads the standing of the records its steps name as any place holding several does (standing.leading), and once none is open, done or failed; a to-do step's detail is its record's end. Main took the protocol to 54, so this branch's change to the plan event takes 55.
A to-do becomes an obligation record whose source is the agent's own promise (
source.kindtodo), so the On lists, a thread's attention and a plan step read one inventory, and the servedtodoslist goes. This is the second of two pull requests, split at Max's request: #6710, which landed first, put every record, to-do and surface in one vocabulary for where work stands, and this one removes the last separate list.No word on any surface changes: scenarios S1–S15, built as real logs, read the same at all 62 checkpoints before and after this change. Their builders have left the tree since and are at d986f9c. The page protocol stays at 54, since no logged event or stored record changes.
What does change:
leaf page statehas notodoskey; a to-do is inobligations, its title asprompt.textand the start in force on it asline.conversation-loop.md, "The On lists", teaches that reading. The eval suite scored this wording:on-lists-read-todo-records, which reads the lists from that output, passes 3 of 3, within 55 of 66 across the 22 cases around the changed passages against 54 of 66 onmain's instructions.readObligations().allincludes the agent's to-dos.src/leaf/served_state/state.schema.jsonlosesTodo,TodoRowandDoneRow, and the browser's publisher (framework/application.js) joins every list row to an obligation record, a to-do's included.51 files, +436 −620; outside tests and evals +347 −499 in 37 files.
Max asked for this as one of the long-stuck design questions. No person has read it.
tests/model,dev/tests/model,tests/smoke, the runtime's Node tests andpnpm run checkpass here, and ten later-tier tests that exercise to-dos in the browser passed by name on #6710's tree.