Skip to content

Hand every harness's over-limit delivery over as one pointer - #3743

Merged
max-sixty merged 4 commits into
mainfrom
delivery-pointer
Oct 23, 2026
Merged

max-sixty merged 4 commits into
mainfrom
delivery-pointer

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A delivery too large for a hook's context reached the agent two ways. Claude Code's and Pi's hooks (hook_transport.render) wrote a prose line naming leaf delivery read <id>, held to Claude Code's HOOK_CONTEXT_LIMIT with <. Codex's hook (codex.offer_hook_delivery) sent the <leaf-delivery> element the skill teaches, held to its own HOOK_CONTEXT_BYTES with <=.

Each harness now states its limit as data, Harness.hook_context_bytes, and Harness.fits_hook_context is the one comparison. Both hook paths hand an oversized delivery over as delivery.delivery_pointer_prompt. Both old constants and the prose pointer are gone.

Behavior changes:

  • Claude Code's agent gets the <leaf-delivery> element in place of the prose line. Its limit is 9,990 bytes, the largest context measured to arrive whole, where 9,999 was allowed before.
  • Pi has no limit: its extension adds a hook's context at any size, so a large delivery now arrives inline and confirmed. A pointer still comes when the hook can't confirm the delivery.
  • Codex is unchanged.

event-batches.md, "Handle the input", now says what a pointer looks like, and the harness references point there rather than restating how to read one. No protocol bump: hook output is not part of a vendored page.

Eval

A new delivery-eval variant, document/oversized, posts one 10.5 KB comment (a CI log whose single failure sits near the end) while the session is idle, so the wake turn's hook hands it over by pointer. Run on Claude Code, base 637d54d against the working tree, --repeat 3:

Arm Pass Pointer form Seconds to answer
base 3/3 prose line 21.8, 23.4, 31.7
candidate 3/3 <leaf-delivery> element 27.2, 28.6, 34.2

Every run got a pointer, read the whole delivery, confirmed it and named the failing test. In 2 of 3 candidate runs the agent read event-batches.md before the delivery, which the skill asks for on every delivery and the prose pointer had let it skip; that extra read is most of the gap in answer time, within the runs' spread. Codex's text didn't change, and Pi has no eval target.

Journeys on the working tree: claude-code, pi, codex-app-server and codex-queue all passed.

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

max-sixty and others added 4 commits October 23, 2026 04:05
A delivery too large for a hook's context reached the agent two ways.
Claude Code's and Pi's hooks (`hook_transport.render`) wrote a prose line
naming `leaf delivery read <id>`, held to Claude Code's `HOOK_CONTEXT_LIMIT`
with `<`. Codex's hook (`codex.offer_hook_delivery`) sent the
`<leaf-delivery>` element the skill teaches, held to its own
`HOOK_CONTEXT_BYTES` with `<=`.

Each harness now states its limit as data, `Harness.hook_context_bytes`,
and `Harness.fits_hook_context` is the one comparison; both hook paths hand
an oversized delivery over as `delivery.delivery_pointer_prompt`. Both old
constants and the prose pointer are gone.

Behavior changes:
- Claude Code's agent gets the `<leaf-delivery>` element in place of the
  prose line. Its limit is 9,990 bytes, the largest context measured to
  arrive whole, where 9,999 was allowed before.
- Pi has no limit: its extension adds a hook's context at any size, so a
  large delivery now arrives inline and confirmed. A pointer still comes
  when the hook can't confirm the delivery.
- Codex is unchanged.

`event-batches.md`, "Handle the input", now says what a pointer looks like,
and the harness references point there rather than restating how to read
one. No protocol bump: hook output is not part of a vendored page.

Scored with a new `document/oversized` delivery eval (a 10.5 KB comment,
idle, Claude Code): base 3/3, candidate 3/3. Every run got a pointer, read
the whole delivery and named the failing test from the end of the log.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 23, 2026
@max-sixty
max-sixty merged commit 35cdf27 into main Oct 23, 2026
3 checks passed
@max-sixty
max-sixty deleted the delivery-pointer branch October 23, 2026 11:34
max-sixty added a commit that referenced this pull request Oct 25, 2026
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_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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