openclaw - 💡(How to fix) Fix [Bug]: Self-prefix normalization gap remaining in google/xai/openai providers after #88587 — same double-prefix + fallback leak applies beyond Anthropic

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

#88560 reported a double-prefix + fallback-iterator-state-leak bug in v2026.5.28. PR #88587 merged a narrow fix for the Anthropic case — adding self-prefix-strip to the anthropic branch of normalizeBuiltInProviderModelId. The same root-cause gap remains in the google, google-gemini-cli, google-vertex, xai, openai, and vercel-ai-gateway branches. Any agent whose catalog or fallback chain references those providers in the canonical provider/model-id form (per docs/gateway/configuration.md) will hit the same doubled-prefix lookups and fallback-candidate state leak.

Root Cause

#88560 reported a double-prefix + fallback-iterator-state-leak bug in v2026.5.28. PR #88587 merged a narrow fix for the Anthropic case — adding self-prefix-strip to the anthropic branch of normalizeBuiltInProviderModelId. The same root-cause gap remains in the google, google-gemini-cli, google-vertex, xai, openai, and vercel-ai-gateway branches. Any agent whose catalog or fallback chain references those providers in the canonical provider/model-id form (per docs/gateway/configuration.md) will hit the same doubled-prefix lookups and fallback-candidate state leak.

Fix Action

Fix / Workaround

Empirical: on our pod I redeployed one agent with tier3.models[0] = google/gemini-2.0-flash as a workaround for the original Anthropic case. The bug fired identically with google/ as the leaked prefix instead of anthropic/:

Code Example

Unknown model: anthropic/google/gemini-2.0-flash   (114 errors)
Unknown model: xai/google/gemini-2.0-flash         (76)
Unknown model: google/google/gemini-2.0-flash      (76)

---

// After provider-specific alias resolution:
const prefix = `${normalizedProvider}/`;
const stripped = normalizeLowercaseStringOrEmpty(result).startsWith(prefix)
  ? result.slice(prefix.length)
  : result;
return stripped;
RAW_BUFFERClick to expand / collapse

Bug type

Bug (partial-fix follow-up to #88560 / PR #88587).

Beta release blocker

No.

Summary

#88560 reported a double-prefix + fallback-iterator-state-leak bug in v2026.5.28. PR #88587 merged a narrow fix for the Anthropic case — adding self-prefix-strip to the anthropic branch of normalizeBuiltInProviderModelId. The same root-cause gap remains in the google, google-gemini-cli, google-vertex, xai, openai, and vercel-ai-gateway branches. Any agent whose catalog or fallback chain references those providers in the canonical provider/model-id form (per docs/gateway/configuration.md) will hit the same doubled-prefix lookups and fallback-candidate state leak.

Reproduction

Empirical: on our pod I redeployed one agent with tier3.models[0] = google/gemini-2.0-flash as a workaround for the original Anthropic case. The bug fired identically with google/ as the leaked prefix instead of anthropic/:

Unknown model: anthropic/google/gemini-2.0-flash   (114 errors)
Unknown model: xai/google/gemini-2.0-flash         (76)
Unknown model: google/google/gemini-2.0-flash      (76)

Same fallback-iterator leak signature: the prefixed model id leaks across all candidates in the fallback chain, only the leading provider qualifier swaps per candidate. Reproduces deterministically on every heartbeat fire (~30/hour per affected agent).

Source pointers

In packages/model-catalog-core/src/provider-model-id-normalization.ts on main post-merge of #88587:

  • anthropic branch: now strips self-prefix ✅ (the merged fix)
  • google / google-gemini-cli / google-vertex branches: call normalizeGooglePreviewModelId(model) which handles preview aliases but does not strip a redundant google/ self-prefix ❌
  • xai branch: alias lookup only; does not strip a redundant xai/ self-prefix ❌
  • openai branch (if present): no self-prefix-strip ❌
  • vercel-ai-gateway branch: alias lookup only ❌
  • nvidia / huggingface / openrouter / together / anthropic: already handled

Suggested fix shape

Mirror the merged Anthropic fix in each remaining provider branch — or factor it out as a generic post-pass:

// After provider-specific alias resolution:
const prefix = `${normalizedProvider}/`;
const stripped = normalizeLowercaseStringOrEmpty(result).startsWith(prefix)
  ? result.slice(prefix.length)
  : result;
return stripped;

The regression test scaffolding added in #88587 (provider-model-id-normalization.test.ts, model-fallback.test.ts) can be extended to cover each provider with one parameterized case each.

OpenClaw version

Reproduced against PR #88587 head 4ee13a12c0 and v2026.5.28. The merged fix narrows the surface but leaves the gap above.

Operating system

macOS Darwin 25.5.0 (arm64), Mac Mini M4.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: Self-prefix normalization gap remaining in google/xai/openai providers after #88587 — same double-prefix + fallback leak applies beyond Anthropic