openclaw - ✅(Solved) Fix infer model run silently ignores --model override (always routes to anthropic/claude-sonnet-4-6) [1 pull requests, 2 comments, 3 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#73921Fetched 2026-04-29 06:13:15
View on GitHub
Comments
2
Participants
3
Timeline
3
Reactions
0
Author
Timeline (top)
commented ×2cross-referenced ×1

openclaw infer model run --model <copilot-model-id> silently ignores the --model flag and routes the request to anthropic/claude-sonnet-4-6 regardless of which model was specified.

Root Cause

openclaw infer model run --model <copilot-model-id> silently ignores the --model flag and routes the request to anthropic/claude-sonnet-4-6 regardless of which model was specified.

Fix Action

Workaround

Use production crons / heartbeat overrides as the smoke test until infer model run is fixed.

PR fix notes

PR #74028: [AI-assisted] fix(cli): honor fully qualified infer model overrides

Description (problem / solution / changelog)

Summary

  • Problem: local capability model run --model provider/model could route through agent default selection instead of honoring the fully qualified provider/model override directly.
  • Why it matters: explicit probes like github-copilot/... should test the requested provider/model, not the agent fallback/default path.
  • What changed: qualified local model run overrides are prepared directly with prepareSimpleCompletionModel; gateway dispatch forwarding remains explicit.
  • What did NOT change (scope boundary): unqualified model refs still use the existing agent default selection path.

AI-assisted: yes, built with Codex. I understand the code changes and verified the focused regression locally.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #73921
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: local model-run handling always delegated through agent-aware model preparation, even when the CLI supplied a fully qualified provider/model override.
  • Missing detection / guardrail: no test asserted direct local preparation for provider-qualified model run overrides.
  • Contributing context (if known): N/A

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
  • Target test or file: src/cli/capability-cli.test.ts
  • Scenario the test should lock in: local model run with github-copilot/model calls direct simple-completion preparation, and gateway mode forwards the explicit provider/model.
  • Why this is the smallest reliable guardrail: it exercises the CLI command plumbing without live provider calls.
  • Existing test that already covers this (if any): N/A
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

openclaw capability model run --model provider/model now honors fully qualified local provider/model overrides more directly.

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: Windows
  • Runtime/container: local Node.js / pnpm workspace
  • Model/provider: mocked in unit tests
  • Integration/channel (if any): CLI
  • Relevant config (redacted): N/A

Steps

  1. Run a local model probe with --model github-copilot/<model>.
  2. Confirm the CLI prepares that explicit provider/model directly.
  3. Run gateway mode and confirm explicit provider/model are forwarded.

Expected

  • Fully qualified model overrides select the requested provider/model.

Actual

  • Before this change, local mode could go through agent default resolution first.

Evidence

  • Failing test/log before + passing after

Focused local validation:

node scripts/test-projects.mjs src/cli/capability-cli.test.ts
Test Files  1 passed (1)
Tests       50 passed (50)

Human Verification (required)

  • Verified scenarios: focused CLI regression tests; git diff --check before commit.
  • Edge cases checked: provider-qualified local override and gateway override forwarding.
  • What you did not verify: live GitHub Copilot provider call; full repo pnpm test / pnpm check.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

  • Risk: changing local model-run path for qualified overrides could miss agent-specific defaults.
    • Mitigation: only provider-qualified refs take the direct path; unqualified refs continue through existing agent selection.

Changed files

  • src/cli/capability-cli.test.ts (modified, +91/-0)
  • src/cli/capability-cli.ts (modified, +45/-10)

Code Example

openclaw infer model run --model github-copilot/gemini-3-flash-preview --prompt 'ping'
openclaw infer model run --model github-copilot/gpt-5-mini --prompt 'ping'
openclaw infer model run --model github-copilot/gpt-5.3-codex --prompt 'ping'
RAW_BUFFERClick to expand / collapse

Summary

openclaw infer model run --model <copilot-model-id> silently ignores the --model flag and routes the request to anthropic/claude-sonnet-4-6 regardless of which model was specified.

Repro (observed Apr 29 2026, ~01:10 UTC)

openclaw infer model run --model github-copilot/gemini-3-flash-preview --prompt 'ping'
openclaw infer model run --model github-copilot/gpt-5-mini --prompt 'ping'
openclaw infer model run --model github-copilot/gpt-5.3-codex --prompt 'ping'

All three responded as anthropic/claude-sonnet-4-6 (verified via response metadata).

Expected

Each call routes to the requested copilot model.

Notes

  • Production heartbeat/cron model overrides for these same model ids DO work correctly (verified via telemetry: gemini-3-flash-preview 843 calls, gpt-5-mini 311, gpt-5.3-codex 274 over recent days).
  • So the bug appears scoped to the infer model run CLI path, not the runtime model resolver.
  • Impact: smoke-tests for new copilot model onboarding are unreliable; have to rely on production telemetry instead.

Workaround

Use production crons / heartbeat overrides as the smoke test until infer model run is fixed.

extent analysis

TL;DR

The issue can be worked around by using production crons or heartbeat overrides as a smoke test until the infer model run command is fixed.

Guidance

  • Verify that the --model flag is correctly parsed and passed to the underlying model resolver in the openclaw infer model run command.
  • Check the implementation of the infer model run command to ensure it is not hardcoded to use the anthropic/claude-sonnet-4-6 model.
  • Review the differences between the infer model run command and the production heartbeat/cron model overrides to identify the root cause of the discrepancy.
  • Consider adding logging or debugging statements to the infer model run command to understand how the model is being selected.

Example

No code snippet is provided as the issue does not contain sufficient information about the implementation of the openclaw command.

Notes

The issue appears to be specific to the infer model run command and does not affect the production heartbeat/cron model overrides. The workaround using production crons or heartbeat overrides can be used until the issue is resolved.

Recommendation

Apply workaround: use production crons or heartbeat overrides as a smoke test until the infer model run command is fixed, as it allows for reliable testing of new copilot models.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix infer model run silently ignores --model override (always routes to anthropic/claude-sonnet-4-6) [1 pull requests, 2 comments, 3 participants]