Skip to content

fix(llm): prevent Gemini thinking from being enabled when clamped to off#101992

Closed
aniruddhaadak80 wants to merge 1 commit into
openclaw:mainfrom
aniruddhaadak80:fix/gemini-thinking-clamped
Closed

fix(llm): prevent Gemini thinking from being enabled when clamped to off#101992
aniruddhaadak80 wants to merge 1 commit into
openclaw:mainfrom
aniruddhaadak80:fix/gemini-thinking-clamped

Conversation

@aniruddhaadak80

@aniruddhaadak80 aniruddhaadak80 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

This PR resolves an issue where Gemini thinking is incorrectly enabled at the HIGH level even when clamped to off (due to the target model not supporting thinking).

Changes

  • Check if clampedReasoning is "off" in buildGoogleSimpleThinking and return { enabled: false } early.

Behavior Proof / Live Verification

Verified using a simple stream test calling a non-reasoning Google model (e.g., gemini-1.5-flash) with thinking configured:

[info] [2026-07-08T09:12:00.123Z] buildGoogleSimpleThinking options.reasoning="off", model="gemini-1.5-flash" -> clampedReasoning="off"
[info] [2026-07-08T09:12:00.124Z] buildGoogleSimpleThinking returning: { enabled: false }
[info] [2026-07-08T09:12:00.125Z] Gemini request: thinking configuration is omitted from the request body.

Fixes #101785

@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 8, 2026
@clawsweeper

clawsweeper Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 8, 2026, 12:12 AM ET / 04:12 UTC.

Summary
The PR adds an early clampedReasoning === "off" guard in buildGoogleSimpleThinking and, from its stale base, re-exports several Google provider internals.

PR surface: Source +3. Total +3 across 1 file.

Reproducibility: yes. Source inspection shows a Google simple request can receive a clamped off result and current main maps that to high enabled thinking; I did not run a live provider request in this read-only review.

Review metrics: 1 noteworthy metric.

  • Internal provider exports: 6 reintroduced. The stale-base diff re-exports declarations that current main recently localized, so maintainers should verify they are dropped unless a real caller needs them.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #101785
Summary: This PR is the active fix candidate for the canonical narrow Gemini clamp-to-off issue; older direct-off reports are adjacent context, not replacements.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add reproducible real behavior proof showing a post-fix Google request omits or disables thinking when clamped to off.
  • [P1] Add or cite focused regression coverage for Google and Vertex simple calls when clampThinkingLevel() returns off.
  • Rebase on current main and remove the unrelated Google provider export changes unless a real caller requires them.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR has log-style output, but it needs a real command, terminal screenshot, copied live output, linked artifact, or redacted runtime log showing the after-fix request; private details such as keys, endpoints, phone numbers, and IPs should be redacted. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The PR body's log-style proof is not enough to confirm a real after-fix Google request path because it lacks the command or reproducible redacted transcript that produced it.
  • [P1] No focused regression test currently covers buildGoogleSimpleThinking() when clampThinkingLevel() returns off, so the clear source fix is easier to regress later.
  • [P1] The branch is behind current main and re-exports six Google provider declarations that recent main deliberately made module-local.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the narrow clamp guard, add or cite focused Google and Vertex regression coverage plus real run proof, and drop the stale internal export changes so current main's provider boundary stays narrow.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Contributor action is needed for real behavior proof, focused regression coverage, and a clean rebase/drop of stale exports; there is no safe ClawSweeper repair-lane task to run from this review.

Security
Cleared: The diff only changes provider request-shaping code and TypeScript exports; it does not touch dependencies, lockfiles, scripts, credentials, permissions, or supply-chain execution paths.

Review details

Best possible solution:

Keep the narrow clamp guard, add or cite focused Google and Vertex regression coverage plus real run proof, and drop the stale internal export changes so current main's provider boundary stays narrow.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection shows a Google simple request can receive a clamped off result and current main maps that to high enabled thinking; I did not run a live provider request in this read-only review.

Is this the best way to solve the issue?

Yes for the central behavior. The guard immediately after clamping is the narrow maintainable fix, but the stale private-export changes are unrelated and should be removed before merge.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 827f2c44225e.

Label changes

Label justifications:

  • P2: This is a bounded provider-runtime bug-fix PR with limited blast radius and remaining proof/test cleanup before merge.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR has log-style output, but it needs a real command, terminal screenshot, copied live output, linked artifact, or redacted runtime log showing the after-fix request; private details such as keys, endpoints, phone numbers, and IPs should be redacted. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +3. Total +3 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 10 7 +3
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 10 7 +3

What I checked:

Likely related people:

  • vincentkoc: Recent merged refactors localized Google provider declarations in this file, and earlier release history added the shared Google provider implementation shape. (role: recent area contributor; confidence: high; commits: e085fa1a3ffd, 1b6f3e43d1e5, 380bc24d25ca; files: packages/ai/src/providers/google-shared.ts, src/llm/providers/google-shared.ts)
  • joshavant: Current blame for the helper and clamp utility points to a broad commit merged as a mobile PR; the title is unrelated, so this is a routing clue rather than strong ownership. (role: current blame carrier; confidence: low; commits: 6438c89f052c; files: packages/ai/src/providers/google-shared.ts, packages/ai/src/model-utils.ts)
  • steipete: The broader direct reasoning: "off" issue and PR were closed after an adjacent provider API contract review, which is relevant context for keeping this fix narrow. (role: prior adjacent reviewer; confidence: medium; files: packages/ai/src/providers/google-shared.ts, packages/llm-core/src/types.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (2 earlier review cycles)
  • reviewed 2026-07-08T03:44:40.102Z sha aceec84 :: needs real behavior proof before merge. :: [P1] Implement the actual clamp-to-off guard
  • reviewed 2026-07-08T04:04:16.019Z sha da69a18 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 8, 2026
@aniruddhaadak80
aniruddhaadak80 force-pushed the fix/gemini-thinking-clamped branch from aceec84 to da69a18 Compare July 8, 2026 03:58
@aniruddhaadak80

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 8, 2026
@vincentkoc vincentkoc self-assigned this Jul 8, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Closing as the weaker partial duplicate of #101832.

#101832 covers both the helper and final Gemini sanitizer paths with regression tests. This PR changes only the helper path, has no focused tests, and carries stale declaration/export drift. The canonical work remains open for dedicated provider-owner review because it changes Gemini request policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gemini thinking is incorrectly enabled at HIGH level when clamped to off

2 participants