openclaw/src/utils
Byungsker 17578d77e1
fix(agents): add forward-compat fallback for google-gemini-cli gemini-3.1-pro/flash-preview (#26570)
* fix(agents): add "google" provider to isReasoningTagProvider to prevent reasoning leak

The gemini-api-key auth flow creates a profile with provider "google"
(e.g. google/gemini-3-pro-preview), but isReasoningTagProvider only
matched "google-gemini-cli" (OAuth) and "google-generative-ai". As a
result:
- reasoningTagHint was false → system prompt omitted <think>/<final>
  formatting instructions
- enforceFinalTag was false → <final> tag filtering was skipped

Raw <think> reasoning output was delivered to the end user.

Fix: add the bare "google" provider string to the match list and cover
it with two new test cases (exact match + case-insensitive).

Fixes #26551

* fix(agents): add forward-compat fallback for google-gemini-cli gemini-3.1-pro/flash-preview

gemini-3.1-pro-preview and gemini-3.1-flash-preview are not yet present in
pi-ai's built-in google-gemini-cli model catalog (only gemini-3-pro-preview
and gemini-3-flash-preview are registered). When users configure these models
they get "Unknown model" errors even though Gemini CLI OAuth supports them.

The codebase already has isGemini31Model() in extra-params.ts, which proves
intent to support these models. Add a resolveGoogleGeminiCli31ForwardCompatModel
entry to resolveForwardCompatModel following the same clone-template pattern
used for zai/glm-5 and anthropic 4.6 models.

- gemini-3.1-pro-* clones gemini-3-pro-preview (with reasoning: true)
- gemini-3.1-flash-* clones gemini-3-flash-preview (with reasoning: true)

Also add test helpers and three test cases to model.forward-compat.test.ts.

Fixes #26524

* Changelog: credit Google Gemini provider fallback fixes

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-02-26 18:39:13 -05:00
..
account-id.ts feat: thread-bound subagents on Discord (#21805) 2026-02-21 16:14:55 +01:00
boolean.ts
chunk-items.ts refactor(utils): share chunkItems helper 2026-02-16 01:52:30 +00:00
delivery-context.test.ts
delivery-context.ts
directive-tags.test.ts fix: stabilize flaky tests and sanitize directive-only chat tags 2026-02-22 12:19:33 +01:00
directive-tags.ts fix: stabilize flaky tests and sanitize directive-only chat tags 2026-02-22 12:19:33 +01:00
fetch-timeout.ts fix: use relayAbort helper for addEventListener to preserve AbortError reason 2026-02-13 18:13:18 +01:00
mask-api-key.test.ts feat(secrets): finalize external secrets runtime and migration hardening 2026-02-26 14:47:22 +00:00
mask-api-key.ts feat(secrets): finalize external secrets runtime and migration hardening 2026-02-26 14:47:22 +00:00
message-channel.test.ts test: dedupe repeated test fixtures and assertions 2026-02-22 18:37:25 +00:00
message-channel.ts
normalize-secret-input.ts fix(auth): strip line breaks from pasted keys 2026-02-09 11:26:27 -06:00
provider-utils.ts fix(agents): add forward-compat fallback for google-gemini-cli gemini-3.1-pro/flash-preview (#26570) 2026-02-26 18:39:13 -05:00
queue-helpers.test.ts test(queue): cover collect drain helper states 2026-02-19 07:01:54 +00:00
queue-helpers.ts refactor(queue): share drain helpers across announce and reply 2026-02-22 17:54:51 +00:00
reaction-level.test.ts test: table-drive utils and channel-match cases 2026-02-21 23:02:44 +00:00
reaction-level.ts refactor(reactions): share reaction level resolver 2026-02-14 15:39:45 +00:00
run-with-concurrency.test.ts test: dedupe and optimize test suites 2026-02-19 15:19:38 +00:00
run-with-concurrency.ts refactor(core): unify bounded concurrency runner 2026-02-18 16:48:35 +00:00
safe-json.ts refactor(utils): share safe json stringify 2026-02-14 15:39:46 +00:00
shell-argv.ts refactor(utils): share shell argv tokenizer 2026-02-14 15:39:46 +00:00
transcript-tools.test.ts
transcript-tools.ts
usage-format.test.ts chore: Fix types in tests 27/N. 2026-02-17 14:31:55 +09:00
usage-format.ts
utils-misc.test.ts fix(agents): add forward-compat fallback for google-gemini-cli gemini-3.1-pro/flash-preview (#26570) 2026-02-26 18:39:13 -05:00
with-timeout.ts refactor(probe): share withTimeout 2026-02-16 00:39:11 +00:00