Repository navigation
Revert "fix(agents): keep session forks on the parent's cached prompt prefix" - #197175
Merged
Merged
Conversation
… prefix (#197074)" This reverts commit 2706a18. Live provider measurements showed no cache gain. On Anthropic (haiku-5-5 and opus-5-5, thinking off and on, direct and custom routes), forks read the same parent prefix before and after: replaying one fork with the parent's tool_choice, with tool_choice none, and with mismatched tool IDs differed by 0-2 cached tokens. With thinking on, both tool IDs were already identical. The measured cause of fork cache misses is the fork's thinking config (it sends thinking disabled or a different effort and keeps or drops thinking blocks differently from the parent), and on OpenAI the deleted prompt_cache_key. Co-authored-by: obviyus <[email protected]>
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
This was referenced Nov 11, 2026
This was referenced Nov 11, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 12, 2026
… prefix (openclaw#197074)" (openclaw#197175) This reverts commit 9cae7fa. Live provider measurements showed no cache gain. On Anthropic (haiku-5-5 and opus-5-5, thinking off and on, direct and custom routes), forks read the same parent prefix before and after: replaying one fork with the parent's tool_choice, with tool_choice none, and with mismatched tool IDs differed by 0-2 cached tokens. With thinking on, both tool IDs were already identical. The measured cause of fork cache misses is the fork's thinking config (it sends thinking disabled or a different effort and keeps or drops thinking blocks differently from the parent), and on OpenAI the deleted prompt_cache_key. Co-authored-by: obviyus <[email protected]>
This was referenced Nov 12, 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.
Reverts #197074.
#197074 claimed Advisor forks would reuse the parent's Anthropic prompt cache. The proof was a loopback mock showing that fork request bodies matched byte for byte, and I described that as cutting Peanutto reviews from about $3 to about $0.10. Live providers don't support that.
Measured on an isolated Gateway against real providers, before and after the fix:
anthropic, a custom provider pointed at api.anthropic.com, and cliproxy: forks already read the parent's full cached prefix before the fix. That held even when tool-call IDs differed andtool_choicewasnone.tool_choice(the change)tool_choice: noneWith thinking on, tool-call IDs were already identical before the fix.
The real causes, measured:
sessionEntry.thinkingLevel(src/gateway/server-plugin-subagent-runtime.ts:324), so the agent'sthinkingDefaultnever reaches it. A follow-up PR will fix that.prompt_cache_key. Replaying the parent's request without the key dropped cached tokens from 3443 to 2615.Also removed: the pending-call "still running" fix only repaired a regression introduced by #197074 itself, and
scripts/perf/advisor-fork-prefix-gateway.tswas proof for the reverted claim. Test lines net −1 (one restored assertion is compacted).Tests:
session-fork.test.ts,embedded-agent-runner.session-fork.test.ts, andattempt-execution-phase.test.tspass (40 tests).