Repository navigation
Sharpen what the CLI tells an agent: located findings, honest status, one output form - #889
Conversation
A render finding named an element by its own id and nothing else, so on a page with forty inline code elements "<code> is set 4px past the column" pointed at none of them. The author of a page is usually an agent that cannot see it drawn, and ids are what it wrote and what `page state` addresses content by. Seven probe sites each named elements their own way: three by own id only, three by the nearest id'd ancestor posing as the element, one crossing shadow roots. `locate.js` is now the one reading, beside `open-roots.js` and for the same reason. An element with an id reads as before; one without reads `<code> in <section id=method>`. `standalone.js` keeps a copy because it is served import-free. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…copy Three things an agent driving a page was told wrongly or not at all. `leaf status PAGE waiting` read back "waiting" while canonical activity kept showing an unanswered reader move over it, so the banner the agent believed it had set was not the one the reader saw, and nothing said so until the Stop hook refused the end of the turn. The readback now names the moves still unanswered. The wording for them had two copies, in `idle` and in the Stop hook; `activity` owns the obligations fold, so `unanswered` lives there and all three read it. Every action delivery's `handling` opened "Carry its standing state into index.html", while `authoring-revisions.md` calls that copy optional and `validation/transitions.py` says why: the runtime reconciles every standing action onto every later version. The per-delivery text is the one an agent reads each time, so it now says the log keeps the choice and the copy is optional. `viewed` in `page state` is the only reading of the reader's side between their moves, and no agent reference mentioned it. `conversation-loop.md` now does. Co-Authored-By: Claude Fable 5.1 <[email protected]>
`version check` reported "inline style width: 900px (column is 720px)" with no element or line, and two sibling findings called the same attribute "inline style #1", an ordinal the author has to count for. The parser already had the tag and line in hand where it recorded the attribute and kept only the declaration text. `inline_styles` and `attr_widths` now record tag, line and value, as `authored_widths` does, and the three findings read in the form the other static findings use: `<div style> (line 11) sets width: 900px (column is 720px)`, `<img width="900"> (line 12) exceeds column (720px)`. The contract tests held the old wording; they now hold the element and line. Co-Authored-By: Claude Fable 5.1 <[email protected]>
`leaf reply`, `leaf edit` and `version stamp` print one sentence and keep the event behind `--json`. `leaf comment`, `leaf resolve` and `leaf report` printed the raw event instead, because `cmd_comment`, `cmd_resolve` and `cmd_report` wrote it to stdout themselves. An agent opening a thread therefore had to parse the whole event to find the one id `leaf status --on`, `leaf edit --to` and `leaf resolve --to` take next. The three domain functions now return the accepted event the way `cmd_reply` does, and `cli.py` echoes `opened thread <id>`, `resolved <thread-id>` or `reported <verb> on <widget>`, with `--json` for the event. The two test helpers that exist to hand a caller the posted event ask for it with `--json`, and so do the tests that invoked these commands directly and read their stdout. Co-Authored-By: Claude Fable 5.1 <[email protected]>
`leaf page state` and `leaf conversation read` listed every unanswered reader move twice: once under `activity.interactions`, and again under `activity.obligations` as a complete second copy of the same entry. On a page holding several open moves that duplication is most of what an agent reads before it can answer one. `_conversation_activity` now names each obligation by the id of the interaction it is, and attaches the `response` address a writer needs to that interaction, so a move's phase, target and address are stated once. The scoped reading `conversation read` builds does the same. The browser wire and `activity.py`'s fold are untouched: the Stop hook, the delivery response contract, `session.py` and the website adapter all read `served_state.page.full_state` rather than this translation. `interact_support.owed` is the join a reader makes, and the tests that reached into an obligation entry use it. Co-Authored-By: Claude Fable 5.1 <[email protected]>
`leaf wait` exits 0 with a batch on stdout and 2 when stderr names an ending. `leaf ack` re-arms that same wait and threw its answer away, exiting 0 either way, so an agent running it as a background task had to parse the streams to learn whether another batch had arrived — and two host references spent a paragraph each telling it to. The status the re-arm produced is now the command's. A refused acknowledgement still exits 1 from `cmd_ack`, before the wait runs and with the cursor where it was, so the three outcomes an agent acts on are three codes. The reason the re-arm's code was dropped — that an ended or refused wait must not read as a failed acknowledgement (ad353ff) — is answered by that 1 rather than by making every ending look like delivery. `host-claude-code.md` and `codex-watcher.md` now state the codes and keep their stderr lists for which ending it was. Co-Authored-By: Claude Fable 5.1 <[email protected]>
# Conflicts: # skills/leaf/assets/registry.json
leaf-agent
left a comment
There was a problem hiding this comment.
leaf receipt is the write command the unification missed. It appends through the same append_admitted door as the other six, and it is what settles a request obligation — the same activity.obligations reading leaf status … waiting now reads back, and the one session-lifetime.md says Stop will not let a turn close over. But cmd_receipt still ends on print(json.dumps(accepted, ensure_ascii=False)) and the command carries no --json, so an agent closing a request gets back exactly the raw event this PR set out to retire.
That is what makes the rewritten docstring on test_a_command_that_succeeds_says_what_it_did assert something the suite does not hold: "Every write command answers with one sentence carrying that field." receipt is the counterexample, and this test is the one place the repo pins that form — so the record now reads as finished where it isn't, and the next reader has to rediscover the gap.
Bringing receipt in is the fix I would take: --json on the command, and a sentence naming the request it settled. Say the word and I will push it here. If it was held back deliberately — a terminal receipt has no "id the agent needs next", which is a real reason — then the inline suggestion narrows the claim to what the test proves and names the exception, so the gap stays visible.
`receipt` appends through the same door as comment, reply, edit, resolve, report and stamp, and it is what settles a request obligation, but it still printed the raw event and had no `--json`. It now says `settled request <id> as succeeded|failed`, keeps the event behind `--json`, and `cmd_receipt` returns the accepted event instead of printing it. Tests: `test_receipt_settles_one_known_request_once` holds the sentence, and the failed-retry lifecycle test now writes its failure through `leaf receipt --json` rather than appending the event directly, which holds the JSON form at the CLI boundary. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…htly tests around what #886, #889 and #892 moved (#903) `ci` on `main` went red at 7925553 (#892): [`lint` and `test` passed and the complete suite in `nightly` failed on eleven cases](https://github.com/max-sixty/leaf/actions/runs/35650845868). Five of them were #884's and #891's, both since merged, and the visual-review one is green again on today's `main`. This PR is the other six, which arrived together because three features landed between that run and the one before it and none of them was validated against the nightly selection. One is a fault in the layer. The other five are tests still standing where those features used to put things. **The comparison handle's lift is cast in `--shade`.** #892 gave `wa-comparison`'s handle `box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 20%, transparent)`. The layer states one shadow ink per scheme precisely because a hand-mixed colour can only be right about one ground — a drop shadow written for the light paper lifts a dark one by a fraction of what it promises — and `test_every_shadow_the_layer_lifts_a_box_with_is_cast_in_the_scheme_s_own_ink` is the reading that holds every elevation shadow to the token. The handle now spends it. **#889 made a finding say where it is; two assertions held the old wording.** `render-checks/locate.js` reads an element without an id as `<strong> in <lf-option id=c-bearer>` rather than as the host alone. That is the change #889 made on purpose, so the two nightly assertions that spelled the host move to the stated form. **#892 made the screenshot's checkbox a fallback; a test still pressed it.** `test_a_widgets_native_control_names_the_press_the_platform_makes` scrolls `lf-shot`'s transparent checkbox into view and presses Space on it. Since #892 the theme hides that checkbox the moment Web Awesome's comparison lands, so on the live page there is no control there to scroll to. The test now holds the bundle from outside the page through `primed`, which is what `tests/CLAUDE.md` asks for when the ordering matters — an arrangement rather than a race. It needed a page of its own to do it: `lf-diff` imports the same bundle at the top of its module, so holding it on the combined fixture left that widget unupgraded and the page never presented. The staged-control half of the test now runs on `DIFF_PAGE`, and `NATIVE_CONTROL_PAGE` goes with the split. **#886 added a thread to the gallery; a walk was counting presses to a different one.** `test_a_forced_inline_thread_keeps_its_control_inside_the_margin_budget` pressed `t` twice to walk from the gallery's first thread to the crowded suggestion's. #886's summary example anchors at `bg-thread-checkpoint`, which sits between them, so the second press landed there and the test went on to measure a card three thousand pixels from the cluster it names. The walk now goes to the thread it is for, gives up when it comes back round to one it has already stood on, and waits for each press's arrival before the next. **#892's upgrade arrives after the page says it has presented; a settled-page reading started before it.** `test_a_settled_page_with_a_standing_reaction_stops_rendering_its_margin` counts margin layouts across thirty frames on the gallery and allows one. The gallery carries an `lf-shot`, and moving its two frames into `wa-comparison` lays the margin out twice a few milliseconds apart, at whatever moment the module happens to resolve. The stamps `open_page` waits on do not cover an upgrade deliberately placed after them, so the page was still arriving when the count began. The test waits for the comparison first. ## Verification The six cases pass on this branch and five of them still fail on `main` without it; the sixth is the intermittent one, measured below. `tests/test_render_controls.py`, `tests/test_render_anchors.py`, `tests/test_render_projection.py`, `tests/test_render_margin.py` and `tests/test_render_commands.py` were run whole under `--run-nightly`, along with the everyday suite, `npm run test:runtime` and pre-commit on the changed files. <details><summary>Evidence, and what this leaves</summary> **The settled-page case is intermittent, and the hold is what names its cause.** Without the wait it went red on 2 of 12 local runs, with both layouts landing 6–13ms apart somewhere in the first 700ms of the window — 296/302, 191/197, 521/527. With the wait it is 8 of 8 green. Holding `**/vendor/webawesome.esm.js` from outside the page instead, changing nothing else, is 8 of 8 with no layouts counted at all, which is what identifies the shot's upgrade rather than the two-second heartbeat the test's docstring had assumed. **Attribution.** Each failure was placed by running the case at the commits between the two nightly runs: the margin walk passes at 10d61b2 and 2f8ee1b and fails at 965369b (#886), and `git show 965369b -- examples/developer/feature-gallery.html` is the added `bg-thread-checkpoint` paragraph and its thread. **Not in this PR.** One document change producing two margin layouts on adjacent frames is a doubled render in the thing that test exists to bound; this change waits for it rather than removing it, and whether the upgrade should lay out once is #892's question to answer. The wait itself is the third place a test names, by hand, a widget of its own fixture that is still arriving after the page said it presented — `test_margin_layout_batches_the_composed_page_without_refolding_controls` and `test_unchanged_margin_refresh_cost_is_bounded_by_refresh_count` each wait on `[data-interaction-frame]` carrying `data-interaction-ready`, and this adds `lf-shot wa-comparison`. That is one missing fact rather than three waits: a page-level stamp a deferring widget raises when it lands, which `open_page` could wait through, would settle every fixture at once. It is a change to make on its own terms rather than inside a CI repair, and until it is made the next widget to defer will redden some other test at a wait far from its cause. Separately, four nightly cases are red on today's `main` and are not from this run — `test_a_thread_beside_its_cluster_takes_the_room_to_the_visible_edge`, `test_the_margin_groups_meanings_at_one_destination_without_moving_the_page` and `test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline` in both schemes. All four pass at 7925553 and fail at 39d9cad, so they are #895's, and the run that reaches them will be that commit's own. **Environment note.** Six everyday cases and the four browser-launch cases in `tests/test_render_commands.py` fail in this CI sandbox on a clean tree as well — no `AF_UNIX`, no installed Chrome for the subprocess gate — and all of them were green in the `test` job of the run under diagnosis. </details> Co-authored-by: leaf-agent <[email protected]>
A review of Leaf from the agent's side of the API (driving
examples/review-a-planas a reader, then reading everything an agent can read about those moves) found that the write commands are sound, and that several of them told the agent too little or something untrue. This fixes the ones that needed no product decision. Each is its own commit.Findings say where they are. A render finding named an element by its own id and nothing else, so on a page with forty inline code elements
<code> is set 4px past the columnpointed at none of them. Seven probe sites each named elements their own way;render-checks/locate.jsis now the one reading, and an element without an id reads<code> in <section id=method>. On the static side,inline style width: 900pxbecomes<div style> (line 11) sets width: 900px (column is 720px): the parser had the tag and line in hand and kept only the declaration text.leaf status … waitingreads back what the page shows. It echoed "waiting" while canonical activity kept an unanswered reader move on screen, and nothing said so until the Stop hook refused the end of the turn. It now names the moves still unanswered.idle, the Stop hook andstatusshare one wording,activity.unanswered.One output form for the write commands.
comment,resolve,reportandreceiptprinted the raw event whilereply,editandstampprinted a sentence and kept JSON behind--json. All seven now do the latter, and the sentence carries the id the agent needs next (opened thread <id>,settled request <id> as succeeded).leaf ackexits as the wait it re-arms. 0 carries the next batch, 2 names an ending, 1 means the acknowledgement was refused and the cursor did not move. The old reason for always exiting 0 no longer held, since a refused acknowledgement already exits before the wait runs.host-claude-code.mdandcodex-watcher.mdlose the paragraph explaining how to read the streams instead.activity.obligationsnames interactions by id inpage stateandconversation read, instead of repeating each 18-field interaction verbatim. Only the agent-facing translation changed; the browser wire and the internal fold are untouched.Guidance. Every action delivery's
handlingopened "Carry its standing state into index.html", whichauthoring-revisions.mdcalls optional andvalidation/transitions.pyexplains: the runtime reconciles every standing action onto every later version. The per-delivery text now says so.viewed, the only reading of the reader's side between their moves, is documented inconversation-loop.md.Tests hold each behavior at the CLI boundary. The everyday suite and pre-commit pass locally; of the nightly browser files, only
test_render_gate.pyandtest_render_export.pywere run against the finding-wording change.🤖 Generated with Claude Code