fix(executor): recursively strip cache_control for non-Anthropic embedders - #214
Open
warelik wants to merge 2 commits into
Open
fix(executor): recursively strip cache_control for non-Anthropic embedders#214warelik wants to merge 2 commits into
warelik wants to merge 2 commits into
Conversation
…dders stripCacheControls previously only deleted top-level cache_control fields in tools, system, and messages. A Claude tool_result with structured content blocks that themselves carry cache_control would still forward the Anthropic-only field to Kimi and cause rejection. - Make stripCacheControls only target protocol-level cache_control markers on system/tool/message blocks and nested content arrays (e.g. tool_result content). It leaves arbitrary JSON like tool input_schema properties named "cache_control" untouched. - Add stripContentCacheControls to recurse into nested content arrays without wandering into sibling objects such as tool input_schema or tool_use input. - Add TestStripCacheControls and TestStripCacheControls_NestedToolResultContent. Refs: router-for-me/CLIProxyAPI#5154
warelik
force-pushed
the
ao/airouters-18-plus-strip-cache
branch
from
August 21, 2026 19:59
49650b4 to
5d070f0
Compare
Contributor
Author
|
CI build failure is the known scheduling-sensitive flake TestAntigravityConcurrentRequestsReusePooledConnections (same as documented on #198); not related to this diff. |
warelik
added a commit
to warelik/CLIProxyAPIPlus
that referenced
this pull request
Aug 21, 2026
…cache-control
warelik
added a commit
to warelik/CLIProxyAPIPlus
that referenced
this pull request
Aug 21, 2026
3 tasks
…dders stripCacheControls previously only deleted top-level cache_control fields in tools, system, and messages. A Claude tool_result with structured content blocks that themselves carry cache_control would still forward the Anthropic-only field to Kimi and cause rejection. - Make stripCacheControls only target protocol-level cache_control markers on system/tool/message blocks and nested content arrays (e.g. tool_result content). It leaves arbitrary JSON like tool input_schema properties and tool_use input named "cache_control" untouched. - Add stripContentCacheControls to recurse into nested content arrays without wandering into sibling objects such as tool input_schema or tool_use input. - Add TestStripCacheControls and TestStripCacheControls_NestedToolResultContent. Refs: router-for-me/CLIProxyAPI#5154
warelik
force-pushed
the
ao/airouters-18-plus-strip-cache
branch
from
August 21, 2026 22:09
e2b4e6f to
3d3a89a
Compare
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.
Summary
Mirror of router-for-me/CLIProxyAPI#5154.
stripCacheControlspreviously only deleted top-levelcache_controlfields intools,system, andmessages. A Claudetool_resultwith structuredcontentblocks that themselves carrycache_controlwould still forward the Anthropic-only field to Kimi and cause rejection.stripCacheControlsnow recursively traverses every array and object.cacheControlPathscollects every JSON path ending incache_control, including nestedtool_resultcontent blocks.TestStripCacheControlsandTestStripCacheControls_NestedToolResultContent.Test plan
go build -o cli-proxy-api ./cmd/servergo test ./internal/runtime/executorCross-links