Repository navigation
kernel: fold signed thinking with its run (batched read loops) - #11
Merged
Merged
Conversation
computeProtectedRefs put every thinking message of a batched read loop on the protected list. neverPreserveRecentTools drops read/bash payloads from the recent window, so Rule 2 walked back over little but thinking while the calls and results stayed foldable. The carve then stripped the thinking from every fold and INV3 (ranxianglei#4885) withdrew the whole run as a partial split. A replayed Haiku session advertised 14,241 tokens at 224K context, so the growth nudge came late or not at all. INV3 was right to refuse the split; the recent zone was manufacturing it. Thinking in a signed run with no other protected member now leaves the zone, so the run folds as one unit on both the recommend and apply sides. The same replay advertises 114,686 tokens. Partial splits are still withdrawn. Unsigned reasoning is untouched (ranxianglei#564), a run whose call or prose is protected keeps its thinking, and the latest run stays protected so an open tool loop keeps its signature. acp-kernel 0.0.176 -> 0.0.177. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Requested by David · project thread
Problem
On Haiku 5.5 (Anthropic wire, signed thinking), almost nothing was foldable. In a replayed session at 224K context, only 14,241 tokens were foldable, against 113,888 on stock upstream. So the 50K nudge fired late (about 130K) or never, which put sessions past the 100K long-context price step.
Cause:
computeProtectedRefsRule 2 (the lastpreserveRecentTokens) skipsread/bashpayloads (neverPreserveRecentTools). On a batched read loop ([signed thinking][4 reads][4 results]), the window walks back over little but thinking messages and protects every one of them, while their calls and results stay foldable. The carve then strips the thinking from any fold, and INV3 (ranxianglei#4885, from the cherry-picked upstream PR ranxianglei#4898) correctly withdraws the whole run as a partial split. Net effect: every Haiku turn is unfoldable.Fix
Signed thinking follows its run. In
computeProtectedRefs, if no other member of a signed run (its calls or prose) is protected, the thinking leaves the protected set, so the run folds as one unit. Recommend and apply both usecomputeProtectedRefs, so what gets advertised stays foldable.Kept as before:
Evidence
kernel/tests/signed-thinking-whole-run-fold.test.tshas 6 tests. 3 of them fail without the fix.acp-kernelbumped from 0.0.176 to 0.0.177.Live check (Haiku 5.5 via Copilot, 4 sessions, same fixture and defaults)
32 of 65 signed thinking messages were folded, and every session continued normally. Partial-split withdrawals still fired live (2 in one session).
Known limit: a session that reads the whole repo in a few giant turns can reach about 220K before any nudge. No growth threshold can catch that.
🤖 Generated with Claude Code
https://claude.ai/code/session_013kJPjm1Dk8kfpvXQY1hZE7