You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Bug]: /btw fails with "Unknown model" for anthropic/* aliases routed via agentRuntime: claude-cli (resolver path divergence from main agent loop) #92168
Regression (worked before, now fails) — the agents.defaults.models shape with agentRuntime.id: claude-cli is the post-5.12 recommended way to express "this canonical alias resolves through the CLI binary, not direct API" (see #82314), but /btw was never updated to honor it.
Beta release blocker
No
Summary
/btw throws Unknown model: <provider>/<modelId> when the agent's primary model is configured as a canonical alias (e.g. anthropic/claude-opus-4-7) routed via agents.defaults.models[].agentRuntime.id = "claude-cli", and the agent's discovered models.json does not contain a bare anthropic provider entry. The same model id works fine for the main turn. Repros 4/4 on 2026.6.5 (5181e4f).
~/.openclaw/agents/main/agent/models.json does not contain an anthropic provider entry. (Either no API key has been registered for direct Anthropic, or the agent's only registered Anthropic-compatible providers are third-party proxies under different provider keys.)
Send a normal turn — works (the claude-cli runtime takes over via cli_runtime_passthrough_openclaw).
Send /btw <any question> in the same session.
Expected behavior
/btw resolves the same anthropic/claude-opus-4-7 ref the main turn just used and answers the side question. The configured agentRuntime.id = claude-cli should route BTW down the same cli_runtime_passthrough_openclaw path the main agent uses, instead of failing on a strict registry lookup that ignores the alias.
~/.openclaw/agents/main/agent/models.json only contains custom third-party Anthropic-compatible providers (different provider keys, e.g. my-proxy-anthropic); no bare anthropic provider is auto-discovered, by design — there is no direct Anthropic API key on this host, and the claude-cli runtime is supposed to handle it.
Resolver-path divergence (read in 2026.6.5 source):
Main turn (works) — src/agents/embedded-agent-runner/run.ts:710-790 builds a multi-candidate provider list (selectedRuntimeProvider + canonical provider) and calls resolveModelAsync with allowBundledStaticCatalogFallback: pluginHarnessOwnsTransport. On miss it re-runs ensureOpenClawModelsJson and retries. Harness selection at src/agents/harness/selection.ts:181-191 honors cli_runtime_passthrough_openclaw so agentRuntime: claude-cli aliases are accepted as bare anthropic/* refs.
BTW (fails) — src/agents/btw.ts:343 runs selectAgentHarness (correctly returns the OpenClaw harness via cli_runtime_passthrough_openclaw); because harness.runSideQuestion is undefined, control falls through to btw.ts:409 → resolveRuntimeModel → resolveModelWithRegistry at btw.ts:260. That call uses only the disk-discovered modelRegistry (single provider list, no selectedRuntimeProvider candidate, no bundled-catalog fallback). The bare anthropic provider isn't on disk → Unknown model at btw.ts:267.
The error message is also thinner than the main path produces — resolveModelAsync formats a richer "Found agents.defaults.models[...] but no matching models.providers[...]" message via buildUnknownModelError (embedded-agent-runner/model.ts:1383-1393); BTW's primitive path skips that.
Suggested fix: Replace resolveModelWithRegistry in btw.ts:260 with resolveModelAsync (or at least mirror run.ts:730-790's selectedRuntimeProvider candidate list + allowBundledStaticCatalogFallback: pluginHarnessOwnsTransport + ensureOpenClawModelsJson retry on miss). Harness selection above already classifies the run correctly; only the model-resolver call is wrong.
Bug type
Regression (worked before, now fails) — the
agents.defaults.modelsshape withagentRuntime.id: claude-cliis the post-5.12 recommended way to express "this canonical alias resolves through the CLI binary, not direct API" (see #82314), but/btwwas never updated to honor it.Beta release blocker
No
Summary
/btwthrowsUnknown model: <provider>/<modelId>when the agent's primary model is configured as a canonical alias (e.g.anthropic/claude-opus-4-7) routed viaagents.defaults.models[].agentRuntime.id = "claude-cli", and the agent's discoveredmodels.jsondoes not contain a bareanthropicprovider entry. The same model id works fine for the main turn. Repros 4/4 on 2026.6.5 (5181e4f).Steps to reproduce
~/.openclaw/openclaw.json:~/.openclaw/agents/main/agent/models.jsondoes not contain ananthropicprovider entry. (Either no API key has been registered for direct Anthropic, or the agent's only registered Anthropic-compatible providers are third-party proxies under different provider keys.)claude-cliruntime takes over viacli_runtime_passthrough_openclaw)./btw <any question>in the same session.Expected behavior
/btwresolves the sameanthropic/claude-opus-4-7ref the main turn just used and answers the side question. The configuredagentRuntime.id = claude-clishould route BTW down the samecli_runtime_passthrough_openclawpath the main agent uses, instead of failing on a strict registry lookup that ignores the alias.Actual behavior
Thrown at
src/agents/btw.ts:267from theresolveModelWithRegistrycall atbtw.ts:260.OpenClaw version
2026.6.5 (5181e4f)
Operating system
macOS 15.4 (Darwin 25.4.0, arm64)
Install method
npm global
Model
anthropic/claude-opus-4-7(withagentRuntime.id: claude-cli)Provider / routing chain
openclaw → claude-cli runtime →
claudebinaryAdditional provider/model setup details
agents.defaults.modelsdeclares the canonicalanthropic/*alias withagentRuntime: { id: "claude-cli" }— the dual-route shape recommended by [Feature]: Per-alias agentRuntime override to support dual-route model configurations (Anthropic CLI + API) #82314.~/.openclaw/agents/main/agent/models.jsononly contains custom third-party Anthropic-compatible providers (different provider keys, e.g.my-proxy-anthropic); no bareanthropicprovider is auto-discovered, by design — there is no direct Anthropic API key on this host, and theclaude-cliruntime is supposed to handle it.Logs, screenshots, and evidence
Resolver-path divergence (read in
2026.6.5source):src/agents/embedded-agent-runner/run.ts:710-790builds a multi-candidate provider list (selectedRuntimeProvider+ canonicalprovider) and callsresolveModelAsyncwithallowBundledStaticCatalogFallback: pluginHarnessOwnsTransport. On miss it re-runsensureOpenClawModelsJsonand retries. Harness selection atsrc/agents/harness/selection.ts:181-191honorscli_runtime_passthrough_openclawsoagentRuntime: claude-clialiases are accepted as bareanthropic/*refs.src/agents/btw.ts:343runsselectAgentHarness(correctly returns the OpenClaw harness viacli_runtime_passthrough_openclaw); becauseharness.runSideQuestionis undefined, control falls through tobtw.ts:409→resolveRuntimeModel→resolveModelWithRegistryatbtw.ts:260. That call uses only the disk-discoveredmodelRegistry(single provider list, noselectedRuntimeProvidercandidate, no bundled-catalog fallback). The bareanthropicprovider isn't on disk →Unknown modelatbtw.ts:267.The error message is also thinner than the main path produces —
resolveModelAsyncformats a richer "Foundagents.defaults.models[...]but no matchingmodels.providers[...]" message viabuildUnknownModelError(embedded-agent-runner/model.ts:1383-1393); BTW's primitive path skips that.Impact and severity
agents.defaults.models[<canonical-alias>].agentRuntime.idset to a CLI runtime alias (the shape [Feature]: Per-alias agentRuntime override to support dual-route model configurations (Anthropic CLI + API) #82314 is asking for, and the only way to express "use the CLI binary, not the direct API" since canonical-namespace consolidation in 5.12). Main turns work;/btwis broken on every invocation./btwis unusable; main turns continue to work, so the blast radius is limited to that one command./btw.Additional information
/btw). Likely the same underlying lesson — every callsite that resolves a runtime model should useresolveModelAsync(with multi-candidate + bundled-catalog fallback), not the bareresolveModelWithRegistry.resolveModelWithRegistryinbtw.ts:260withresolveModelAsync(or at least mirrorrun.ts:730-790'sselectedRuntimeProvidercandidate list +allowBundledStaticCatalogFallback: pluginHarnessOwnsTransport+ensureOpenClawModelsJsonretry on miss). Harness selection above already classifies the run correctly; only the model-resolver call is wrong.agents.defaults.model.primaryfromanthropic/<model>to the explicitclaude-cli/<model>(whichmodels.jsondiscovery does write). Cost: loses the canonical-alias indirection [Feature]: Per-alias agentRuntime override to support dual-route model configurations (Anthropic CLI + API) #82314 is steering users toward.