Repository navigation
Tell agents to edit their own unanswered thread reply instead of piling corrections onto it - #5726
Conversation
The threads reference offered leaf thread edit only as a way to correct wording, while each delivery says to answer with leaf thread reply, so an agent folding a correction or a changed answer into new findings posted it as another reply. A thread then read as messages correcting one another. The reference now says that while the agent's reply is still the thread's latest and unanswered, a correction or superseding update goes into it by edit, and new replies carry news the user is waiting on. Refs #5724
leaf-agent
left a comment
There was a problem hiding this comment.
In this reference an "update" is a delivered user update you owe an answer, answered with leaf thread reply <answer.ref> (see "an update you owe" just above). "An update that changes its answer" reads as telling the agent to answer such an update by editing, and leaf thread edit takes a message id, not an answer.ref, so the update stays owed. The suggestion names the agent's own later finding instead and says a delivered update still gets its reply.
The threads reference uses 'update' for a delivered user update the agent owes an answer. The new paragraph also used it for the agent's own later finding, which read as answering an owed update by edit; an edit takes a message id, not an answer.ref, so the update would stay owed. Name the agent's finding instead, and say a delivered update still gets its reply.
|
@leaf-agent Please score this shipped instruction change with a focused before/after Leaf eval before landing it. The PR says no eval ran, while the base guidance requires scoring new or reworded rules with ambiguous behavior. Cover an unanswered correction, promised news that should remain a reply, and a later delivered update that changes the answer, using ordinary skill discovery and the delivery handling the agent sees. Add the result to the PR so the choice between edit and reply is supported by observed behavior.
|
Adds evals/correction-edits-the-standing-reply. Its default context is the correction the threads.md paragraph is for: after answering a delivered comment, the agent finds its own answer wrong while the user hasn't replied. `promised-result` is a result promised under `--todo`, and `delivered-update` the user's reply that changes the answer; the paragraph keeps both as new replies. The deliveries are real envelopes frozen by `leaf.delivery` from a scratch page, so the agent reads the handling it would see. `leaf-dev eval` could not run in the CI sandbox (nested Claude Code is not signed in), so the case's header records a hand-graded stand-in: fresh Opus 5.5 subagents reading only base's or head's skills/leaf. The correction went in by edit in 0/3 base runs and 3/3 head runs; the other two contexts passed 2/2 on both arms. Co-Authored-By: Claude <[email protected]>
|
I added the case and updated the description with the result. One caveat: The case is
The stand-in ran fresh Opus 5.5 subagents on the case's prompts. Each could read only base's or head's
All three base correction runs posted a new reply, and two of them also edited the old message into a "see below" stub. The two head contexts that should stay replies didn't drift toward editing. To get the real score, run this on a machine with both logins: |
…thread message later work overtook, at each turn end (#6087) Part of #5724. Closes #5804, whose first half #6051 landed. Max chose to try three new turn-end findings on replays, keeping each only if replays of the turns where it should have fired catch it, a replay of ordinary recent turns stays near today's noise, and the fork takes no longer. Two of them share one property and pass as one finding. The third, from #5401, is dropped. ## What changes `skills/leaf/references/turn-end-check.md` asks the fork for a fourth kind of finding, `overtaken`: an open thread that Leaf's thread guidance has the agent bring current. It names the two cases and leaves the rule to that guidance: - The thread's latest message, such as a question or the state of some work, has been overtaken by later work or the conversation (#5804). - The agent posted a correction as a new reply to its own unanswered one (#5724). The fork now reads two more paragraphs of the agent's own guidance (`clerk.GUIDANCE`), so its summary tells the agent how to fix the thread in the words the agent's references use: - `threads.md`: a correction to the agent's still-unanswered reply goes into that reply with `leaf thread edit`. Where the agent already posted the correction as a new reply, it now folds both into one current answer with `leaf thread summarize <page> --from <earlier-reply> --through <correction> --text "<the current answer>"`. This sentence is new, and agents read it too. - `authoring-revisions.md`: once the work a thread discusses is done, the agent replies there with the result. Of the sessions that piled replies, package-interface had lost the `threads.md` rule through compaction. agent-launch-wait first read `threads.md` 18 minutes after its pile, and triager-health (4 Nov) predates #5726, which added the rule. The fork reads the rule at every turn end either way. In `clerk.py`, `FOUND` is now the one list of kinds: `ANSWER`'s enum and `answer_form()` derive from it, so a kind can't pass validation and then miss its line in `_found`. The agent's line names the new kind "a thread of yours the user would misread". Leaf makes no edit for this kind; the agent edits, replies or summarizes itself. `guidance()` now names the reference and the opening it can't find, where it used to fail with a bare "substring not found". `fork_eval.PARTS` and the judge's rubric know the kind. Three constructed cases protect it: `overtaken-correction`, `overtaken-news` (a guardrail where the second reply is the result the first one promised) and `overtaken-question`. ## Evidence I replayed the real fork: each session's transcript cut at the row the live fork read, its pages copied as they stood then, resumed once per arm with that arm's question, at the session's effort with every tool refused. Base is main at 8f24459. **Turns from #5724 sessions where the agent left a correction beside its unanswered reply**, with this PR's wording: | Turn | Pile | `overtaken` named it | Base | |---|---|---|---| | triager-health, 4 Nov 10:43 | "I've changed my recommendation: no limit" under its unanswered case against | 2 of 2 | live fork: no | | agent-launch-wait, 11 Nov 15:41 | the merge question's description and "CI is running" both out of date after a correction reply | 1 of 1 | replay: 0 of 1; live fork (low effort): yes, as `stale` | | package-interface, 14 Nov 18:20 | "One of the three names did turn out to be confusing" under "It isn't that HTML's names confuse" | 0 of 1 (it named another thread, whose dispatched question has since finished, as `overtaken`) | live fork: no | Every pile summary in this round names `leaf thread summarize`: the three replays above that named the pile, and both `overtaken-correction` runs. In the first round, before `threads.md` named a repair, two of six pile summaries told the agent to "withdraw" or "remove" the correction, which no command does. The other four said to edit the earlier reply, which leaves the correction standing. Run through the real CLI on `overtaken-correction`'s page (a user question, a wrong reply and its correction posted with `leaf thread reply`), `leaf thread summarize --from r1 --through r2 --text …` exited 0 and folded both replies under the question. Two more corrections from the #5724 survey were no longer piles when the fork ran, because the agent had edited its first message within seconds (hover-places and red-suite-owners, 9 Nov). **Ordinary recent turns** (14–15 Nov, 10 sessions, 105k–215k context): - The wording before this one, which differed only in how it phrased the two cases, ran on 17 of the 20 turns. A separate review ran 15 of them and I ran 2. It named no `overtaken` on 15. On n08 and n19 it named a thread whose 8:30 pm launch timer the replay itself had stopped: a resumed session hears that its background tasks stopped, which a live fork never does. - Against base run hours earlier: wall time 1.13× (95% bootstrap interval 0.94–1.34), output tokens 1.12× (0.89–1.42), cost 1.04× (1.01–1.07). - The first wording, run in pairs with base on all 20 turns: base named 14 items and head 18, 2 of them the dropped `unsupported` kind. 5 of each arm's older-kind items rest on the replay artifact. `overtaken` fired 4 times. One was a thread the user had already closed, so the finding now covers only open threads. The other three were artifacts: two about a review the replay had stopped (n05, n20) and one about the timer (n09). Wall time was 1.06× (0.91–1.19). - This PR's wording adds about 1,500 characters (about 380 tokens) to every fork's question, which the cache never serves. Live forks' uncached input is a median 24,000 tokens. **Constructed cases** (`leaf-dev eval run 'turn-end-check/overtaken*' --harness claude-code`): - `overtaken-correction`: 2 of 2 with the current text. In the paired run against main, the first wording passed 2 of 2 and main 0 of 2. - `overtaken-news` and `overtaken-question`: 2 of 2 each after fixing two flaws in the cases. One had the agent promise both reruns and run one. The other's label lacked words the fork quoted. - Base named only the lede on `overtaken-question`. - `settled`, `settled-open`, `ask-follow-up` and `ask-on-me` each passed their one run on head, so the new kind didn't take their findings. ## Dropped: a section without the material it rests on (#5401) `unsupported` asked for a section reporting a finding without the wording, case, command or source it rests on, where the conversation held it. #5401's own session isn't on this machine: no transcript, page or revision holds its "Today"/"Bare fact" table. The closest real case was worktrunk-feedback on 9 Nov, where "Pre-1.0 churn: two posts cite fast releases changing behavior" went on the page while a subagent's report naming the posts was in the conversation, and Max later asked "links?". The finding missed it in 1 of 1 runs. On 4 of 24 other turns it fired, each time asking for the CI run or `.tmp` script behind a count or table. That is far more often than Max asks for material, which the #5401 survey put at about 15 of 1,200 comments. #5401 stays open. ## Calls Max may reverse - One kind covers both #5724 and #5804, since both are the agent's own thread messages reading wrong. Two kinds would let the line name each. - `overtaken` covers only open threads. - Where the pile starts at the thread's first message, as on agent-launch-wait, the fork's summary folded the agent's own question into the summary. Editing the question and folding only the replies after it keeps the question as the thread's first message. - The package-interface pile was missed in every run, so the #5724 failure is only partly caught. - `leaf thread reply` gives no advice about a pile when the reply is posted: the #5724 evidence measured that advice's precision at 13%. ## Checks - `uv run pytest tests/model/test_clerk.py dev/tests/test_evals.py`: 56 passed. - `pre-commit` on the changed files. - Replays: 71 runs of mine ($82.75 at list price, 5-minute cache writes; one arm can't read another's cache, since Claude Code appends its own context after the prompt), plus the review's 15 ($14.37). The eval runs cost about $4 more. ## Not verified - This PR's wording on ordinary turns. The wording before it, measured above, phrased the same two cases at more length. - A live session after landing. Its `turn_end_check` notes will show `overtaken` findings as they fire.
The threads reference presented
leaf thread editonly as a way to fix wording, while every delivery'shandlingsays to answer withleaf thread reply, and nothing told the agent that its own unanswered reply was still the thread's latest message. So a correction that also carried new findings, or an update after a later decision changed the answer, went out as another reply, and the user came back to a thread whose messages corrected one another (#5724).skills/leaf/references/threads.mdnow says, besideleaf thread edit: while your reply is still the thread's latest message and the user hasn't answered it, a correction or a later finding of the agent's own that changes its answer goes into that reply by edit; new replies are for news the user is waiting on, such as a promised result, and for answering a delivered update, which an edit does not answer. An edit already marks the messageeditedand unread, so the user still sees that the answer changed.Scored with a new case,
evals/correction-edits-the-standing-reply, which hands the agent real delivery envelopes and lets it find the guidance through the Leaf skill. Its three contexts: a correction to the agent's own unanswered reply, a result it promised under--todo, and the user's reply that changes the answer.leaf-dev evalcan't run in the CI sandbox, because the nested Claude Code isn't signed in, so the numbers below are a stand-in: fresh Opus 5.5 subagents given the case's prompts and only base's or head'sskills/leaf, graded by hand against the case's rubrics.uv run leaf-dev eval 'correction-edits-the-standing-reply*' --harness both --base --repeat 3gives the real score on a machine with both logins.The issue's other two options are left open: advice from
leaf thread replywhen the thread's latest message is the agent's own unanswered reply, and asummary_hintor page-state advisory for a run of agent messages. The second would also cover the issue's expectation that a long run is folded before the user returns, which this change does not.Refs #5724 — automated triage