Repository navigation
Wait for the anchor tests' comments to reach the log before reading it - #812
Conversation
Five tests in tests/test_render_anchors.py used the passage mark as their evidence that a browser-sent comment had reached the event log. The mark is the optimistic paint, drawn in the turn the gesture is sent, before the log answers, so the durable read behind it could answer with the page's opening note. Enclose each submit in sending(), which waits for that gesture's own send to enter the wire and complete its trip.
leaf-agent
left a comment
There was a problem hiding this comment.
tests/test_render_anchors.py still has four comment submits that read past an unenclosed gesture, so the rule this PR states for the file — a browser-sent comment that later work depends on is enclosed in sending — does not yet hold across it. Each is a page.keyboard.press("ControlOrMeta+Enter") followed by a bare round_trip(page):
test_a_manifest_diff_can_comment_on_one_unloaded_file, and the second submit intest_a_data_bound_diff_aims_and_selects_one_source_line, then readsent_events(serve.page_dir)and assert on the anchors it holds. That is a one-shot read ofevents.jsonlbehind the press — the shape that raisedStopIterationin the nightly this PR fixes. Lose the race andcommentsis[], which fails the equality assertion rather than the wait.test_a_selection_of_the_whole_page_still_finds_its_passageasserts the quote is not detached on "the pass that runs after the send", which its own comment names as the pass that would have thrown. If the trip is over before the post exists, that pass has not run and the assertion reads the optimistic paint, which is never detached — green without the behaviour the test names.- The first submit in the same data-bound diff test reads only rendered state, but carries the same shape.
tests/CLAUDE.md states the rule under A state the page passes through is not a state to poll for: "Read the event log only after round_trip, and read the event a gesture just made through sending; the runtime posts behind the press the driver has already returned from, so a trip waited on without sending can be over before the gesture's own post exists."
All four are the same one-line change as the five in the diff, so I am enclosing them on this branch rather than leaving the file half-stated.
The bare press(); round_trip(page) pairing also appears three times in tests/test_render_aim.py. Same shape, outside this PR's file, so left alone.
Four submits in `tests/test_render_anchors.py` pressed ControlOrMeta+Enter and then waited on a bare `round_trip(page)`. `tests/CLAUDE.md` names that as the wait that proves nothing: the runtime posts behind the press the driver has already returned from, so the trip can be over before the gesture's own post exists. Two of them read `events.jsonl` through `sent_events` immediately behind it and assert on the anchors it holds — the same one-shot log read that raised `StopIteration` in the nightly, failing on an empty list instead of on the wait. A third asserts a quote is not detached on the pass that runs after the send; with the post not yet made, that pass has not run and the assertion reads the optimistic paint, which is never detached. `sending` already covers all four, so the file now holds one rule rather than two.
|
@leaf-agent The race analysis holds — That makes the body's claim "A scan of the file finds no submit left outside it" false, and this repo squash-merges with the PR body as the commit message, so the claim lands on main verbatim. Either cover that site or narrow the claim. Note that
|
`test_the_captured_quote_is_prose_a_file_can_hold` waited on `.lf-thread` counting one, which the optimistic paint answers: `conversationForAttempt` renders an unresolved comment as a thread under a `pending:` identity, so the card stands on the refusal path the test's docstring describes as well as on the path where the server accepts. The test's subject is the durable fact — the server writing the 400-character quote to a UTF-8 file — so it now waits for the identity the response replaced that one with, or the offline notice, and reads the quote back out of `events.jsonl`. That read is new; the test never touched the file before. `sending` is not the helper here: the failure it guards against is a request failure the outbox retries rather than settles, so `round_trip` would sit out its whole deadline instead of reporting what the reader was told. `tests/CLAUDE.md` states the general rule beside the one it already carries for a container the runtime keeps whether or not it holds anything.
|
Covered, and you were right about the helper as well.
The claim in the body was false, so I rewrote the body rather than narrowing it: the rule the file now states is that a browser-sent comment whose result later work reads waits for the server's answer before that read — nine sites through I also put the general rule in Bug-backA sleeping
|
The panel's status and the All pages list show an agent's working line
(the `--text` of `leaf task start` or of an ephemeral reply), and the
user reads it at a glance. Of 1,413 such lines on the maintainer's pages
over the last two weeks (rough regex counts), 29% ran past 80
characters, about 7% carried commit hashes or CI mechanics ("Waiting for
current-head CI and review on #17 ddc2cc5c"), and about 5% were to-do
titles in the imperative ("Delete the width eval case"), which read as
asking the user to do it.
`skills/leaf/references/conversation-loop.md`, "When to write", now says
who reads the line and where, and asks for a few of the user's words:
not a to-do's title, and no commit hashes, ids or CI mechanics. Both
references also drop "under your name", since the panel no longer puts
the agent's name in front of its line (#4325).
## Score
`evals/work-names-its-item` gains a to-do with an imperative title, a CI
wait on a named commit and run, and a `line-reads-at-a-glance` metric.
| | before | after |
|---|---|---|
| `line-reads-at-a-glance`, Claude Code | 0/3 | 3/3 |
| `line-reads-at-a-glance`, Codex | 0/3 | 3/3 |
| `judgment` (existing), both harnesses | 6/6 | 6/6 |
Before the rule, every run named the CI run number or the commit hash
while waiting ("Waiting on CI run 18233 for PR #812 (head 9c41d2ab)"),
and Codex's lines ran to about 80 characters. After it, they read
"waiting for the rollout fix to pass its checks". Neither arm copied the
to-do's imperative title, so the eval doesn't measure that clause; the
evidence for it is the page survey.
> _This was written by Claude Code on behalf of max-sixty_
Co-authored-by: Claude Opus 5.5 <[email protected]>
… choice the user presses (#6220) A ready pull request now reaches the user as a choice they press ("Merge #812" / "Hold off for now") rather than a message telling them to run `/merge-pr` and reply. The turn-end check's reference named "a merge waiting on the user's approval" as a step asked in words, and an agent's "Merging is yours: run `/merge-pr`" read to the fork as a command for the user. On 44 real pages since 2026-11-01, none of 88 merge or landing asks was a choice (72 by the fork, 16 by agents), and 17 of the 21 the user answered in words said "yes" or the merge command. The rule now lives once, in a new paragraph of `conversation-loop.md` ("The On lists") that the fork reads through `clerk.GUIDANCE`: an action the agent takes once the user agrees is a permission, asked as options, even where the user could start it with a command they'd type to the agent; an action only the user can take is a step, asked in words. `turn-end-check.md` drops its copy of the step rule and adds that the fork marks an option recommended only where the agent advised it, since early runs marked "Merge" recommended unprompted. **Evidence** (Claude Code fork, 3 runs per arm): the new `ask-permission` case, Max's closeout cut down, is asked as a choice 0/3 on main, 0/3 with only the merge example deleted, and 6/6 here. `ask-step`, a command only the user can run, stays in words 3/3. `ask-follow-up` passes 6/9 here against 7/9 on main, failing on both arms on the #6079 wording faults. `closeout-asks-take-their-route` now requires landings as options; both arms pass 3/3. Runs cost about $10. **To weigh:** a step whose report has listable answers ("Works" / "Still broken") still asks for a reply in words; that is a separate call this PR leaves alone. Asked for by Max in a comment on a Leaf page. Tests: `tests/model/test_clerk.py`, `dev/tests/test_evals.py`, `test_product_page.py`, `test_interact_layer.py`. > _This was written by Claude Code on behalf of max-sixty_
The sentence in authoring-on-me.md's "Make each question self-contained" told the agent to name work by what it does "rather than by its number". Max wants the number kept, since it is how the user finds the pull request, with words beside it that say what the work is. The sentence now asks for that, with "Merging #431, the retry for dropped uploads" as its title example, and moves to the end of the paragraph, after what a question mainly holds, since he still found it prefatory where it stood. The naming rubrics now let an option cite a number its ask's title describes, as "Merge #812" under "Merging #812, the LRU result cache", since the card gives the number its context. Evals (Claude Code, this tree, 3 runs a case): fork asks name the work 6/6, items-right 27/27, guardrails 9/9. The agent's merge ask after a compaction titles every thread with both, as "Merging #1211, the badge on notes waiting to sync", but in each run still mentions #1204 in passing without saying what it is, so names scores 0/3. The page-sections case names 1/3. A version whose example was a passing mention ("#431, the retry for dropped uploads", not a bare "#431") raised sections to 2/3 but titled merge asks "Merging #1211" in 3/3, so the title example stays. About $14 of runs.
nightlyon main failed in run 35389883602 withStopIterationfromtest_a_removed_subject_keeps_its_conversation_open_and_detached: the test read the event log for the comment it had just sent, and the log held only the page's openingnote. Ten comment submits intests/test_render_anchors.pyread past a gesture whose own send nothing waited for — five behind the passage mark, four behind a bareround_trip(page), and one behind the thread card the page paints optimistically. None is evidence that the comment reached the log. The file now states one rule: a browser-sent comment whose result later work reads waits for the server's answer before that read.Why none of the three waits proves the comment landed
page.wait_for_function("() => (CSS.highlights.get('lf-mark')?.size ?? 0) > 0")is satisfied by the runtime's own unresolved ledger, so it returns while the POST is still in the wire.CLAUDE.md's cross-runtime invariants state it directly — "Every forward gesture whose semantic result the page can draw is on screen in the turn that sends it, before the log answers" — andsending's comment intests/render_harness.pyalready names this failure shape: a log read behind an unenclosed gesture "answers with whatever stood last — the page's opening note, or the gesture before this one … and it holds it only on a machine slow enough to lose the race". CI'snightlyunder-n 2was that machine.round_trip(page)fails for the reason stated above the helper: the press reaches the runtime inside the driver's call and posts behind it, so a post the gesture has not issued yet is not pending and the trip is over before it begins.The thread card is the same invariant in its conversation form.
conversationForAttemptinskills/leaf/assets/runtime/pending/model.jsrenders an unresolved comment as a thread under apending:identity, so.lf-threadcounts one the turn the comment is sent — on the path where the server refuses it as well as the path where it accepts.What changed
Nine sites are enclosed in
sending, the helper the file already uses for exactly this. Of the five behind the passage mark, one reads the log immediately — that is the failing test, and the read that raisedStopIteration. The other four order a revision stamp against the same in-flight POST, and one of those goes on to read the log behind the stamp. The four behind a bareround_trip(page)are the same defect in the diff and whole-page cases: two of them readsent_events(serve.page_dir)and assert on the anchors it holds, which loses the race as an equality failure on an empty list rather than as a timeout.The tenth,
test_the_captured_quote_is_prose_a_file_can_hold, takes the rule without the helper. Its stated subject is the durable fact — the server accepting the 400-character quote and writing it to a UTF-8 file — and the failure it guards against is a request failure the outbox retries rather than settles, soround_tripinsidesendingwould sit out its whole deadline instead of reporting what the reader was told. It waits instead on the identity the server gave the card (.lf-thread:not([data-id^="pending:"]), the idiomtests/test_render_drafts.pyalready uses) or the offline notice, and then reads the quote back out ofevents.jsonlthrough Python's UTF-8 decoder — the reader a half character has no bytes for. That read is new: the test never touched the file before, which is how the one site whose subject is the durable fact was also the one with no durable read.A scan of the file for comment submits —
ControlOrMeta+Enter,.lf-compose-submit, and the threads'Send— finds each one either enclosed insendingor followed by that settled-card wait. The scan also cleared the neighbouring files: the mark waits intest_render_navigation.pyandtest_render_pages.pyfollow comments written bypost_eventor the CLI, which are durable before the browser opens, andtests/test_render_drafts.pyalready callsround_trip(page)before its stamp for this reason.Verification
With the event POST held three seconds behind a
page.routehandler, the failing test's body raises the sameStopIterationas it stood, and passes enclosed. Holding the capped-quote test's POST open behind theheld_eventsfixture, the wait as it stood returns on the pending card and the log read comes back empty; the settled-card wait does not return while the request is held.tests/test_render_anchors.pypasses whole under--run-nightly.The everyday suite runs 1137 passed / 5 failed in the agent sandbox; all five reproduce unchanged on this branch's merge base and are the sandbox's own conditions rather than the suite's — three
OSError: [Errno 30] Read-only file systemunder/tmpintest_interact_session.py, the umask mode check intest_interact_layer.py, andtest_live_shell_artifact.py, which needs the website dependencies. None is in the changed file; CI runs the everyday gate for real.Deterministic reproductions
A scratch parametrisation of the failing test's body, holding the POST behind the paint:
[False](the body as it stood) fails atnext(...)withStopIteration;[True](the submit enclosed insending) passes. A second scratch check confirmed the premise from the other side: with the POST held open by theheld_eventsfixture, the mark wait returns whileevents_model.read_events(page_dir)holds['note']— nocommentat all, which is exactly the shape CI reported.The capped-quote site needs
held_eventsrather than a sleeping route, because the sync driver runs a route handler on the thread the page is driven from: atime.sleepthere freezes the paint the race depends on, and both arms pass. Held open, and parametrised over the old and new waits:[False]is the defect: the wait returned,.lf-threadcounted one, and the log held no comment.[True]is the repair: the wait does not return while the server has not answered.