Repository navigation
Give the line fork the whole thread - #6316
Merged
Merged
Conversation
The line fork's prompt carried the thread as a delivery to the session does: the
opening message and the latest seven, with the middle left to `leaf page state`.
The fork can't run that command, and the conversation it inherits may have lost
the middle to a compaction, so on a long thread it wrote the agent's working line
without the discussion the newest message continues. Max asked that the fork get
the whole thread.
`delivery.batch_data` takes `whole`, which `thread_context.batch_threads` and
`thread_digest` pass through to drop the bound on messages and gestures; only
`forks._thread_data` sets it. The session's deliveries keep the bound, which
exists so a long thread's digest can't outgrow the output it prints into.
Cost, measured on this machine's 429 pages: of the 118 line forks Leaf asked,
8 had a thread long enough for the bound to elide anything. The longest thread
a line fork saw had 25 messages and 9.5k characters of text, about 2.4k tokens
of uncached input, against each fork's ~400-600k tokens read from cache. Across
all 1,050 threads with more than one message, the 99th percentile is 12
messages and 4.9k characters, the longest 28 messages and 11k characters. Each
fork's prompt grows with its thread, so a thread's forks together grow with its
square, which at these sizes stays a few thousand tokens per fork.
The line-fork eval's threads are all shorter than the bound, so the change
doesn't reach them, and the prompt's wording changes by one word ("The whole
thread, as Leaf delivers it"); no score was run.
Co-Authored-By: Claude Code <[email protected]>
leaf-agent
approved these changes
Nov 17, 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.
The line fork's prompt now carries every message of the thread. Before, it got the thread as a delivery to the session does: the opening message and the latest seven, with the middle left to
leaf page state, which the fork can't run. The conversation it inherits may also have lost the middle to a compaction.delivery.batch_data(..., whole=True)passes throughthread_context.batch_threadsandthread_digestto drop the bound on messages and gestures. Onlyforks._thread_datasets it; the session's deliveries keep the bound.forks.py's header states the decision and its cost.test_a_line_fork_reads_the_whole_of_a_long_threadbuilds a 13-message thread and checks that the fork's prompt holds a message the session's delivery elides. It fails withwhole=False.Cost. On this machine's pages, 8 of 118 line forks had a thread long enough to elide anything. The longest a fork saw was 25 messages and 9.5k characters (about 2.4k uncached tokens), against each fork's 400–600k tokens read from cache. Each fork's prompt grows with its thread, so a thread's forks together grow with its square; at these sizes that stays at a few thousand tokens per fork.
The line-fork eval's threads are all shorter than the bound, and the prompt's wording changes by one word, so no score was run.