Skip to content

End a Claude Code turn on its answer and remind it of an owed update in a turn of its own - #3596

Merged
max-sixty merged 3 commits into
mainfrom
d03a-remind-in-own-turn
Oct 22, 2026
Merged

max-sixty merged 3 commits into
mainfrom
d03a-remind-in-own-turn

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Max's decision #3a on the overnight report: when a Claude Code turn ends still owing a page answer, end it on its answer and remind the agent in a turn of its own (option A).

The defect

Leaf's Stop hook continued a turn that still owed an answer to a delivered update, telling the agent which update it owed. The agent then wrote one more message, usually a short note about the comment. Claude Code's focus view shows only each turn's last message, so that note stood in place of the answer the turn had written. In Max's sessions of 10–19 October this was 9 of the 65 Stop continuations; #3256 had already moved the late-input cases to a turn of their own.

What changes

  • Stop ends the turn on its answer where a watch follows the turn (Harness.watches_between_turns: Claude Code at its terminal, Pi with a UI). hook_transport.stop_continues no longer counts response debt there. Under plain --print and on Codex, where no watch wakes a later turn, Stop still continues the turn as before. A page Leaf could not re-vendor still continues the turn.
  • The watch wakes a turn of its own for the reminder (session.left_owed, activity.left_owed). After a Stop closes the turn, the watch wakes for each owed answer that turn didn't start and that no prompt has named since the update's delivery. It wakes the same way End a turn on its answer: Stop leaves late input to the watch #3256 wakes for late input. That turn's prompt hook names the owed answer with its exact ref, as every prompt already does. The wake line says the page has an update still owed an answer, rather than new input.
  • The record that Leaf reminded is the prompt's existing pickup, with no new record. When a prompt re-presents an update already received and still owed, the prompt hook records an opened pickup without the update's answer.ref (pick_up_acknowledged). delivery.reminded reads that pickup: a ref-less pickup after the newest delivering one means a prompt has named the update since its delivery. This is the same pickup record Confirm a Claude Code hook delivery at the turn's next hook, and deliver it again if the turn ends first #3591 (decision Reach interact.py as colloquy, and fold the lint into note #2) reads as handed but unconfirmed. So a turn that ends still owing the same answer wakes nothing more, whether the reminder came from the watch's turn or from a prompt the user typed. A new delivery of the update, as when it changes hands, starts over.
  • leaf wait and the Codex adapter keep their watch passes as they were: session.read_watch_pass's default still wakes only for a batch.
  • The TODO entry for this decision is removed.

Checks

  • New test_a_turn_ends_on_its_answer_and_a_turn_of_its_own_names_what_it_owes: a prompt hands a comment over, and Stop ends the turn with no output. The watch wakes with the owed-answer line, the next prompt names the comment, and when that turn ends still owing it, nothing more is owed a wake. On main, the first Stop continues the turn instead.
  • test_agent_sees_the_complete_interaction_recovery's snapshot now shows a Stop with no output, the watch's reminder wake, and the reminder in the next prompt, where it used to show the reminder in the Stop hook's output.
  • Tests whose subject is what Stop says when it holds a turn now run under plain --print (printing), where it still does. Two monkeypatched policies take the new keyword.
  • leaf-dev journey claude-code gains a deferred step. The user's own turn, told to leave Leaf's comments for later, is handed a comment at a tool boundary and ends on its answer, with no Stop hook continuing it. The step checks that the user's turn closed with the comment unanswered, that no Stop hook output named it, and that a later prompt named it before it was answered. The full journey passed every step on this branch. In deferred, the user's turn ended on "done", and the woken turn answered the comment 35 s after it was sent, with one wake row and no empty one. The journey's row count now counts a wake as filled when its prompt carries a reminder (ATTENTION_OPENING) as well as a delivery. The --hooks-module arm named in the decision no longer exists, since Quiet Claude Code delivery: one background watch, no mid-turn wakes, hidden wake rows #3540 removed the module's watch, so the plugin's module loaded in this one run.
  • Model and process tests covering hooks, waits, receipts, activity, workflows, Codex and the hooks module pass.

This was written by Claude Code on behalf of max-sixty

…in a turn of its own

Where a watch follows the turn, Stop no longer continues a turn over an owed,
unstarted answer: the agent's note about it replaced the turn's answer in Claude
Code's focus view. The watch wakes a turn of its own whose prompt names the owed
answer, and the prompt's ref-less pickup records that reminder, so the update
wakes nothing more until it is delivered again.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new deferred journey does not prove that the owed comment is answered in a turn opened by the watch.

Comment thread dev/leaf_dev/journey_claude_code.py Resolved
@max-sixty
max-sixty merged commit 4d3376f into main Oct 22, 2026
3 checks passed
@max-sixty
max-sixty deleted the d03a-remind-in-own-turn branch October 22, 2026 18:49
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.

2 participants