Skip to content

Point at a delivery once per turn until its reader confirms it - #3907

Merged
max-sixty merged 5 commits into
mainfrom
pointer-handover
Oct 25, 2026
Merged

max-sixty merged 5 commits into
mainfrom
pointer-handover

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

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.

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 at sessions/<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_pointer writes under the session lock, only while the lifecycle it planned under is current, and takes that lock only until CONFIRM_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_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 goes only when the delivery doesn't fit the harness's context or the hook recorded nothing.

Behavior changes:

  • 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.
  • An agent no longer gets a pointer (and a leaf delivery ack refusal) for a page that changed hands mid-hook; that page's input waits for its owner.

Tests in tests/model/test_hooks.py cover the once-per-turn pointer, the reopened prompt, and the partial-refusal and lock-deadline cases.

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

max-sixty and others added 5 commits October 23, 2026 16:49
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]>
@max-sixty
max-sixty merged commit dbb4a77 into main Oct 25, 2026
3 checks passed
@max-sixty
max-sixty deleted the pointer-handover branch October 25, 2026 05:27
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