feat(claude): add remove-tools-cache-control config#1788
feat(claude): add remove-tools-cache-control config#1788whtiehack wants to merge 1 commit intorouter-for-me:devfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Claude API integration by introducing a new configuration option, Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a remove-tools-cache-control configuration for Claude providers. The changes are well-implemented across the configuration, synthesizer, and executor. I've identified a couple of areas for improvement regarding code duplication and error handling in the executor, which would enhance the maintainability and robustness of the new logic.
| if removeToolsCacheControl(auth) { | ||
| body = stripToolsCacheControl(body) | ||
| if countCacheControls(body) == 0 { | ||
| body = injectSystemCacheControl(body) | ||
| body = injectMessagesCacheControl(body) | ||
| } | ||
| } else if countCacheControls(body) == 0 { | ||
| body = ensureCacheControl(body) | ||
| } |
There was a problem hiding this comment.
luispater
left a comment
There was a problem hiding this comment.
Thanks for the PR. I’m requesting changes mainly around one correctness gap: the new remove-tools-cache-control behavior is applied in Execute/ExecuteStream, but not in CountTokens. A Claude provider configured for an upstream that rejects tools[].cache_control can still fail on /v1/messages/count_tokens because that path forwards tool cache_control unchanged. Could we apply the same stripping logic in CountTokens and add a regression test for a count_tokens request with remove_tools_cache_control=true? Once that is addressed, this looks good to me.
|
Done. Applied the same stripping logic in |
luispater
left a comment
There was a problem hiding this comment.
Summary: The follow-up closes the gap from the previous review. remove_tools_cache_control now applies consistently in Execute, ExecuteStream, and CountTokens, and the new regression test covers the CountTokens path that was previously missing.
Blocking findings:
- None.
Non-blocking findings:
- None.
Test plan:
- The PR includes focused executor and synthesizer tests, and the GitHub checks are passing.
This is an automated Codex review result and still requires manual verification by a human reviewer.
|
This PR is approved but currently has merge conflicts. Please change the base branch to |
- add `remove-tools-cache-control` to `claude-api-key` config - propagate setting via synthesized auth attributes - strip tools[].cache_control in Execute/ExecuteStream/CountTokens when enabled - inject system/messages cache control when no breakpoints remain after stripping - add tests for attribute propagation and executor behavior
8c4ac39 to
6894d95
Compare
Summary
remove-tools-cache-controltoclaude-api-keyentriesremove_tools_cache_control=truetools[].cache_controlconfig.example.yamlTesting
go test ./internal/runtime/executor ./internal/watcher/synthesizergo build -o test-output ./cmd/servergo test ./...currently fails due to an unrelated pre-existing test insdk/cliproxy/auth:TestManager_MaxRetryCredentials_LimitsCrossCredentialRetries