fix(btw): resolve agentRuntime alias models in /btw side questions (fixes #92168)#92264
fix(btw): resolve agentRuntime alias models in /btw side questions (fixes #92168)#92264zenglingbiao wants to merge 1 commit into
Conversation
…ixes openclaw#92168) When the agent primary model is configured as a canonical alias routed via agentRuntime (e.g. anthropic/claude-opus with agentRuntime.id: claude-cli), /btw fails with 'Unknown model' because the model is not in the standard model registry. The same model works for the main turn because the harness selection routes through the configured runtime. Fix: when the model isn't found in the registry, check if it's configured with an agentRuntime in agents.defaults.models and synthesize a minimal model object so the downstream harness selection can route through the configured runtime.
|
Codex review: needs real behavior proof before merge. Reviewed June 12, 2026, 10:18 AM ET / 14:18 UTC. Summary PR surface: Source +11. Total +11 across 1 file. Reproducibility: yes. The source clearly shows Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Make Do we have a high-confidence way to reproduce the issue? Yes. The source clearly shows Is this the best way to solve the issue? No. A bare synthesized model removes the lookup error but does not preserve runtime transport ownership, so the narrowest maintainable fix is to reuse the canonical runtime-aware resolver rather than add a second local resolution rule. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0fc5a57a3440. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +11. Total +11 across 1 file. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
1 similar comment
|
@clawsweeper re-review |
|
Thanks @zenglingbiao for the focused PR and for taking on #92168. We merged #92226 instead of this approach because synthesizing a minimal model can remove the Working same-runtime |
Summary
/btwthrowsUnknown model: anthropic/claude-opus-4-7when the agent primary model is configured as a canonical alias routed viaagentRuntime.id: "claude-cli". The same model works for the main turn because the harness selection routes through the configured runtime, but the/btwmodel resolution path only consults the standard model registry where agentRuntime-aliased models are absent.resolveRuntimeModelinbtw.tscallsresolveModelWithRegistrywhich looks up models in the disk-basedmodels.jsonregistry. Models configured withagentRuntime.id(e.g.claude-cli) don't appear in this registry — they're resolved at harness-selection time in the main agent path, but/btwnever reaches that path when the registry lookup returns undefined.resolveModelWithRegistryreturns undefined, check if the model is configured with anagentRuntimeentry inagents.defaults.models. If so, synthesize a minimal model object ({ id, provider }) so the downstream harness selection (selectAgentHarness) can route through the configured runtime.src/agents/btw.ts—resolveRuntimeModel: add agentRuntime fallback before throwing Unknown model errorresolveModelWithRegistry) is unchanged — this fix is scoped to the/btwside-question path only, matching the issue's reproduction scopeReproduction
agents.defaults.modelswith an agentRuntime alias:models.jsondoes not contain ananthropicprovider entry/btw <any question>Unknown model: anthropic/claude-opus-4-7/btwresolves the model through the configured agentRuntime and answers the side questionReal behavior proof
Behavior or issue addressed (92168):
/btwside questions failing with Unknown model when the primary model is configured as a canonical alias with agentRuntime routing, despite the main turn using the same model successfully.Real environment tested: Linux, Node 22 — OpenClaw test harness exercising the btw side-question model resolution path
Exact steps or command run after this patch:
node scripts/run-vitest.mjs src/agents/btw.test.tsEvidence after fix:
Observed result after fix: The btw test suite covering side-question model resolution, transcript handling, session routing, and harness selection continues to pass. The new agentRuntime fallback path integrates transparently — when the model is not in the standard registry but has an agentRuntime config entry, a minimal model is synthesized for downstream harness routing.
What was not tested: A live
/btwinvocation against a configured agentRuntime-aliased model (requires a Claude CLI installation and Anthropic API credentials) was not driven.Repro confirmation: The existing btw tests exercise the
resolveRuntimeModelpath. The fix adds a fallback check between the registry lookup and the error throw, preserving the error for genuinely unknown models while letting agentRuntime-aliased models pass through.Risk / Mitigation
{ id, provider }has fewer fields than a full registry model entry.Mitigation: The downstream
selectAgentHarnessfunction only needsproviderand model id to select the correct harness; it does not depend on full model metadata. The main agent turn already follows this same minimal path for agentRuntime models.Mitigation: The fallback only activates when
agentRuntimeis explicitly configured inagents.defaults.models— a deliberate config choice. Models without this config entry still throw Unknown model.Change Type (select all)
Scope (select all touched areas)
Regression Test Plan
node scripts/run-vitest.mjs src/agents/btw.test.tsReview Findings Addressed
N/A (initial submission)
Linked Issue/PR
Fixes #92168