openclaw - ✅(Solved) Fix [Bug]: Google Provider: gemma-4-26b-a4b-it incorrectly displays 1024k context window [1 pull requests, 1 comments, 2 participants]

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…
GitHub stats
openclaw/openclaw#66740Fetched 2026-04-15 06:24:37
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Timeline (top)
commented ×1cross-referenced ×1labeled ×1

The google/gemma-4-26b-a4b-it model incorrectly displays a 1024k context window in 'openclaw models list' due to a registry lookup failure triggering an incorrect template fallback.

Root Cause

The model displays 1024k. This occurs because ModelRegistry.find() fails to match the ID 'gemma-4-26b-a4b-it', causing the system to fall back to the Google provider's forward-compat logic, which incorrectly maps gemma- prefixed models to the gemini-3-flash-preview template (1M window).

Fix Action

Fixed

PR fix notes

PR #66924: fix(google): do not inherit template 1M context window for gemma models

Description (problem / solution / changelog)

Summary

  • Gemma models use the gemini-3-flash-preview template as a forward-compat approximation, but this causes them to incorrectly display a 1024k context window instead of their actual ~128k
  • Added GEMMA_DEFAULT_CONTEXT_WINDOW = 131_072 constant and applied it as a patch for all gemma models in the forward-compat resolver
  • Added test verifying gemma models don't inherit the template's 1M window

Fixes #66740

Test plan

  • Added unit test: does not inherit the template's 1M context window for gemma models
  • Verify openclaw models list shows correct context window for gemma models

🤖 Generated with Claude Code

Changed files

  • extensions/google/provider-models.test.ts (modified, +18/-0)
  • extensions/google/provider-models.ts (modified, +5/-1)

Code Example

Run results from isolated test script using dist/pi-model-discovery-tCHcDn8S.js:

--- Registry Find Results ---
gemma-4-31b-it            =>FOUND (ContextWindow: 256000)
gemma-4-26b-it            =>FOUND (ContextWindow: 256000)
gemma-4-26b-a4b-it        =>UNDEFINED
----------------------------
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

The google/gemma-4-26b-a4b-it model incorrectly displays a 1024k context window in 'openclaw models list' due to a registry lookup failure triggering an incorrect template fallback.

Steps to reproduce

  1. Add the following model to the google provider in models.json: { "id": "gemma-4-26b-a4b-it", "contextWindow": 262144, ... }
  2. Run openclaw models list.
  3. Observe the context window column for google/gemma-4-26b-a4b-it.

Expected behavior

The model should display 256k (or 250k if coarse-rounded), matching the contextWindow value defined in models.json.

Actual behavior

The model displays 1024k. This occurs because ModelRegistry.find() fails to match the ID 'gemma-4-26b-a4b-it', causing the system to fall back to the Google provider's forward-compat logic, which incorrectly maps gemma- prefixed models to the gemini-3-flash-preview template (1M window).

OpenClaw version

2026.4.14

Operating system

Linux (Ubuntu 24.04)

Install method

npm global

Model

google/gemma-4-26b-a4b-it

Provider / routing chain

openclaw -> google

Additional provider/model setup details

The issue is specific to IDs containing non-standard segments (e.g., '-a4b-'). For comparison, google/gemma-4-31b-it matches correctly and displays the expected 250k. The root cause is a lookup failure in the @mariozechner/pi-ai ModelRegistry, which then triggers an incorrect template override in the Google provider.

Logs, screenshots, and evidence

Run results from isolated test script using dist/pi-model-discovery-tCHcDn8S.js:

--- Registry Find Results ---
gemma-4-31b-it            => ✅ FOUND (ContextWindow: 256000)
gemma-4-26b-it            => ✅ FOUND (ContextWindow: 256000)
gemma-4-26b-a4b-it        => ❌ UNDEFINED
----------------------------

Impact and severity

Affected: Users utilizing Gemma 4 models with specific identifiers. Severity: Low (Display bug). Consequence: Misleads users regarding the model's actual context window capacity, potentially leading to unexpected truncation when exceeding 256k.

Additional information

This is a cascaded failure: first, @mariozechner/pi-ai's ModelRegistry.find() fails to match the ID 'gemma-4-26b-a4b-it' (returning undefined), and second, the Google provider's forward-compatibility logic incorrectly maps any 'gemma-' prefixed model to the gemini-3-flash-preview template (1M window).

extent analysis

TL;DR

Update the @mariozechner/pi-ai ModelRegistry to correctly handle non-standard ID segments, such as '-a4b-', to prevent lookup failures and subsequent incorrect template overrides.

Guidance

  • Verify the ModelRegistry.find() function in @mariozechner/pi-ai to ensure it can handle IDs with non-standard segments, such as '-a4b-'.
  • Check the Google provider's forward-compatibility logic to prevent incorrect mapping of 'gemma-' prefixed models to the gemini-3-flash-preview template.
  • Test the openclaw models list command with different model IDs to identify any other potential lookup failures.
  • Consider adding error handling or logging to the ModelRegistry.find() function to provide more informative error messages when a lookup fails.

Example

No code snippet is provided as the issue is related to a specific library (@mariozechner/pi-ai) and its internal implementation.

Notes

The issue is specific to the @mariozechner/pi-ai library and its handling of non-standard ID segments. The provided logs and evidence suggest that the ModelRegistry.find() function is the root cause of the issue.

Recommendation

Apply a workaround by updating the models.json file to use a different ID for the google/gemma-4-26b-a4b-it model that does not contain non-standard segments, until the @mariozechner/pi-ai library is updated to correctly handle such IDs.

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…

FAQ

Expected behavior

The model should display 256k (or 250k if coarse-rounded), matching the contextWindow value defined in models.json.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING