fix(antigravity): strip generationConfig.thinkingConfig for Claude models - #2217
Conversation
…ty envelope (#17) When a Claude model is dispatched through Antigravity with reasoning_effort set, openaiToGeminiCLIRequest sets generationConfig.thinkingConfig (a Gemini-specific field). The Cloud Code Claude endpoint does not understand Gemini thinkingConfig and must not receive it. applyAntigravityGenerationDefaults (called inside wrapInCloudCodeEnvelope) correctly bumps maxOutputTokens to thinkingBudget+1 before this strip runs, so the output-token budget is preserved even after the Gemini-specific field is removed. Pre-existing failure deferred during the 2026-05-12 incident sweep. Root cause: the v3.8.0 refactor unified the Claude and Gemini Antigravity paths through openaiToGeminiCLIRequest but omitted the thinkingConfig strip that the old openaiToClaudeRequestForAntigravity path implicitly provided by never setting it. Co-authored-by: OmniRoute Ops <ops@nomenak.dev>
There was a problem hiding this comment.
Code Review
This pull request modifies the request translation logic for Claude models on Antigravity by stripping the thinkingConfig from the generation configuration, as the Cloud Code Claude endpoint does not support it. A review comment identifies a logic issue where this deletion occurs before a check for the presence of thinking configuration, which could cause the hasThinking flag to be incorrectly set to false and lead to the unintended removal of maxOutputTokens later in the function.
| if (isClaude && envelope.request?.generationConfig) { | ||
| delete envelope.request.generationConfig.thinkingConfig; | ||
| } |
There was a problem hiding this comment.
The deletion of thinkingConfig occurs before the hasThinking check at line 559. This causes hasThinking to be incorrectly calculated as false for Claude models, which may lead to maxOutputTokens being incorrectly deleted later in the function. Please move this deletion block to after the hasThinking check (line 566) to ensure the thinking budget is correctly accounted for.
There was a problem hiding this comment.
Already addressed in a849152 — the strip block now runs after the hasThinking check on line 566. Thanks for the catch.
gemini-code-assist[bot] flagged that deleting thinkingConfig before the hasThinking check on line 559 caused hasThinking to be false for Claude models, which then incorrectly stripped maxOutputTokens. Move the strip to after the hasThinking-derived maxOutputTokens logic completes. Co-authored-by: OmniRoute Ops <ops@nomenak.dev>
|
Good catch — moved the strip to after the hasThinking-derived maxOutputTokens logic. Thanks! |
…d Gemini-preserve negative control Adjusts the two Claude-path antigravity tests that previously asserted thinkingConfig was preserved — after the strip in openaiToAntigravityRequest they correctly assert it is undefined. Adds a new test on the Gemini path asserting thinkingConfig is still present, acting as a negative control to ensure the strip only affects Claude models.
e2b4c2b
into
diegosouzapw:release/v3.8.0
|
Thanks @NomenAK! Your contribution has been integrated into The PR branch was synced with the latest Review fix applied: added a follow-up commit updating the two existing Claude-path Antigravity tests in Reviewed and merged via the |
Deep audit of all 320 commits since v3.7.9 found: - 18 merged PRs not documented in CHANGELOG (4 features, 10 bug fixes, 1 security, 2 chores, 1 debug improvement) - 3 contributors entirely missing from credits table (@NomenAK with 12 PRs, @kang-heewon, @one-vs) - 4 existing contributors with inaccurate PR counts (@oyi77 8→12, @ddarkr 2→3, @andrewmunsell 2→3, @nickwizard 2→3) New entries added: - feat: #2135 (1proxy settings), #2227 (antigravity project ID), #2238 (Z.AI Search), #2240 (CLI Suite) - fix: #2217, #2218, #2219, #2221, #2222, #2223, #2224, #2231, #2233, #2236, #2242, #2243 - security: #2209 (stack trace exposure) - chore: #2228, #2234 Total contributors updated from 50+ to 55+.
…dels (diegosouzapw#2217) Integrated into release/v3.8.0
Deep audit of all 320 commits since v3.7.9 found: - 18 merged PRs not documented in CHANGELOG (4 features, 10 bug fixes, 1 security, 2 chores, 1 debug improvement) - 3 contributors entirely missing from credits table (@NomenAK with 12 PRs, @kang-heewon, @one-vs) - 4 existing contributors with inaccurate PR counts (@oyi77 8→12, @ddarkr 2→3, @andrewmunsell 2→3, @nickwizard 2→3) New entries added: - feat: diegosouzapw#2135 (1proxy settings), diegosouzapw#2227 (antigravity project ID), diegosouzapw#2238 (Z.AI Search), diegosouzapw#2240 (CLI Suite) - fix: diegosouzapw#2217, diegosouzapw#2218, diegosouzapw#2219, diegosouzapw#2221, diegosouzapw#2222, diegosouzapw#2223, diegosouzapw#2224, diegosouzapw#2231, diegosouzapw#2233, diegosouzapw#2236, diegosouzapw#2242, diegosouzapw#2243 - security: diegosouzapw#2209 (stack trace exposure) - chore: diegosouzapw#2228, diegosouzapw#2234 Total contributors updated from 50+ to 55+.
…dels (diegosouzapw#2217) Integrated into release/v3.8.0
Deep audit of all 320 commits since v3.7.9 found: - 18 merged PRs not documented in CHANGELOG (4 features, 10 bug fixes, 1 security, 2 chores, 1 debug improvement) - 3 contributors entirely missing from credits table (@NomenAK with 12 PRs, @kang-heewon, @one-vs) - 4 existing contributors with inaccurate PR counts (@oyi77 8→12, @ddarkr 2→3, @andrewmunsell 2→3, @nickwizard 2→3) New entries added: - feat: diegosouzapw#2135 (1proxy settings), diegosouzapw#2227 (antigravity project ID), diegosouzapw#2238 (Z.AI Search), diegosouzapw#2240 (CLI Suite) - fix: diegosouzapw#2217, diegosouzapw#2218, diegosouzapw#2219, diegosouzapw#2221, diegosouzapw#2222, diegosouzapw#2223, diegosouzapw#2224, diegosouzapw#2231, diegosouzapw#2233, diegosouzapw#2236, diegosouzapw#2242, diegosouzapw#2243 - security: diegosouzapw#2209 (stack trace exposure) - chore: diegosouzapw#2228, diegosouzapw#2234 Total contributors updated from 50+ to 55+.
What
Strip
generationConfig.thinkingConfigfor Claude models before the Cloud Code envelope is wrapped, inopenaiToAntigravityRequest.Why
The v3.8.0 refactor unified the Claude and Gemini Antigravity request paths through
openaiToGeminiCLIRequest. The Gemini-specificthinkingConfigfield is not understood by the Cloud Code Claude endpoint — Claude models withreasoning_effortset were sendingthinkingConfigand the endpoint silently mishandled it.How
if (isClaude && envelope.request?.generationConfig) { delete envelope.request.generationConfig.thinkingConfig; }afterwrapInCloudCodeEnvelope()applyAntigravityGenerationDefaults(which runs insidewrapInCloudCodeEnvelope) can still usethinkingBudgetto setmaxOutputTokenscorrectly to 32769tests/unit/antigravity-model-aliases.test.tsalready asserts thethinkingConfigisundefined; previously failing as{ thinkingBudget: 32768, includeThoughts: true }, now passesNotes
Happy to revise if you'd prefer a different placement or a flag-based approach.