Skip to content

Catch a correction posted beside the agent's unanswered reply, and a thread message later work overtook, at each turn end - #6087

Merged
max-sixty merged 2 commits into
mainfrom
grind/turn-end-findings
Nov 16, 2026
Merged

max-sixty merged 2 commits into
mainfrom
grind/turn-end-findings

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

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 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

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.

…thread message later work overtook, at each turn end

The turn-end check gains a fourth finding, `overtaken`: an open thread whose
agent messages the user would misread, because later work overtook its latest
message (#5804) or because the agent added a reply correcting its own unanswered
one instead of editing it (#5724). The fork now also reads the agent's guidance
for both (threads.md on editing an unanswered reply, authoring-revisions.md on
replying once the work is done), which long sessions lose through compaction.

Replayed on the real fork: it caught the pile in two of three of Max's #5724
sessions (4 of 4 runs and 1 of 1 with this wording) and missed the third (0 of
3), where main's check named it in 0 of 1 replays and 1 of 4 live forks. On 20
recent turns, paired with main, its one false finding was a thread the user had
closed, which "open" then left out, and the fork took 1.06x the time (95%
interval 0.91-1.19). A third trial finding, a section reporting a finding
without its material (#5401), is dropped: it missed the one real case left to
replay and fired on 4 of 24 other turns asking for runs or scripts behind counts.

Three constructed cases protect it: overtaken-correction, overtaken-news and
overtaken-question.
…he turn-end kinds in one list

Review of the first version found the fork's pile findings sending the agent
nowhere: of six summaries, two said to withdraw or remove the correction reply,
which no command does, and four to edit the earlier reply, which leaves the
correction standing. threads.md's paragraph on corrections, which the fork reads
verbatim, now names the repair: `leaf thread summarize --from <earlier-reply>
--through <correction> --text "<the current answer>"`. Run through the real CLI
on overtaken-correction's page, that range is accepted and folds both replies
under the user's question. With it, every pile summary in the reruns names
summarize (3 replays, 2 eval runs).

The `overtaken` bullet now names its two cases and leaves the rule to that
guidance, instead of restating it. Rerun at the #5724 piles: triager-health 2 of
2, agent-launch-wait 1 of 1, package-interface 0 of 1 (it named a different
overtaken thread there). overtaken-correction and overtaken-news pass 2 of 2.

`FOUND` is now the one list of finding kinds; `ANSWER`'s enum and `answer_form`
derive from it, so a kind can't validate and then miss its line in `_found`.
`guidance()` names the reference and opening it can't find. overtaken-news's
log gives r2 the words the conversation posts. The docstring carries the
measured numbers of this wording and the one before it on 17 recent turns
(no `overtaken` on the 15 without a replay artifact; 1.13x the time, 95%
0.94-1.34, against a base run hours earlier).
@max-sixty
max-sixty marked this pull request as ready for review November 16, 2026 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ending a thread question with leaf task end leaves the thread reading as unanswered

2 participants