Add Grok 4.20 reasoning and non-reasoning to xAI model catalog#50772
Add Grok 4.20 reasoning and non-reasoning to xAI model catalog#50772huntharo merged 5 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR adds
Confidence Score: 5/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: extensions/xai/model-definitions.ts
Line: 73-84
Comment:
**Catalog ordering differs from docs**
The new `grok-4.20-reasoning` / `grok-4.20-non-reasoning` entries are placed **after** the `grok-4.20-experimental-beta-0304-*` entries in the catalog, but the docs (`docs/providers/xai.md`) list them **before** the experimental beta variants. Since the stable models are conventionally preferred over the experimental ones, aligning the catalog order with the docs would make both easier to reason about:
```suggestion
{
id: "grok-4.20-reasoning",
name: "Grok 4.20 (Reasoning)",
reasoning: true,
contextWindow: XAI_LARGE_CONTEXT_WINDOW,
},
{
id: "grok-4.20-non-reasoning",
name: "Grok 4.20 (Non-Reasoning)",
reasoning: false,
contextWindow: XAI_LARGE_CONTEXT_WINDOW,
},
{
id: "grok-4.20-experimental-beta-0304-reasoning",
name: "Grok 4.20 Experimental Beta 0304 (Reasoning)",
reasoning: true,
contextWindow: XAI_LARGE_CONTEXT_WINDOW,
},
{
id: "grok-4.20-experimental-beta-0304-non-reasoning",
name: "Grok 4.20 Experimental Beta 0304 (Non-Reasoning)",
reasoning: false,
contextWindow: XAI_LARGE_CONTEXT_WINDOW,
},
```
This is a cosmetic point and has no functional impact, but it keeps the code and docs in sync.
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: "xai: add grok-4.20-r..." |
e7535e9 to
7e26c0b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 363edc0cb5
ℹ️ 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 (provider === "xai") { | ||
| return normalizeXaiModelId(model); |
There was a problem hiding this comment.
Preserve legacy xAI keys when normalizing model refs
This new normalization rewrites xai/grok-4.20-experimental-beta-0304-* to the GA IDs before selection, but resolveThinkingDefault still reads cfg.agents.defaults.models by the normalized key and does not check the deprecated xAI key form. In an upgraded config that still stores per-model params.thinking under the old key, that override is now silently ignored and the runtime falls back to global/default thinking. Please add a legacy-key fallback (or migrate keys) so backward compatibility also preserves per-model settings.
Useful? React with 👍 / 👎.
df9b0fc to
e2fff01
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2fff01389
ℹ️ 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 (provider === "xai") { | ||
| return normalizeXaiModelId(model); |
There was a problem hiding this comment.
Keep legacy xAI model keys when reading per-model params
Normalizing deprecated grok-4.20-experimental-beta-0304-* IDs at model-ref parse time changes the selected key to xai/grok-4.20-*, but downstream lookups still read cfg.agents.defaults.models by exact provider/model (for example in resolveExtraParams and resolveFastModeState). In upgraded configs that still store params under the old xAI keys, settings like temperature, maxTokens, and fastMode are silently ignored, so the backward-compat path is incomplete unless we also fall back to the legacy key (or migrate it).
Useful? React with 👍 / 👎.
00b1b16 to
fa3919b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fa3919b83f
ℹ️ 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".
| @@ -121,6 +121,9 @@ function normalizeProviderModelId(provider: string, model: string): string { | |||
| if (provider === "google" || provider === "google-vertex") { | |||
| return normalizeGoogleModelId(model); | |||
| } | |||
| if (provider === "xai") { | |||
| return normalizeXaiModelId(model); | |||
There was a problem hiding this comment.
Normalize legacy xAI IDs before unique-provider inference
parseModelRef now rewrites legacy Grok 4.20 beta IDs to GA IDs, but inferUniqueProviderFromConfiguredModels still compares the caller-supplied model string verbatim against parsed allowlist entries. With a legacy session/runtime model like grok-4.20-experimental-beta-0304-reasoning (no modelProvider) and an allowlist containing that same legacy key, the allowlist side is normalized to grok-4.20-reasoning while the runtime side is not, so provider inference fails and downstream identity/cost paths in resolveSessionModelIdentityRef lose the provider unexpectedly.
Useful? React with 👍 / 👎.
fa3919b to
b322ea1
Compare
Grok 4.20 is now GA. This adds both variants to the bundled catalog and removes the superseded experimental beta entries that shipped during the preview period. - Add grok-4.20-reasoning (2M context, reasoning enabled) - Add grok-4.20-non-reasoning (2M context, reasoning disabled) - Remove grok-4.20-experimental-beta-0304-reasoning - Remove grok-4.20-experimental-beta-0304-non-reasoning - Update provider docs and tests
b322ea1 to
095e645
Compare
|
Merged via squash.
Thanks @Jaaneek! |
…law#50772) Merged via squash. Prepared head SHA: 095e645 Co-authored-by: Jaaneek <25470423+Jaaneek@users.noreply.github.com> Co-authored-by: huntharo <5617868+huntharo@users.noreply.github.com> Reviewed-by: @huntharo
…law#50772) Merged via squash. Prepared head SHA: 095e645 Co-authored-by: Jaaneek <25470423+Jaaneek@users.noreply.github.com> Co-authored-by: huntharo <5617868+huntharo@users.noreply.github.com> Reviewed-by: @huntharo
…law#50772) Merged via squash. Prepared head SHA: 095e645 Co-authored-by: Jaaneek <25470423+Jaaneek@users.noreply.github.com> Co-authored-by: huntharo <5617868+huntharo@users.noreply.github.com> Reviewed-by: @huntharo
…law#50772) Merged via squash. Prepared head SHA: 095e645 Co-authored-by: Jaaneek <25470423+Jaaneek@users.noreply.github.com> Co-authored-by: huntharo <5617868+huntharo@users.noreply.github.com> Reviewed-by: @huntharo
Summary
grok-4.20-experimental-beta-0304-*) exist in the catalog.grok-4.20-reasoningandgrok-4.20-non-reasoningto the xAI catalog, removed the superseded beta entries, updated docs and tests.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
xai/grok-4.20-reasoningandxai/grok-4.20-non-reasoningnow appear inopenclaw models listand can be set as the default model.grok-4.20-experimental-beta-0304-reasoningandgrok-4.20-experimental-beta-0304-non-reasoningare removed from the bundled catalog (still forward-resolved by thegrok-4.20prefix matcher).Security Impact (required)
Repro + Verification
Environment
Steps
Expected
yesauth statusActual
grok-4.20-0309-reasoningresolves correctlyEvidence
pnpm test -- extensions/xai/provider-models.test.ts— 5/5 passedpnpm check— all passedcurl https://api.x.ai/v1/chat/completionswithgrok-4.20-reasoningreturns valid responseHuman Verification (required)
Review Conversations
Compatibility / Migration
Failure Recovery (if this breaks)
extensions/xai/model-definitions.tsRisks and Mitigations
None