Skip to content

fix(antigravity): strip generationConfig.thinkingConfig for Claude models - #2217

Merged
diegosouzapw merged 4 commits into
diegosouzapw:release/v3.8.0from
NomenAK:fix/antigravity-claude-thinking-config-2026-05-13
May 14, 2026
Merged

diegosouzapw merged 4 commits into
diegosouzapw:release/v3.8.0from
NomenAK:fix/antigravity-claude-thinking-config-2026-05-13

Conversation

@NomenAK

@NomenAK NomenAK commented May 13, 2026

Copy link
Copy Markdown
Contributor

What

Strip generationConfig.thinkingConfig for Claude models before the Cloud Code envelope is wrapped, in openaiToAntigravityRequest.

Why

The v3.8.0 refactor unified the Claude and Gemini Antigravity request paths through openaiToGeminiCLIRequest. The Gemini-specific thinkingConfig field is not understood by the Cloud Code Claude endpoint — Claude models with reasoning_effort set were sending thinkingConfig and the endpoint silently mishandled it.

How

  • Add if (isClaude && envelope.request?.generationConfig) { delete envelope.request.generationConfig.thinkingConfig; } after wrapInCloudCodeEnvelope()
  • Order matters: AFTER the wrap, so applyAntigravityGenerationDefaults (which runs inside wrapInCloudCodeEnvelope) can still use thinkingBudget to set maxOutputTokens correctly to 32769
  • Existing test in tests/unit/antigravity-model-aliases.test.ts already asserts the thinkingConfig is undefined; previously failing as { thinkingBudget: 32768, includeThoughts: true }, now passes

Notes

Happy to revise if you'd prefer a different placement or a flag-based approach.

…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>
@NomenAK
NomenAK requested a review from diegosouzapw as a code owner May 13, 2026 12:04

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +551 to +553
if (isClaude && envelope.request?.generationConfig) {
delete envelope.request.generationConfig.thinkingConfig;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@NomenAK

NomenAK commented May 13, 2026

Copy link
Copy Markdown
Contributor Author

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.
@diegosouzapw
diegosouzapw merged commit e2b4c2b into diegosouzapw:release/v3.8.0 May 14, 2026
2 of 3 checks passed
@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks @NomenAK! Your contribution has been integrated into release/v3.8.0 and will ship in the upcoming release.

The PR branch was synced with the latest release/v3.8.0 (no conflicts) and squash-merged.

Review fix applied: added a follow-up commit updating the two existing Claude-path Antigravity tests in tests/unit/translator-openai-to-gemini.test.ts to reflect the new strip behavior (they previously asserted thinkingConfig was preserved, which contradicted the new strip), plus a new negative-control test asserting that the Gemini-on-Antigravity path still preserves thinkingConfig. This locks in both halves of the fix (Claude stripped, Gemini preserved) so future regressions are caught.

Reviewed and merged via the /review-prs-cc workflow.

diegosouzapw added a commit that referenced this pull request May 14, 2026
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+.
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
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+.
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
Poid-ZA pushed a commit to Poid-ZA/OmniRoute that referenced this pull request Aug 5, 2026
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+.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants