Repository navigation
fix(anthropic): newly listed Claude models stay hidden until an OpenClaw release - #167658
Conversation
…om their advertised capabilities
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR uses Anthropic’s advertised thinking capabilities to make newly listed Claude models selectable and shape their requests without waiting for an OpenClaw release. Example: Anthropic lists claude-sonnet-9 with adaptive thinking and xhigh/max effort.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review The previous product-decision blocker is resolved by the recorded choice from a repository writer with prior merged catalog work. The compatibility repair remains intact, and no actionable patch defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Anthropic plugin converts the provider’s model listing into OpenClaw’s model catalog. Shared Claude contracts consume that catalog metadata to offer thinking controls and construct inference requests. flowchart TD
A[Anthropic model listing] --> B[Anthropic catalog projection]
C[Shipped model templates] --> B
B --> D[Model picker and thinking controls]
B --> E[Shared Claude request contracts]
D --> E
E --> F[Anthropic inference request]
Technical reviewBest possible solution: Keep the plugin-owned projection and shared Claude contracts with the recorded live-capability precedence and preserved template metadata. Do we have a high-confidence way to reproduce the issue? Yes for the admission mechanism: current-main source rejects unfamiliar IDs whose advertised capabilities disagree with its predicates, and the supplied synthetic Gateway run demonstrates that path. The real API currently lists no ID hidden by the baseline. Is this the best way to solve the issue? Yes: composing the existing projection preserves template metadata and keeps request decisions in the shared Claude contract owner. The recorded discussion now settles live-versus-curated precedence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a799f4a42891. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +81, Tests +88, Docs +4. Total +173 across 14 files. Added test files: 1. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)Reviewed October 9, 2026, 2:24 PM ET / 18:24 UTC (Revision 4). |
…ed models Listed Claude models the manifest does not ship lost Code Mode tools because the Anthropic projection built their rows from scratch. Compose with the shared live projection so they keep the closest shipped model's compat and thinking map, and only add the listed capability flags.
|
Maintainer decision: use live flags for listed models. Anthropic's advertised capabilities (adaptive thinking, xhigh/max effort, disabled thinking) take precedence over the curated ID rules for every listed Anthropic API-key model, shipped or new; curated metadata the listing doesn't cover (Code Mode, limits, image sizing, cost, other request contracts) and authored settings stay as they are. Real-key parity on the current listing shows identical requests to the merge base for every listed model and level. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in b340251. Anthropic API-key users now see newly listed Claude models as soon as /v1/models returns them, and requests follow the thinking type and effort levels Anthropic advertises (ID rules remain the fallback). Proof: real-key listing of 14 models, 46/46 captured requests identical to the merge base (incl. Code Mode tools), real 200s, and an unknown-ID simulation that built its request from advertised capabilities. Known gap: the CLI thinking-level check for shipped IDs still uses ID rules. |
…ls fail their first turn (#167941) ## What Problem This Solves Fixes: GitHub Copilot models fail on their first turn when the account lists a chat model that only serves Chat Completions (`kimi-k3` today), or a Claude model OpenClaw does not recognize yet (a newly launched Claude). ## User Impact User impact: every chat model a Copilot account shows in the picker now answers its first turn, including Claude models released after the installed OpenClaw version. No config, schema, or protocol changes. Merge danger: low. Shipped models keep their current transport and thinking shape (the transport only changes when the account's listing says the default endpoint is unsupported; Claude capabilities are only derived for rows that list `xhigh`, which every currently listed adaptive Claude model already matches by ID). Older listings without `supported_endpoints` keep the ID rules. ## Why This Change Was Made Copilot's `/models` already says how each model can be called: - `supported_endpoints` names the endpoints a model accepts. OpenClaw picked the transport from the model ID only, so a non-Claude, non-Gemini ID always went to `/responses`. `kimi-k3` lists only `/chat/completions` and was rejected (`unsupported_api_for_model`). The Copilot plugin now keeps the family transport when it is listed and otherwise uses a listed endpoint, with the existing Copilot Chat Completions request options. - Copilot lists effort levels instead of Anthropic's capability tree, so Claude request shaping fell back to ID rules. An unknown Claude ID got manual `thinking.type: enabled` budgets, which current Claude models reject (`Use thinking.type.adaptive and output_config.effort`). Claude rows that list `xhigh` (only adaptive-thinking Claude models offer it) now carry the existing `params.claudeCapabilities` contract (#167658), so they get adaptive thinking and the listed xhigh/max levels before OpenClaw learns their ID. The `fetchCopilotUsage` tests moved from `models.test.ts` to `usage.test.ts` (their owner) to keep `models.test.ts` under the line cap; no test was removed. ## Evidence Real GitHub Copilot (Individual) account, device-flow sign-in on isolated profiles and loopback Gateways. - Sign-in with the Gateway running: Copilot picker 0 → 29 rows, no restart. Account `/models` returned 54 rows; the picker equals the listed `type: chat` + `model_picker_enabled: true` rows exactly (context/prompt limits and vision match). Hidden: 3 embeddings, 7 internal Fireworks rows (copilot-search/exec-agent/trajectory-compaction), `gpt-5.6-luna-utility`, `gpt-5.4-nano`, and legacy GPT-3.5/4/4o/4.1 rows, all `model_picker_enabled: false`. - One `reply OK` turn per picker model on `origin/main` (164210c): 27/29 ok. `kimi-k3` failed with HTTP 400 `unsupported_api_for_model` on `openai-responses`. `claude-haiku-4.5` at `--thinking low` was refused locally (the listing gives it no efforts); it passes at default/off. - With this branch: `kimi-k3` 200 on `openai-completions` (low and medium). Regression set across transports and vendors: `gpt-5-mini`, `grok-4.7`, `mai-code-1.1-flash` (Responses), `gemini-3.8-flash` (Chat Completions), `claude-haiku-5.5` (Messages): all 200. - New-model simulation (throwaway worktree, never pushed): removed `gpt-5.6-terra` and `claude-haiku-5.5` from the bundled manifests, ID rules/aliases, the recommended list, and a local copy of catalog.openclaw.ai served through `models.catalogRefresh.url`. Both still appeared after sign-in (29 rows). On main, `gpt-5.6-terra` worked (default/low) but `claude-haiku-5.5` failed with HTTP 400 (`thinking.type.enabled is not supported`). With this branch applied, both returned 200 at default, low, max, and off. - `node scripts/run-vitest.mjs extensions/github-copilot`: 17 files, 214 tests pass. The new Claude test fails without the fix (manual budget payload) and passes with it. Co-authored-by: Ayaan Zaidi <[email protected]>
…167949) ## What Problem This Solves Fixes: some Grok models on an xAI subscription (OAuth) sign-in offer only `off`/`ultra` thinking, reject `--thinking low`, and run with reasoning on even at "off". This happens whenever the account's model listing names effort levels for a model OpenClaw's built-in model-ID rules don't cover (today: `grok-4.7-build-fast`). ## User Impact User impact: for Grok subscription sign-ins, the thinking levels in the picker and the reasoning effort sent with each request now follow the efforts the account's listing reports. Models whose listing has no `none` effort no longer offer `off`. Every other Grok model keeps exactly the same levels and requests as before. Accounts that signed in before this change need to sign in again to refresh their saved model rows (documented). ## Why This Change Was Made `cli-chat-proxy.grok.com/v1/models` reports `supports_reasoning_effort` and `reasoning_efforts` for each model, but the xAI plugin chose effort support by model ID alone. `grok-4.7-build-fast` lists `low/medium/high/xhigh` (default `high`). OpenClaw offered `off`/`ultra`, and "off" left out the effort field, so the proxy ran it at its default `high`. - The OAuth listing projection now copies the listed efforts into the existing `compat.supportedReasoningEfforts` field. - The xAI runtime compat reads that field first and maps each level to the listed effort, or to the nearest listed one. `off` sends `none` only when `none` is listed; otherwise `off` is unsupported, the same as current Grok 4.5+ behavior. Model-ID rules apply only to rows that list no efforts. - The xAI thinking profile offers the listed levels. Rows that runtime normalization stamped with their own ID-rule list keep their existing ladder; this keeps Grok 4.3's `minimal` level and `low` default. There are no schema, config, SDK, or core changes. **Known gap (not fixed here):** agent runs take thinking options from the model rows saved in config at sign-in (`src/agents/command/prepare.ts:303` `buildConfiguredModelCatalog`; `src/agents/command/model-selection.ts:524-531` skips hydration through `needsThinkHydration` because the saved row counts as resolved). The picker uses the live listing instead. So until an account signs in again, the picker can offer `low` while `--thinking low` is still rejected. This is the same shared gap the Anthropic listed-capabilities work (#167658) hit, and it is tracked as one core follow-up. ## Evidence - Regression tests, both failing on `origin/main` code and passing here: - `extensions/xai/index.test.ts`: a listed row with efforts reaches the thinking profile (`low..xhigh`, default `high`) and runtime compat (`off: null`, `low: "low"`, …). - `extensions/xai/runtime-model-compat.test.ts`: `off` sends `none` only when it is listed; unknown efforts are dropped; nearest-effort mapping. - `extensions/xai/provider-policy-api.test.ts`: Grok 4.3's ladder is unchanged after runtime normalization stamps its efforts. - Real Grok subscription account (device-code sign-in), isolated `--profile` Gateways. A loopback forward proxy (`proxy.proxyUrl` plus a proof-only CA) recorded each outgoing `/v1/responses` shape. Cells marked stub got a canned stream; the rest were forwarded unchanged to the real proxy. - Listing: 4 rows (`grok-4.7`, `grok-4.7-build-fast`, `grok-4.6`, `grok-4.5`), all `api_backend: responses`, all `supports_reasoning_effort: true`. - Picker levels on merge base `164210c` and on this branch for all 8 shown xAI rows: identical except `grok-4.7-build-fast` (`off,ultra` default `off` → `low,medium,high,xhigh,ultra` default `high`). - Request parity: 8 models × `default/off/minimal/low/medium/high/xhigh/ultra`, 64 cells per build. Accepted/rejected levels and the `reasoning` field match for every cell. Two cells differ only because a background `grok-4.6` request (effort `high`, 12 tools) landed in a different cell on each build; that request has the same shape on both builds. - Fresh sign-in on this branch: models appear without restart; saved rows carry the listed efforts. Real turns: `grok-4.7-build-fast` default → sent `effort: high`, 200, proxy echoed `high`. `--thinking low` → sent `low`, 200, proxy echoed `low`. `--thinking off` → rejected: "Use one of: low, medium, high, xhigh, ultra". Control `grok-4.7` default → `high`, 200 on both builds. - Before (merge base): `grok-4.7-build-fast` default sent no `reasoning`; `--thinking low` was rejected ("Use one of: off, ultra"). - `pnpm exec oxlint --type-aware` on the changed files; `node scripts/check-changed.mjs`; `node scripts/run-vitest.mjs extensions/xai/` (563 passed before the final small type/lint fixups; focused files rerun after them). **Merge danger:** low. Only the xAI plugin changes. On the real account, request bodies for every model except `grok-4.7-build-fast` are byte-identical in the recorded fields. Risk: a future listing that reports efforts differing from the ID rules for a known model (for example, dropping `xhigh`) will now change that model's ladder. That is intended. Co-authored-by: Ayaan Zaidi <[email protected]>
…law release (openclaw#167658) ## What Problem This Solves Fixes: new Claude models that an Anthropic API key already lists stay hidden from the model picker until an OpenClaw release, and a typed-in unknown ID can be sent a request shape the model rejects. ## User Impact User impact: Anthropic API-key users see newly listed Claude models as soon as `/v1/models` returns them, and the first turn uses the thinking type and effort levels Anthropic advertises for that model. Shipped rows Anthropic does not list, configured rows, and catalogs saved before discovery runs keep today's model-ID rules. ## Why This Change Was Made Request shaping keyed only on model-ID rules, so openclaw#113757 hid any unknown model whose advertised capabilities disagreed with them. This change makes shaping follow the listing: - The Anthropic plugin owns its `/v1/models` projection through the existing `modelDiscovery.projectRows` hook. It runs the shared default projection first, so a listed ID that the manifest does not ship still inherits `compat` (including Code Mode) and `thinkingLevelMap` from the closest shipped model, exactly as before. It then adds the advertised flags to each listed row as `params.claudeCapabilities` (`adaptiveThinking`, `xhighEffort`, `maxEffort`, and `disabledThinking` when listed) and sets `thinkingLevelMap.xhigh`/`max` to match. - The shared Claude predicates `supportsClaudeAdaptiveThinking`, `supportsClaudeNativeXhighEffort`, `supportsClaudeNativeMaxEffort`, and `requiresClaudeMandatoryAdaptiveThinking` read a listed flag first and use the ID rule only when that flag is missing. Sonnet 5.5's between-tools off mode is preserved. `supportsClaude1MContext` still uses ID rules only. - The Claude thinking profile reads row params, so the picker offers the levels a listed model advertises. - The agreement gate is deleted. An unknown row with no readable capability data stays hidden. No schema changes. One export is added to the private-local `plugin-sdk/provider-catalog-live-runtime` subpath: `buildOpenAICompatibleLiveModels`, the existing default projection, so the Anthropic projection composes with it instead of copying its template inheritance. `params` is the existing free-form model-params field; `params.canonicalModelId` is the precedent. The Anthropic provider docs now name the key. `compat.supportedReasoningEfforts` was not used because Copilot's `anthropic-messages` Claude rows already set it without any adaptive marker, so the shared predicates would misread those rows. The public SDK option `acceptUnknownModel` is unchanged. The Anthropic plugin no longer sets it, and instead passes the same kind of gate (listed capabilities present) straight to the shared projection. Bedrock, Vertex, Copilot, Foundry, OpenRouter, and Claude CLI rows never carry `params.claudeCapabilities`, so they behave as before. ## Evidence - Regression tests, each failing on `origin/main` code and passing here: - `packages/llm-core/src/model-contracts/anthropic.test.ts`: listed flags override ID rules one flag at a time. - `packages/ai/src/anthropic-listed-capabilities-transport-parity.test.ts`: provider and transport builders send adaptive + `xhigh` for an unknown listed model, budget thinking when adaptive is withheld, and keep thinking on when disabled thinking is rejected. - `extensions/anthropic/live-discovery-auth.test.ts`: an unknown listed model appears with its capabilities; a row without capabilities stays hidden; a listed ID the manifest does not ship (`claude-sonnet-4-6`) keeps the shipped Sonnet row's `compat.codeMode: "preferred"` while its effort map follows the listing (this case fails on `80606329c81`). - `extensions/anthropic/provider-policy-api.test.ts`: the effort ladder follows listed capabilities. - Real `pnpm openclaw` Gateway turns in an isolated profile. Traffic to `api.anthropic.com` went through a loopback forward proxy (`proxy.proxyUrl` plus a proof CA) into a fake API that lists `claude-sonnet-5` (known), `claude-sonnet-9` (unknown, adaptive + xhigh + max), and `claude-haiku-9` (unknown, no adaptive, no effort): - `origin/main`: neither unknown ID is listed. A typed `claude-haiku-9` is sent `thinking: adaptive` with `effort` `high`/`low`, which this model rejects. `claude-sonnet-9 --thinking xhigh` is refused with "not supported". - This branch: both unknown IDs are listed. `claude-sonnet-9` gets adaptive thinking with effort `high`/`xhigh`/`max` and thinking `disabled` by default. `claude-haiku-9` gets `thinking: enabled` with `budget_tokens` 16384/8192 plus the interleaved-thinking beta. `claude-sonnet-5` is unchanged. - Real Anthropic API key, isolated `--profile` Gateways, the same loopback forward proxy now forwarding each request unchanged to the real `api.anthropic.com` and recording the outgoing `/v1/messages` shape and the real status. The baseline is this PR's merge base `1612ead394c`; the branch is `80606329c81`. - `/v1/models` lists 14 Claude IDs, and every row has a capability tree. The picker (`models list --provider anthropic --all --refresh --plain`, with and without a Gateway) shows the same 16 rows on both builds: the 14 listed IDs plus the shipped `claude-mythos-5` and `claude-haiku-4-5`. The real listing has no ID that the baseline hides. - Request parity covered all 14 listed models at `default`, `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`, `adaptive`, and `ultra`. Sonnet and Haiku models got real turns at `default`/`off`/`low`/`high`/`xhigh`/`max`. Opus and Fable models got one real turn each at `default` on each build. All other cells were captured with a proxy stub, so the request was recorded but not sent. The `anthropic-beta` header, `thinking` (type, budget, display, block binding), `output_config.effort`, `max_tokens`, `context_management`, `service_tier`, sampling fields, and top-level keys are identical for every model and level. Both builds reject the same levels (for example `off` on `claude-opus-5-5`/`claude-fable-5`/`claude-fable-5-1`, `xhigh` on `claude-sonnet-4-6`/`claude-opus-4-6`). All 80 real requests returned 200. - **Regression found on `80606329c81`, fixed in `2022ebb00d5`:** the five listed IDs the manifest does not ship (`claude-sonnet-4-6`, `claude-sonnet-4-5-20250929`, `claude-opus-4-7`, `claude-opus-4-6`, `claude-opus-4-5-20251101`) were sent `[tool_call, tool_describe, tool_search]` instead of the baseline's Code Mode tools `[exec, wait]`. The baseline's default projection copies `compat` and `thinkingLevelMap` from the shipped model with the longest shared ID prefix; `projectAnthropicLiveModels` had built those rows from scratch. It now runs that default projection and only adds the listed flags. - Rerun on `2022ebb00d5` (same real key, same proxy, compared with the frozen baseline captures): 46 requests across those five models at every level the baseline accepts, plus `claude-haiku-4-5-20251001` and `claude-sonnet-5` at `default`. Real turns: `claude-sonnet-4-6`, `claude-opus-4-6`, and `claude-sonnet-5` (unchanged control) at `default`, all 200. Everything else used the proxy stub. Every request equals its baseline capture on every recorded field: `anthropic-beta`, `thinking`, `output_config`, `max_tokens`, `context_management`, sampling fields, top-level keys, message/system counts, and the tool list hash. The five models now send `[exec, wait]`, and Haiku 4.5 still sends `[tool_call, tool_describe, tool_search]` on both builds. The branch still refuses the same levels as the baseline (`xhigh` on `claude-sonnet-4-6`/`claude-opus-4-6`; `xhigh`/`max`/`adaptive` on `claude-sonnet-4-5-20250929`/`claude-opus-4-5-20251101`). - Unknown-model path: the real listing has no hidden ID, so a throwaway local build of `80606329c81` masked the ID rules for `claude-opus-4-7`. With the mask, the request came only from the advertised capabilities: thinking `disabled` by default and adaptive thinking with `xhigh`/`max` effort, the same as the unmasked branch. Real turns at `default`, `xhigh`, and `max` returned 200. This simulation was not repeated on `2022ebb00d5`. The fix changes only what an unknown row inherits from its template (`compat`, thinking-map entries other than `xhigh`/`max`, and input). The listed flags that shape the request are set the same way. - Known gap, not fixed here: masking `claude-sonnet-5`, which the manifest ships, sent the advertised adaptive thinking but made the CLI refuse `xhigh`/`max`. The CLI level check (`src/agents/command/model-selection.ts`, via `prepareCommandModelCatalog`) reads the manifest catalog row, and `needsThinkHydration` skips the live, provider-scoped catalog whenever that row already declares `reasoning`. So listed capabilities never reach the ladder for a shipped ID. Fixing this means changing the shared thinking-catalog hydration policy, which is used by several callers (`model-selection.ts`, `run-embedded-attempt.ts`, `agent-runner-run-params.ts`) and every provider. That is out of scope here. Today the ID rules for every shipped model match their listing, so nothing is visible. - `node scripts/check-changed.mjs` on `2022ebb00d5`: typecheck, boundary, Plugin SDK export/surface, format, and ratchet lanes pass. The dead-export scan fails only on pre-existing unused exports in files this PR does not touch (`src/config/sessions/session-accessor.sqlite-entry-cache-publication.ts`, `src/infra/heartbeat-events-filter.ts`). With `OPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1` the run exits 0. `oxlint --type-aware` is clean on the changed files. ## Merge danger - For known models that Anthropic lists, the listed capabilities now override the ID rules. Request shapes change only if Anthropic's listing disagrees with the curated rules. - An unknown listed model inherits `compat` (including Code Mode), `thinkingLevelMap`, and input modalities from the shipped model with the longest shared ID prefix, as the shared projection already did before this PR. It gets zero pricing and ID-rule image sizing until OpenClaw ships its entry. Listed `xhigh`/`max` flags override the inherited thinking map. - For a shipped ID, the CLI/agent thinking-level check still uses the manifest row's ID rules, not the listed capabilities (see the known gap in Evidence). - The behavior depends on Anthropic's capability fields staying as documented. Real-key proof shows that today's listing matches the ID rules for every listed model. Co-authored-by: Ayaan Zaidi <[email protected]>
…ls fail their first turn (openclaw#167941) ## What Problem This Solves Fixes: GitHub Copilot models fail on their first turn when the account lists a chat model that only serves Chat Completions (`kimi-k3` today), or a Claude model OpenClaw does not recognize yet (a newly launched Claude). ## User Impact User impact: every chat model a Copilot account shows in the picker now answers its first turn, including Claude models released after the installed OpenClaw version. No config, schema, or protocol changes. Merge danger: low. Shipped models keep their current transport and thinking shape (the transport only changes when the account's listing says the default endpoint is unsupported; Claude capabilities are only derived for rows that list `xhigh`, which every currently listed adaptive Claude model already matches by ID). Older listings without `supported_endpoints` keep the ID rules. ## Why This Change Was Made Copilot's `/models` already says how each model can be called: - `supported_endpoints` names the endpoints a model accepts. OpenClaw picked the transport from the model ID only, so a non-Claude, non-Gemini ID always went to `/responses`. `kimi-k3` lists only `/chat/completions` and was rejected (`unsupported_api_for_model`). The Copilot plugin now keeps the family transport when it is listed and otherwise uses a listed endpoint, with the existing Copilot Chat Completions request options. - Copilot lists effort levels instead of Anthropic's capability tree, so Claude request shaping fell back to ID rules. An unknown Claude ID got manual `thinking.type: enabled` budgets, which current Claude models reject (`Use thinking.type.adaptive and output_config.effort`). Claude rows that list `xhigh` (only adaptive-thinking Claude models offer it) now carry the existing `params.claudeCapabilities` contract (openclaw#167658), so they get adaptive thinking and the listed xhigh/max levels before OpenClaw learns their ID. The `fetchCopilotUsage` tests moved from `models.test.ts` to `usage.test.ts` (their owner) to keep `models.test.ts` under the line cap; no test was removed. ## Evidence Real GitHub Copilot (Individual) account, device-flow sign-in on isolated profiles and loopback Gateways. - Sign-in with the Gateway running: Copilot picker 0 → 29 rows, no restart. Account `/models` returned 54 rows; the picker equals the listed `type: chat` + `model_picker_enabled: true` rows exactly (context/prompt limits and vision match). Hidden: 3 embeddings, 7 internal Fireworks rows (copilot-search/exec-agent/trajectory-compaction), `gpt-5.6-luna-utility`, `gpt-5.4-nano`, and legacy GPT-3.5/4/4o/4.1 rows, all `model_picker_enabled: false`. - One `reply OK` turn per picker model on `origin/main` (2fd61a9): 27/29 ok. `kimi-k3` failed with HTTP 400 `unsupported_api_for_model` on `openai-responses`. `claude-haiku-4.5` at `--thinking low` was refused locally (the listing gives it no efforts); it passes at default/off. - With this branch: `kimi-k3` 200 on `openai-completions` (low and medium). Regression set across transports and vendors: `gpt-5-mini`, `grok-4.7`, `mai-code-1.1-flash` (Responses), `gemini-3.8-flash` (Chat Completions), `claude-haiku-5.5` (Messages): all 200. - New-model simulation (throwaway worktree, never pushed): removed `gpt-5.6-terra` and `claude-haiku-5.5` from the bundled manifests, ID rules/aliases, the recommended list, and a local copy of catalog.openclaw.ai served through `models.catalogRefresh.url`. Both still appeared after sign-in (29 rows). On main, `gpt-5.6-terra` worked (default/low) but `claude-haiku-5.5` failed with HTTP 400 (`thinking.type.enabled is not supported`). With this branch applied, both returned 200 at default, low, max, and off. - `node scripts/run-vitest.mjs extensions/github-copilot`: 17 files, 214 tests pass. The new Claude test fails without the fix (manual budget payload) and passes with it. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#167949) ## What Problem This Solves Fixes: some Grok models on an xAI subscription (OAuth) sign-in offer only `off`/`ultra` thinking, reject `--thinking low`, and run with reasoning on even at "off". This happens whenever the account's model listing names effort levels for a model OpenClaw's built-in model-ID rules don't cover (today: `grok-4.7-build-fast`). ## User Impact User impact: for Grok subscription sign-ins, the thinking levels in the picker and the reasoning effort sent with each request now follow the efforts the account's listing reports. Models whose listing has no `none` effort no longer offer `off`. Every other Grok model keeps exactly the same levels and requests as before. Accounts that signed in before this change need to sign in again to refresh their saved model rows (documented). ## Why This Change Was Made `cli-chat-proxy.grok.com/v1/models` reports `supports_reasoning_effort` and `reasoning_efforts` for each model, but the xAI plugin chose effort support by model ID alone. `grok-4.7-build-fast` lists `low/medium/high/xhigh` (default `high`). OpenClaw offered `off`/`ultra`, and "off" left out the effort field, so the proxy ran it at its default `high`. - The OAuth listing projection now copies the listed efforts into the existing `compat.supportedReasoningEfforts` field. - The xAI runtime compat reads that field first and maps each level to the listed effort, or to the nearest listed one. `off` sends `none` only when `none` is listed; otherwise `off` is unsupported, the same as current Grok 4.5+ behavior. Model-ID rules apply only to rows that list no efforts. - The xAI thinking profile offers the listed levels. Rows that runtime normalization stamped with their own ID-rule list keep their existing ladder; this keeps Grok 4.3's `minimal` level and `low` default. There are no schema, config, SDK, or core changes. **Known gap (not fixed here):** agent runs take thinking options from the model rows saved in config at sign-in (`src/agents/command/prepare.ts:303` `buildConfiguredModelCatalog`; `src/agents/command/model-selection.ts:524-531` skips hydration through `needsThinkHydration` because the saved row counts as resolved). The picker uses the live listing instead. So until an account signs in again, the picker can offer `low` while `--thinking low` is still rejected. This is the same shared gap the Anthropic listed-capabilities work (openclaw#167658) hit, and it is tracked as one core follow-up. ## Evidence - Regression tests, both failing on `origin/main` code and passing here: - `extensions/xai/index.test.ts`: a listed row with efforts reaches the thinking profile (`low..xhigh`, default `high`) and runtime compat (`off: null`, `low: "low"`, …). - `extensions/xai/runtime-model-compat.test.ts`: `off` sends `none` only when it is listed; unknown efforts are dropped; nearest-effort mapping. - `extensions/xai/provider-policy-api.test.ts`: Grok 4.3's ladder is unchanged after runtime normalization stamps its efforts. - Real Grok subscription account (device-code sign-in), isolated `--profile` Gateways. A loopback forward proxy (`proxy.proxyUrl` plus a proof-only CA) recorded each outgoing `/v1/responses` shape. Cells marked stub got a canned stream; the rest were forwarded unchanged to the real proxy. - Listing: 4 rows (`grok-4.7`, `grok-4.7-build-fast`, `grok-4.6`, `grok-4.5`), all `api_backend: responses`, all `supports_reasoning_effort: true`. - Picker levels on merge base `2fd61a9` and on this branch for all 8 shown xAI rows: identical except `grok-4.7-build-fast` (`off,ultra` default `off` → `low,medium,high,xhigh,ultra` default `high`). - Request parity: 8 models × `default/off/minimal/low/medium/high/xhigh/ultra`, 64 cells per build. Accepted/rejected levels and the `reasoning` field match for every cell. Two cells differ only because a background `grok-4.6` request (effort `high`, 12 tools) landed in a different cell on each build; that request has the same shape on both builds. - Fresh sign-in on this branch: models appear without restart; saved rows carry the listed efforts. Real turns: `grok-4.7-build-fast` default → sent `effort: high`, 200, proxy echoed `high`. `--thinking low` → sent `low`, 200, proxy echoed `low`. `--thinking off` → rejected: "Use one of: low, medium, high, xhigh, ultra". Control `grok-4.7` default → `high`, 200 on both builds. - Before (merge base): `grok-4.7-build-fast` default sent no `reasoning`; `--thinking low` was rejected ("Use one of: off, ultra"). - `pnpm exec oxlint --type-aware` on the changed files; `node scripts/check-changed.mjs`; `node scripts/run-vitest.mjs extensions/xai/` (563 passed before the final small type/lint fixups; focused files rerun after them). **Merge danger:** low. Only the xAI plugin changes. On the real account, request bodies for every model except `grok-4.7-build-fast` are byte-identical in the recorded fields. Risk: a future listing that reports efforts differing from the ID rules for a known model (for example, dropping `xhigh`) will now change that model's ladder. That is intended. Co-authored-by: Ayaan Zaidi <[email protected]>
… Anthropic API-key routes (#168164) Backport of 77e2261 (#168164) adapted for 2026.10.2. Adaptations for the release line: - attempt-stream.ts: 10.1 predates installStreamWrapper (#166690); keep the direct session.agent.streamFn wrapping and split the compaction-replay repair (Responses or compactionReplayEnabled) from the Responses-only message transform, as on main. - Extract supportsNativeOpenAIResponsesEndpoint/isOfficialOpenAIResponsesBaseUrl into transports/openai-responses-endpoint.ts and re-export it from @openclaw/ai/internal/openai-responses-payload-policy, matching main's layout (introduced there by #164597) without pulling that feature in. - supportsClaudeServerCompaction delegates to supportsClaudeAdaptiveThinking, which is already id-based on 10.1 (main's ById split came with #167658). - Tests: keep release-only cases (context-management preservation, xAI opt-out, release gate rows without the removed purpose argument), export createRawSseResponse from the new Anthropic transport test-support. (cherry picked from commit 77e2261)
## What Problem This Solves The repo has no written rules for agents that work on model listing, provider plugins or usage/cost. So the same classes of bugs keep coming back across providers and on the Models and Usage pages. ## User Impact There is no user-visible change. Agents that work in these areas now get short rules from the scoped guide they already read. ## Why This Change Was Made Each rule records a lesson that came back 2 or more times in merged work. Each rule is one line, in the guide that owns the area: - **`src/plugins/AGENTS.md` "Model Listing":** - The hot path has no network request. - `models.list` has p99 under 300 ms. Rows and prices publish as one snapshot, and removals apply at once. - The authenticated listing decides which models show. - List with the credential and runtime that will execute the turn, with one row per model per provider. - Failed and empty listings each have defined semantics. - Capabilities come from the listing, not from model-ID rules. - One core admission rule. - **`extensions/AGENTS.md`:** - Host policy that every provider shares stays core. - Sign-in goes through the Models page and `/login`. Setup saves the connection only. - Native CLIs own their login and model menu. - Refusals are classified by cause. - Attribution headers come from one helper. - **`src/agents/AGENTS.md` "Run Authority":** - One model resolver for every entry path. - No silent fallback to another runtime or billing. - Native-runtime consent is asked once. - **`src/gateway/AGENTS.md` "Usage And Cost" (new section):** - Measured, unpriced, partial and unknown usage stay distinct. - Each route is priced from the provider that bills it. - Reports are complete or flagged as partial. - **`ui/AGENTS.md`:** - A route waits only for its first-paint data. - New "Layout Stability" section: zero layout shift, how to prove it, and a 200 ms load budget for Models and Usage. - **Root `AGENTS.md`:** one line in "Read when relevant" that points to these sections. Examples of the incidents behind the rules: #140139, #158000, #167444, #167658, #168033, #172608, #172773, #173792, #174641, #176404, #180838, #184066. ## Evidence - `pnpm check:agents-md-size`: all 27 files are within 20000 chars. - `oxfmt --check` passes on each of the 6 changed files. - I checked the cited names on current `main`: `buildLiveModelProviderConfig`, `readModelId` and `modelPricing.providers.<id>.priceAs`. Co-authored-by: Ayaan Zaidi <[email protected]>
…87141) ## What Problem This Solves The repo has no written rules for agents that work on model listing, provider plugins or usage/cost. So the same classes of bugs keep coming back across providers and on the Models and Usage pages. ## User Impact There is no user-visible change. Agents that work in these areas now get short rules from the scoped guide they already read. ## Why This Change Was Made Each rule records a lesson that came back 2 or more times in merged work. Each rule is one line, in the guide that owns the area: - **`src/plugins/AGENTS.md` "Model Listing":** - The hot path has no network request. - `models.list` has p99 under 300 ms. Rows and prices publish as one snapshot, and removals apply at once. - The authenticated listing decides which models show. - List with the credential and runtime that will execute the turn, with one row per model per provider. - Failed and empty listings each have defined semantics. - Capabilities come from the listing, not from model-ID rules. - One core admission rule. - **`extensions/AGENTS.md`:** - Host policy that every provider shares stays core. - Sign-in goes through the Models page and `/login`. Setup saves the connection only. - Native CLIs own their login and model menu. - Refusals are classified by cause. - Attribution headers come from one helper. - **`src/agents/AGENTS.md` "Run Authority":** - One model resolver for every entry path. - No silent fallback to another runtime or billing. - Native-runtime consent is asked once. - **`src/gateway/AGENTS.md` "Usage And Cost" (new section):** - Measured, unpriced, partial and unknown usage stay distinct. - Each route is priced from the provider that bills it. - Reports are complete or flagged as partial. - **`ui/AGENTS.md`:** - A route waits only for its first-paint data. - New "Layout Stability" section: zero layout shift, how to prove it, and a 200 ms load budget for Models and Usage. - **Root `AGENTS.md`:** one line in "Read when relevant" that points to these sections. Examples of the incidents behind the rules: openclaw#140139, openclaw#158000, openclaw#167444, openclaw#167658, openclaw#168033, openclaw#172608, openclaw#172773, openclaw#173792, openclaw#174641, openclaw#176404, openclaw#180838, openclaw#184066. ## Evidence - `pnpm check:agents-md-size`: all 27 files are within 20000 chars. - `oxfmt --check` passes on each of the 6 changed files. - I checked the cited names on current `main`: `buildLiveModelProviderConfig`, `readModelId` and `modelPricing.providers.<id>.priceAs`. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: new Claude models that an Anthropic API key already lists stay hidden from the model picker until an OpenClaw release, and a typed-in unknown ID can be sent a request shape the model rejects.
User Impact
User impact: Anthropic API-key users see newly listed Claude models as soon as
/v1/modelsreturns them, and the first turn uses the thinking type and effort levels Anthropic advertises for that model. Shipped rows Anthropic does not list, configured rows, and catalogs saved before discovery runs keep today's model-ID rules.Why This Change Was Made
Request shaping keyed only on model-ID rules, so #113757 hid any unknown model whose advertised capabilities disagreed with them. This change makes shaping follow the listing:
/v1/modelsprojection through the existingmodelDiscovery.projectRowshook. It runs the shared default projection first, so a listed ID that the manifest does not ship still inheritscompat(including Code Mode) andthinkingLevelMapfrom the closest shipped model, exactly as before. It then adds the advertised flags to each listed row asparams.claudeCapabilities(adaptiveThinking,xhighEffort,maxEffort, anddisabledThinkingwhen listed) and setsthinkingLevelMap.xhigh/maxto match.supportsClaudeAdaptiveThinking,supportsClaudeNativeXhighEffort,supportsClaudeNativeMaxEffort, andrequiresClaudeMandatoryAdaptiveThinkingread a listed flag first and use the ID rule only when that flag is missing. Sonnet 5.5's between-tools off mode is preserved.supportsClaude1MContextstill uses ID rules only.No schema changes. One export is added to the private-local
plugin-sdk/provider-catalog-live-runtimesubpath:buildOpenAICompatibleLiveModels, the existing default projection, so the Anthropic projection composes with it instead of copying its template inheritance.paramsis the existing free-form model-params field;params.canonicalModelIdis the precedent. The Anthropic provider docs now name the key.compat.supportedReasoningEffortswas not used because Copilot'santhropic-messagesClaude rows already set it without any adaptive marker, so the shared predicates would misread those rows.The public SDK option
acceptUnknownModelis unchanged. The Anthropic plugin no longer sets it, and instead passes the same kind of gate (listed capabilities present) straight to the shared projection. Bedrock, Vertex, Copilot, Foundry, OpenRouter, and Claude CLI rows never carryparams.claudeCapabilities, so they behave as before.Evidence
origin/maincode and passing here:packages/llm-core/src/model-contracts/anthropic.test.ts: listed flags override ID rules one flag at a time.packages/ai/src/anthropic-listed-capabilities-transport-parity.test.ts: provider and transport builders send adaptive +xhighfor an unknown listed model, budget thinking when adaptive is withheld, and keep thinking on when disabled thinking is rejected.extensions/anthropic/live-discovery-auth.test.ts: an unknown listed model appears with its capabilities; a row without capabilities stays hidden; a listed ID the manifest does not ship (claude-sonnet-4-6) keeps the shipped Sonnet row'scompat.codeMode: "preferred"while its effort map follows the listing (this case fails on80606329c81).extensions/anthropic/provider-policy-api.test.ts: the effort ladder follows listed capabilities.pnpm openclawGateway turns in an isolated profile. Traffic toapi.anthropic.comwent through a loopback forward proxy (proxy.proxyUrlplus a proof CA) into a fake API that listsclaude-sonnet-5(known),claude-sonnet-9(unknown, adaptive + xhigh + max), andclaude-haiku-9(unknown, no adaptive, no effort):origin/main: neither unknown ID is listed. A typedclaude-haiku-9is sentthinking: adaptivewithefforthigh/low, which this model rejects.claude-sonnet-9 --thinking xhighis refused with "not supported".claude-sonnet-9gets adaptive thinking with efforthigh/xhigh/maxand thinkingdisabledby default.claude-haiku-9getsthinking: enabledwithbudget_tokens16384/8192 plus the interleaved-thinking beta.claude-sonnet-5is unchanged.--profileGateways, the same loopback forward proxy now forwarding each request unchanged to the realapi.anthropic.comand recording the outgoing/v1/messagesshape and the real status. The baseline is this PR's merge base447144510b8; the branch is80606329c81./v1/modelslists 14 Claude IDs, and every row has a capability tree. The picker (models list --provider anthropic --all --refresh --plain, with and without a Gateway) shows the same 16 rows on both builds: the 14 listed IDs plus the shippedclaude-mythos-5andclaude-haiku-4-5. The real listing has no ID that the baseline hides.default,off,minimal,low,medium,high,xhigh,max,adaptive, andultra. Sonnet and Haiku models got real turns atdefault/off/low/high/xhigh/max. Opus and Fable models got one real turn each atdefaulton each build. All other cells were captured with a proxy stub, so the request was recorded but not sent. Theanthropic-betaheader,thinking(type, budget, display, block binding),output_config.effort,max_tokens,context_management,service_tier, sampling fields, and top-level keys are identical for every model and level. Both builds reject the same levels (for exampleoffonclaude-opus-5-5/claude-fable-5/claude-fable-5-1,xhighonclaude-sonnet-4-6/claude-opus-4-6). All 80 real requests returned 200.80606329c81, fixed in2022ebb00d5: the five listed IDs the manifest does not ship (claude-sonnet-4-6,claude-sonnet-4-5-20250929,claude-opus-4-7,claude-opus-4-6,claude-opus-4-5-20251101) were sent[tool_call, tool_describe, tool_search]instead of the baseline's Code Mode tools[exec, wait]. The baseline's default projection copiescompatandthinkingLevelMapfrom the shipped model with the longest shared ID prefix;projectAnthropicLiveModelshad built those rows from scratch. It now runs that default projection and only adds the listed flags.2022ebb00d5(same real key, same proxy, compared with the frozen baseline captures): 46 requests across those five models at every level the baseline accepts, plusclaude-haiku-4-5-20251001andclaude-sonnet-5atdefault. Real turns:claude-sonnet-4-6,claude-opus-4-6, andclaude-sonnet-5(unchanged control) atdefault, all 200. Everything else used the proxy stub. Every request equals its baseline capture on every recorded field:anthropic-beta,thinking,output_config,max_tokens,context_management, sampling fields, top-level keys, message/system counts, and the tool list hash. The five models now send[exec, wait], and Haiku 4.5 still sends[tool_call, tool_describe, tool_search]on both builds. The branch still refuses the same levels as the baseline (xhighonclaude-sonnet-4-6/claude-opus-4-6;xhigh/max/adaptiveonclaude-sonnet-4-5-20250929/claude-opus-4-5-20251101).80606329c81masked the ID rules forclaude-opus-4-7. With the mask, the request came only from the advertised capabilities: thinkingdisabledby default and adaptive thinking withxhigh/maxeffort, the same as the unmasked branch. Real turns atdefault,xhigh, andmaxreturned 200. This simulation was not repeated on2022ebb00d5. The fix changes only what an unknown row inherits from its template (compat, thinking-map entries other thanxhigh/max, and input). The listed flags that shape the request are set the same way.claude-sonnet-5, which the manifest ships, sent the advertised adaptive thinking but made the CLI refusexhigh/max. The CLI level check (src/agents/command/model-selection.ts, viaprepareCommandModelCatalog) reads the manifest catalog row, andneedsThinkHydrationskips the live, provider-scoped catalog whenever that row already declaresreasoning. So listed capabilities never reach the ladder for a shipped ID. Fixing this means changing the shared thinking-catalog hydration policy, which is used by several callers (model-selection.ts,run-embedded-attempt.ts,agent-runner-run-params.ts) and every provider. That is out of scope here. Today the ID rules for every shipped model match their listing, so nothing is visible.node scripts/check-changed.mjson2022ebb00d5: typecheck, boundary, Plugin SDK export/surface, format, and ratchet lanes pass. The dead-export scan fails only on pre-existing unused exports in files this PR does not touch (src/config/sessions/session-accessor.sqlite-entry-cache-publication.ts,src/infra/heartbeat-events-filter.ts). WithOPENCLAW_CHECK_CHANGED_SKIP_DEADCODE=1the run exits 0.oxlint --type-awareis clean on the changed files.Merge danger
compat(including Code Mode),thinkingLevelMap, and input modalities from the shipped model with the longest shared ID prefix, as the shared projection already did before this PR. It gets zero pricing and ID-rule image sizing until OpenClaw ships its entry. Listedxhigh/maxflags override the inherited thinking map.