fix: keep Gemini thinking disabled after clamp#101832
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 11:15 PM ET / 03:15 UTC. Summary PR surface: Source +7, Tests +86. Total +93 across 4 files. Reproducibility: yes. Source inspection shows current main can clamp a Google xhigh/max request to Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this PR, or a maintainer-owned equivalent, after exact-head checks and let the linked canonical issue close after merge. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main can clamp a Google xhigh/max request to Is this the best way to solve the issue? Yes. The best fix is the two-surface repair in this PR: preserve clamped AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5bdea31c9455. Label changesLabel justifications:
Evidence reviewedPR surface: Source +7, Tests +86. Total +93 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (6 earlier review cycles)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b9ac46820
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (clampedReasoning === "off") { | ||
| return { enabled: false }; |
There was a problem hiding this comment.
Preserve clamped-off before payload sanitization
When this path is used via the Google simple-completion adapter, this disabled thinking object is only an intermediate payload: src/agents/google-simple-completion-stream.ts:52 later calls sanitizeGoogleThinkingPayload with the original options.reasoning (max/xhigh), and src/plugin-sdk/provider-stream-shared.ts:951 maps Gemini 3 requests back to HIGH. That means the reported case where max/xhigh clamps to off still sends high thinking in the final provider request; the fix needs to pass the clamped/off intent into the sanitizer or make the sanitizer preserve an already-disabled config.
Useful? React with 👍 / 👎.
|
Maintainer regression fixup complete; this is land-ready.
No known proof gaps. |
|
Merged via squash.
|
* fix: keep Gemini thinking disabled after clamp * fix: preserve clamped Gemini thinking in wrapper * test(ai): cover generic Gemini clamp to off --------- Co-authored-by: Peter Steinberger <[email protected]>
Closes #101785
What Problem This Solves
Fixes an issue where users requesting a Google/Gemini reasoning level that the selected model clamps down to
offcould still get thinking enabled at the provider's high effort level.AI-assisted: yes, created with Codex.
Why This Change Was Made
The Google shared provider now treats
clampThinkingLevel()returningoffas a disabled-thinking result before mapping provider efforts. The Google simple-completion wrapper also passes the clamped effective reasoning level into the final thinking-payload sanitizer, so an unsupportedmax/xhighrequest cannot be restored to Gemini 3HIGHafter the shared builder already disabled it. The existingmaxtohighnormalization remains in place for supported non-off Google thinking requests.User Impact
Gemini requests whose catalog/model constraints resolve reasoning to
offno longer unexpectedly send high thinking settings, avoiding unwanted token overhead and provider errors on models that should have thinking disabled.Evidence
d4f31fb354f.git diff --checkpassed after the wrapper fix./Users/fallmonkey/Developer/openclaw/node_modules/.bin/oxfmt --check --threads=1 packages/ai/src/providers/google-shared.ts packages/ai/src/providers/google-shared.test.ts src/agents/google-simple-completion-stream.ts src/agents/google-simple-completion-stream.test.ts src/llm/providers/stream-wrappers/google.test.tspassed.node scripts/run-vitest.mjs packages/ai/src/providers/google-shared.test.ts src/agents/google-simple-completion-stream.test.ts src/llm/providers/stream-wrappers/google.test.tspassed as a narrow local fallback after temporarily symlinking this linked worktree to the main checkout's existingnode_modules: 3 test files, 28 tests, 2 Vitest shards in 5.23s. The symlink was removed after the run.d4f31fb354fpassed. This used the actualprepareGoogleSimpleCompletionModel()andstreamSimple()runtime modules with the real Google simple-completion custom API wrapper, captured the final provider payload inonPayload, then threwOPENCLAW_PAYLOAD_CAPTURED_BEFORE_NETWORKto stop before any Google network request. The redacted terminal output was:{ "model": "gemini-3-flash-preview", "wrappedApi": "openclaw-google-generative-ai-simple", "requestedReasoning": "xhigh", "capturedFinalThinkingConfig": { "thinkingLevel": "MINIMAL" }, "stoppedBeforeNetwork": true, "proofChecks": { "noHighThinkingLevel": true, "noThoughtsRequested": true, "finalPayloadUsesMinimal": true } } { "model": "gemini-3-flash-preview", "wrappedApi": "openclaw-google-generative-ai-simple", "requestedReasoning": "max", "capturedFinalThinkingConfig": { "thinkingLevel": "MINIMAL" }, "stoppedBeforeNetwork": true, "proofChecks": { "noHighThinkingLevel": true, "noThoughtsRequested": true, "finalPayloadUsesMinimal": true } }preserves clamped-off intent in the final Gemini 3 payload for reasoning=xhigh|maxruns the actualsanitizeGoogleThinkingPayload()through the Google simple-completion wrapper payload hook. For an off-onlygemini-3-flash-preview, the wrapper now calls the sanitizer withthinkingLevel: "off", and the final outbound payload remains{ "thinkingConfig": { "thinkingLevel": "MINIMAL" } }with noincludeThoughtsand noHIGH.buildGoogleSimpleThinking()plusbuildGoogleGenerateContentParams()with off-onlythinkingLevelMapemits disabled simple thinking for Gemini 2.5 and Gemini 3 clamp-to-off requests without sendingHIGHorincludeThoughts.blacksmithis not installed on PATH for Blacksmith Testbox, and brokered AWS Crabbox reports missing coordinator/broker auth. No secrets were printed./Users/fallmonkey/Developer/openclaw/.agents/skills/autoreview/scripts/autoreview --mode local; it reported clean with no accepted/actionable findings.