Repository navigation
Point at a delivery once per turn until its reader confirms it - #3907
Merged
Merged
Conversation
A pointer leaves its input unconfirmed until the reader runs `leaf delivery ack`, so each later Claude Code tool boundary of the same turn froze that input into a new delivery and pointed at it again under a new id: the model was handed the same input 2 to 4 times a turn, seen in every run of the `document/oversized` eval before and after #3743. A tool boundary carries only new input. The hook now notes, per turn, each page it hands over by pointer (`hook_transport.POINTED`, a new state-home record at `sessions/<digest>.pointed`, since 22), and a later PostToolBatch hands nothing from a page while its pointed input is unconfirmed. Once the reader acks, the page's later input follows at the next boundary. Stop and a prompt still hand unconfirmed input over again, as they do input Escape dropped, so an ignored pointer is not lost. Behavior change: input that arrives on a page between its pointer and the ack waits for the first tool boundary after the ack instead of riding in a second pointer that repeats the first. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…notes to the turn's opening Review of the pointer note found two gaps in it and one older input loss: - A hook whose prompt was dropped and reopened could leave a note the reopened turn's tool boundaries obeyed, so input whose pointer reached no model waited for Stop. The note now names the turn's opening (`turn_opened`), as `handed_into_turn` does, and a prompt that opens the turn again starts a fresh one. - A stale hook could overwrite a newer turn's note. `note_pointer` now writes under the session lock and only while the lifecycle it planned under is current. - Older: where a hook recorded some batches and a page refused (it changed hands, or its lock was held at the deadline), the whole delivery went as a pointer, but the recorded batches' opened pickups were confirmed by the turn's next hook though the model read none of them; the cursor passed input nobody read. `receive_held` now returns the batches it recorded, and the hook hands exactly those over inline. A refused batch's input stays pending for whoever holds its page. A pointer now goes only when the delivery doesn't fit or the hook recorded nothing. Behavior change: an agent no longer gets a pointer (and `leaf delivery ack` refusal) for a page that changed hands mid-hook; that page's input waits for its owner. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A pointer note that waited on a contended session lock could hold the hook's output past its harness's timeout, which discards the pointer itself. The note now takes the lock only until CONFIRM_WITHIN and is skipped after it; a skipped note costs at most a repeated pointer. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A new record kind starts at the current protocol (layer-registry.md, "Page protocol"), which main moved to 24 while this branch held 22. Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
approved these changes
Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A pointer leaves its input unconfirmed until the reader runs
leaf delivery ack, so each later Claude Code tool boundary of the same turn froze that input into a new delivery and pointed at it again under a new id: the model was handed the same input 2 to 4 times a turn, seen in every run of thedocument/oversizedeval before and after #3743.Pointer once per turn. A tool boundary carries only new input. The hook now notes, per turn, each page it hands over by pointer (
hook_transport.POINTED, a new state-home record atsessions/<digest>.pointed, starting at protocol 24 as a new record kind does), and a later PostToolBatch hands nothing from a page while its pointed input is unconfirmed. Once the reader acks, the page's later input follows at the next boundary. Stop and a prompt still hand unconfirmed input over again, as they do input Escape dropped, so an ignored pointer is not lost.The note names the turn's opening (
turn_opened), so a prompt dropped and reopened into the same turn starts a fresh one and its tool boundaries point again.note_pointerwrites under the session lock, only while the lifecycle it planned under is current, and takes that lock only untilCONFIRM_WITHIN; a skipped note costs at most a repeated pointer, while waiting could push the hook past its harness's timeout and lose the pointer itself.Inline handover of only recorded batches. Previously, where a hook recorded some batches and one page refused (it changed hands, or its lock was held at the deadline), the whole delivery went as a pointer, but the recorded batches' opened pickups were confirmed by the turn's next hook though the model read none of them, so the cursor passed input nobody read.
receive_heldnow returns the batches it recorded and the hook hands exactly those over inline. A refused batch's input stays pending for whoever holds its page. A pointer goes only when the delivery doesn't fit the harness's context or the hook recorded nothing.Behavior changes:
leaf delivery ackrefusal) for a page that changed hands mid-hook; that page's input waits for its owner.Tests in
tests/model/test_hooks.pycover the once-per-turn pointer, the reopened prompt, and the partial-refusal and lock-deadline cases.