Skip to content

fix(cli): honor --model provider/model for infer audio transcribe and video describe - #172409

Closed
yetval wants to merge 2 commits into
openclaw:mainfrom
yetval:fix/infer-media-model-pin
Closed

yetval wants to merge 2 commits into
openclaw:mainfrom
yetval:fix/infer-media-model-pin

Conversation

@yetval

@yetval yetval commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

openclaw infer audio transcribe --model <provider/model> and openclaw infer video describe --model <provider/model> do not pin the requested backend. When tools.media.models has an entry for the capability, the flag is ignored and the configured entry (often another provider) receives the upload. Without such an entry, audio swaps the requested model for the provider transcription default (for example --model openai/whisper-1 uploads model=gpt-4o-transcribe). docs/cli/infer.md says "Use --provider or --model provider/model to pin a specific backend", and infer image describe --model already pins.

Root cause

src/cli/capability-cli/media-understanding-command.ts forwards --model only as activeModel:

// before
const activeModel = requireProviderModelOverride(opts.model);
const input = { filePath: path.resolve(file), cfg, agentId, agentDir, activeModel };

In the runner, activeModel means "the active chat model" for the reply pipeline. Audio deliberately replaces it with the provider transcription default (resolveAutoProviderModelEntry in src/media-understanding/runner.ts, because a chat model id is not a valid STT model), and whenever resolveModelEntries finds configured tools.media.models entries for the capability, activeModel is never consulted. Both are right for channel replies, but the CLI reuses the field to mean an explicit user override, so the override is silently dropped.

Fix

When --model is given, the command runs with a request-local config whose tools.media.models is exactly one entry for this capability with the requested provider and model:

// after
const runCfg = activeModel ? pinMediaModel(cfg, kind, activeModel) : cfg;

pinMediaModel starts that entry from the configured entry for the same provider when one exists for this capability: the entry with the exact requested model, otherwise a provider-wide entry without a model. Its baseUrl, headers, request, profile, preferredProfile and limits are kept, and only provider, model and capabilities are set. CLI entries and entries tagged only for other capabilities are never borrowed. Without --model the config object is passed through unchanged.

Why this is the right boundary

The meaning of --model is owned by the CLI command; the runner's activeModel semantics are correct for channel replies and stay untouched, so automatic audio still uses the provider STT default. Provider auth, tools.media.audio / tools.media.video settings and the persisted config are unchanged; only the model list for this one invocation is narrowed. A previously working --model invocation that names a configured entry keeps that entry's transport and auth settings (the regression raised in review at 0516926f2ce). infer image describe already pins through describePreparedImageWithModel, so audio and video are the only sibling surfaces, and both go through this one command file.

Intended behavior change for maintainers to confirm: with --model, other configured entries for that capability are not used as fallbacks for that invocation, which is what "pin a specific backend" documents.

Verification

  • node scripts/run-vitest.mjs src/cli/capability-cli/media-understanding-command.test.ts: 4 passed. The command is driven through the real media runner, entry resolution and provider request context; only agent resolution and the provider registry are replaced, both via importOriginal pass-through, and the provider transport records the request it receives.
  • The same file on pristine main: 3 of 4 fail (the pin cases). On the previous head 0516926f2ce: 2 of 4 fail (the deepgram/nova-3 entry baseUrl/headers case and the provider-wide video entry case), which is the review's P1.
  • oxlint -c .oxlintrc.json and oxfmt --check on both changed files: clean. git diff --check: clean.
  • scripts/check-test-mock-exports.mts --base origin/main: nothing reported for this file (the only report is the pre-existing src/flows/doctor-plugin-source-captures.test.ts, untouched here).
  • Typecheck was not run locally.

Real behavior proof

Behavior addressed: openclaw infer audio transcribe --model <provider/model> and openclaw infer video describe --model <provider/model> sent the upload to the configured tools.media.models entry instead of the requested provider/model; pinning a configured model must also keep that entry's own baseUrl and headers.
Real environment tested: the real openclaw CLI entry (src/entry.ts, run from source) on pristine main bb642e1 and on this PR head eaf0313, with an isolated HOME, OPENCLAW_CONFIG_PATH and OPENCLAW_STATE_DIR and the same config file shape for both. Config loading, agent resolution, auth, the media-understanding runner, entry selection, provider request context and the real deepgram, openai, groq and moonshot media providers all ran unmodified (moonshot is loaded from the tree's own extensions/moonshot through plugins.load.paths, since it ships as an external plugin). The only external seam replaced is the provider HTTP endpoint: each provider baseUrl (and the entry-level baseUrl of the configured entries) points at a local HTTP listener that logs the route, the requested model and the x-entry header. Config: tools.media.models = [{deepgram, model nova-3, baseUrl .../deepgram-proxy/v1, headers {x-entry: kept}, audio}, {groq, audio}, {moonshot, model kimi-k2.5, baseUrl .../moonshot-proxy/v1, headers {x-entry: kept}, video}].
Exact steps or command run after this patch: node --import tsx/esm src/entry.ts infer <args> --json from each tree with <args> = audio transcribe --file tone.wav --model openai/whisper-1, audio transcribe --file tone.wav --model deepgram/nova-3, video describe --file clip.mp4 --model moonshot/kimi-k2.6, and audio transcribe --file tone.wav (no --model), then reading the listener log after each run.
Evidence after fix:

# BEFORE (pristine main bb642e181e1)
$ openclaw infer audio transcribe --file tone.wav --model openai/whisper-1 --json
"provider": "deepgram",
"model": "nova-3",
"text": "hello from deepgram-proxy",
[deepgram-proxy] POST /deepgram-proxy/v1/listen model=nova-3 x-entry=kept
$ openclaw infer audio transcribe --file tone.wav --model deepgram/nova-3 --json
"provider": "deepgram",
"model": "nova-3",
"text": "hello from deepgram-proxy",
[deepgram-proxy] POST /deepgram-proxy/v1/listen model=nova-3 x-entry=kept
$ openclaw infer video describe --file clip.mp4 --model moonshot/kimi-k2.6 --json
"provider": "moonshot",
"model": "kimi-k2.5",
"text": "video described by moonshot-proxy",
[moonshot-proxy] POST /moonshot-proxy/v1/chat/completions model=kimi-k2.5 x-entry=kept
$ openclaw infer audio transcribe --file tone.wav --json
"provider": "deepgram",
"model": "nova-3",
"text": "hello from deepgram-proxy",
[deepgram-proxy] POST /deepgram-proxy/v1/listen model=nova-3 x-entry=kept
# AFTER (this patch, head eaf03137a0c, identical inputs)
$ openclaw infer audio transcribe --file tone.wav --model openai/whisper-1 --json
"provider": "openai",
"model": "whisper-1",
"text": "hello from openai",
[openai] POST /openai/v1/audio/transcriptions model=whisper-1 x-entry=-
$ openclaw infer audio transcribe --file tone.wav --model deepgram/nova-3 --json
"provider": "deepgram",
"model": "nova-3",
"text": "hello from deepgram-proxy",
[deepgram-proxy] POST /deepgram-proxy/v1/listen model=nova-3 x-entry=kept
$ openclaw infer video describe --file clip.mp4 --model moonshot/kimi-k2.6 --json
"provider": "moonshot",
"model": "kimi-k2.6",
"text": "video described by moonshot",
[moonshot] POST /moonshot/v1/chat/completions model=kimi-k2.6 x-entry=-
$ openclaw infer audio transcribe --file tone.wav --json
"provider": "deepgram",
"model": "nova-3",
"text": "hello from deepgram-proxy",
[deepgram-proxy] POST /deepgram-proxy/v1/listen model=nova-3 x-entry=kept

Observed result after fix: --model openai/whisper-1 now reaches the OpenAI endpoint with model=whisper-1 and --model moonshot/kimi-k2.6 now runs video description on moonshot with model=kimi-k2.6, where main sent both to the configured entry; --model deepgram/nova-3 still reaches the configured entry's own deepgram-proxy base URL with its x-entry: kept header, exactly as on main, and omitting --model still routes to the first configured entry.
What was not tested: no request to the real OpenAI, Deepgram, Groq or Moonshot APIs (local listeners stand in for them); the CLI ran from source rather than a built package, and no published stable release was installed, so pristine main with the same config stands in for the pre-upgrade behavior; auth-profile (profile / preferredProfile) retention is carried by the same entry spread but was not exercised live.

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S labels Oct 14, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 14, 2026
@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Make audio transcription and video description honor an explicit provider/model while retaining matching configured entry settings.

Example: Transcribe tone.wav with --model openai/whisper-1 while Deepgram nova-3 is configured first.

  • Before: The upload goes to Deepgram with model nova-3.
  • After: The upload goes to OpenAI with model whisper-1.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused implementation addresses both prior findings and has meaningful CLI request traces, but upgrade evidence and fallback direction remain open.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Explicit audio/video model selection can upload a file to a different configured provider or use a different model.
Reason: Restoring the documented selection has clear value; strict failure instead of configured fallback needs an owner decision.

Merge readiness

⛔ Blocked before merge - 2 items remain

This PR repairs a documented model-selection bug still present on current main, and both prior findings are addressed; fallback policy and upgrade validation remain unresolved.

Priority: P2
Reviewed head: eaf03137a0cddd480019e8db8a81d1562123cd10
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should an explicit audio or video --model disable all other configured media fallbacks for that invocation?
  • Recommendation: Honor strict backend pinning: Accept failure when the requested provider/model cannot complete the request, without uploading the file to another configured backend.
  • Why: The documentation promises backend pinning, but image description permits fallbacks and this patch makes an unavailable explicit selection fail where configured alternatives previously could succeed.

Before merge

  • Add real behavior proof - Exact-head source CLI traces exercise real configuration, agent/auth resolution, media selection, and provider adapters against local HTTP listeners, proving audio/video overrides, matching Deepgram URL/header retention, and the no-flag control; the explicitly unperformed latest-stable upgrade remains required for this routing and fallback change. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Tests

  • Missing end-to-end proof: Provide a latest-stable-to-head upgrade run preserving existing media settings and credentials, with sanitized CLI output and final provider requests.
Agent review details

How this fits together

The local inference CLI resolves agent configuration and credentials, then passes a file and request-local media configuration through the shared media runner to a provider transport.

flowchart LR
  A[Inference CLI] --> B[Agent configuration and credentials]
  B --> C[Explicit model selection]
  C --> D[Shared media runner]
  D --> E[Provider transport]
  E --> F[Transcript or description]
Loading

Technical review

Best possible solution:

Retain the focused CLI repair, settle explicit-selection fallback semantics, and validate existing settings through a latest-stable upgrade.

Do we have a high-confidence way to reproduce the issue?

Current-main source establishes both configured-entry precedence and automatic audio model substitution; contributor CLI traces independently demonstrate the wrong selected backend.

Is this the best way to solve the issue?

The CLI is the appropriate owner for explicit flag semantics, and request-local configuration preserves channel automatic-selection behavior without changing stored configuration.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e037b8694c8b.

Provenance checked

  • Shared audio/video command execution changes intended behavior with a stated reason (4bf68b9: Consolidate duplicate command plumbing without intended changes to flags, defaults, ordering, or configuration.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 4bf68b9 adds src/cli/capability-cli/media-understanding-command.ts:33 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4bf68b98ab51; files: src/cli/capability-cli/media-understanding-command.ts)

PR surface

Source +38, Tests +191. Total +229 across 2 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 39 1 +38
Tests 1 191 0 +191
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 230 1 +229

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove merge-risk: 🚨 auth-provider: Current PR review merge-risk labels are merge-risk: 🚨 compatibility.

Label justifications:

  • P2: A bounded inference CLI bug silently ignores an explicit provider/model selection.
  • merge-risk: 🚨 compatibility: Explicit selections stop using other configured entries, so invocations previously rescued by those entries can fail.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Show latest-stable upgrade preservation of media settings and credentials through the changed CLI routes, redacting secrets and private endpoints.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-14T18:29:31.809Z sha 0516926f2cea398068ec1ddc7b1da95937440cf8 :: needs real behavior proof before merge. :: [P1] Preserve settings on a matching configured model entry | [P2] Remove the new closed mock factories that fail the ratchet

Reviewed October 16, 2026, 3:36 PM ET / 19:36 UTC (Revision 2).

… video describe

infer audio transcribe and infer video describe forwarded --model only as
the runner's activeModel. For audio the runner replaces that with the
provider transcription default, and whenever tools.media.models has an
entry for the capability activeModel is never consulted, so the flag did
not pin the backend the docs promise.

When --model is given, run with a request-local config whose
tools.media.models is exactly the requested provider/model for this
capability. The reply pipeline semantics of activeModel are unchanged.
When tools.media.models already has an entry for the requested provider and
model (or a provider-wide entry without a model) for this capability, the
pinned run now keeps that entry's baseUrl, headers, request, profile and
limits instead of replacing it with a bare provider/model entry. The
regression coverage now drives the registered command through the real
media runner and provider request context, mocking only the provider
transport, so no closed mock factories are added.
@yetval
yetval force-pushed the fix/infer-media-model-pin branch from 0516926 to eaf0313 Compare October 16, 2026 19:27
@yetval

yetval commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (bb642e1) and addressed the review at 0516926f2ce. New head: eaf0313.

Item Disposition
[P1] Preserve settings on a matching configured model entry Fixed in src/cli/capability-cli/media-understanding-command.ts. When --model names a provider/model that already has a tools.media.models entry for this capability (exact provider and model, or a provider-wide entry without a model), the pinned run now starts from that entry, so its baseUrl, headers, request, profile, preferredProfile and limits are kept and only provider, model and capabilities are set. CLI entries and entries tagged only for another capability are never borrowed. Covered by the deepgram/nova-3 regression, which checks the resulting request base URL and headers, and by the live proof in the body.
[P2] Remove the new closed mock factories that fail the ratchet Fixed. The runtime, cli-utils and output factories are gone. The test now drives the registered command through the real media runner, entry resolution and provider request context; the only two mocks spread the real module via importOriginal (agent resolution, and the provider registry so the provider transport can be captured). The mock-exports check against main reports nothing for this file.
Add real behavior proof (video execution, existing settings intact) Refreshed in the body against eaf0313: the real CLI entry (src/entry.ts, from source) on pristine main and on this head, with the real deepgram, openai, groq and moonshot media providers against local listeners. It now includes infer video describe --model executing live (moonshot), and a config whose existing deepgram and moonshot entries carry their own baseUrl and headers; --model deepgram/nova-3 reaches the entry's own base URL with its header on both main and this head, so existing settings stay intact.

Left for maintainers: the merge-risk labels were raised by the P1 finding. With this head, an invocation naming a configured model keeps that entry's transport and auth settings, so the compatibility and auth-provider risks described in the review no longer apply. The one intended behavior change is that --model now actually pins, as docs/cli/infer.md documents: other configured entries for the capability are not used as fallbacks for that one invocation. Please confirm that is the intended contract.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 16, 2026
@yetval

yetval commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

Closing this in favor of #176246, which tracks the underlying defect. It still reproduces on current main (ca5ac6f): infer audio transcribe and video describe ignore --model provider/model and use the configured tools.media.models entry instead. The issue has before/after CLI output, and links back here for the approach. The open question from review (whether --model should disable configured fallbacks) is better settled on the issue first.

@yetval yetval closed this Oct 18, 2026
obviyus added a commit that referenced this pull request Nov 19, 2026
…#190287)

Root cause: src/cli/capability-cli/media-understanding-command.ts:49 passes `--model` only as `activeModel` (a conversation-model hint), and the media selector never treats it as a choice: `src/media-understanding/runner.ts:727` takes configured `tools.media.models` entries without looking at it, and with no entries, audio swaps the requested model for the provider default (`runner.ts:439`).

Related: #176246 (reported by @yetval; the earlier strict-pin proposal #172409 was closed in favor of that issue).

## What Problem This Solves

`openclaw infer audio transcribe --model provider/model` and `openclaw infer video describe --model provider/model` ignore the flag when `tools.media.models` has an entry, and upload the file to that configured entry, which is often a different provider. With no configured entry, `--model openai/whisper-1` is sent as `gpt-4o-transcribe`. The docs say `--model provider/model` pins a specific backend (`docs/cli/infer.md`).

## User Impact

With `--model`, the file goes only to the requested provider and model. If that model fails, its existing error is returned and no configured entry, CLI backend or provider default receives the file. Runs without `--model` keep today's configured selection and fallback chain.

## Why This Change Was Made

The maintainers chose strict pinning, as the docs already promise. The requested model becomes the only media attempt. It reuses a configured descriptor (credential owner, base URL, headers) only when that entry is the same provider and model. The CLI reaches this through an internal runtime entry, so the plugin runtime API is unchanged. The earlier revision's optional public `modelOverride` field and its SDK doc are removed. `docs/cli/infer.md` keeps the pin wording and adds one line for audio and video.

Thanks @alkor2000 for the original change (kept as the first four commits) and @yetval for the report and repro.

## Evidence

Observed proof: #190287 (comment). The CLI was built from source with isolated state and local fixture providers that record every upload. A is the configured chain (a failing entry, then a working one) for audio and video, B is requested with `--model`, and W is a transcription endpoint for the whisper-1 case.

| Run | Base 5fb2315 | This PR f3d3739 |
|---|---|---|
| audio `--model openai/gpt-4o-mini-transcribe` | A ×3 (voxtral-a-broken ×2, voxtral-a), B 0 | B ×1 (gpt-4o-mini-transcribe), A 0 |
| video `--model moonshot/kimi-b` | A ×3 (qwen-a-broken ×2, qwen-a), B 0 | B ×1 (kimi-b), A 0 |
| audio `--model openai/b-fail` (B returns 500) | A ×3, exit 0 with A's text | B ×2 (500, transport retry), A 0, exit 1 with "Audio transcription failed (HTTP 500)" |
| video `--model moonshot/b-fail` (B returns 500) | A ×3, exit 0 with A's text | B ×2 (500), A 0, exit 1 with "Moonshot video description failed (HTTP 500)" |
| audio, no `--model` (control) | A ×3, result voxtral-a | A ×3, result voxtral-a (same) |
| video, no `--model` (control) | A ×3, result qwen-a | A ×3, result qwen-a (same) |
| audio `--model openai/whisper-1`, no `tools.media.models` | W model=gpt-4o-transcribe | W model=whisper-1 |

- `src/media-understanding/resolve.test.ts`: the new pin case (audio and video) fails on the merge base and passes here. `src/cli/capability-cli.test.ts` (121 tests) and the media runner/runtime suites pass.
- Full build (`--dts`) passes, including the plugin SDK export check. Head 2057fd7 adds only a `// mock-isolation:` comment on the media runtime mock in `capability-cli.test.ts` (the mock-exports ratchet asks for one when a mock factory changes; the mocked runtime would otherwise reach provider uploads and credential lookup), and drops that factory's stale grandfathered hash from `config/test-mock-exports-baseline.txt`, on top of the proven f3d3739; production code is identical.
- Deltas against the merge base: production +60/−25, tests +54/−23 (the new regression, plus one CLI case moved to the media CLI test module to stay under its line cap), docs +1.

Merge danger: two-way door. A revert restores the old selection; nothing is written or migrated, and the public plugin runtime types are unchanged. Blast radius: only `openclaw infer audio transcribe` and `openclaw infer video describe` runs that pass `--model`. Channel media understanding and runs without `--model` take the same path as before.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 20, 2026
…openclaw#190287)

Root cause: src/cli/capability-cli/media-understanding-command.ts:49 passes `--model` only as `activeModel` (a conversation-model hint), and the media selector never treats it as a choice: `src/media-understanding/runner.ts:727` takes configured `tools.media.models` entries without looking at it, and with no entries, audio swaps the requested model for the provider default (`runner.ts:439`).

Related: openclaw#176246 (reported by @yetval; the earlier strict-pin proposal openclaw#172409 was closed in favor of that issue).

## What Problem This Solves

`openclaw infer audio transcribe --model provider/model` and `openclaw infer video describe --model provider/model` ignore the flag when `tools.media.models` has an entry, and upload the file to that configured entry, which is often a different provider. With no configured entry, `--model openai/whisper-1` is sent as `gpt-4o-transcribe`. The docs say `--model provider/model` pins a specific backend (`docs/cli/infer.md`).

## User Impact

With `--model`, the file goes only to the requested provider and model. If that model fails, its existing error is returned and no configured entry, CLI backend or provider default receives the file. Runs without `--model` keep today's configured selection and fallback chain.

## Why This Change Was Made

The maintainers chose strict pinning, as the docs already promise. The requested model becomes the only media attempt. It reuses a configured descriptor (credential owner, base URL, headers) only when that entry is the same provider and model. The CLI reaches this through an internal runtime entry, so the plugin runtime API is unchanged. The earlier revision's optional public `modelOverride` field and its SDK doc are removed. `docs/cli/infer.md` keeps the pin wording and adds one line for audio and video.

Thanks @alkor2000 for the original change (kept as the first four commits) and @yetval for the report and repro.

## Evidence

Observed proof: openclaw#190287 (comment). The CLI was built from source with isolated state and local fixture providers that record every upload. A is the configured chain (a failing entry, then a working one) for audio and video, B is requested with `--model`, and W is a transcription endpoint for the whisper-1 case.

| Run | Base 30c2ded | This PR f3d3739 |
|---|---|---|
| audio `--model openai/gpt-4o-mini-transcribe` | A ×3 (voxtral-a-broken ×2, voxtral-a), B 0 | B ×1 (gpt-4o-mini-transcribe), A 0 |
| video `--model moonshot/kimi-b` | A ×3 (qwen-a-broken ×2, qwen-a), B 0 | B ×1 (kimi-b), A 0 |
| audio `--model openai/b-fail` (B returns 500) | A ×3, exit 0 with A's text | B ×2 (500, transport retry), A 0, exit 1 with "Audio transcription failed (HTTP 500)" |
| video `--model moonshot/b-fail` (B returns 500) | A ×3, exit 0 with A's text | B ×2 (500), A 0, exit 1 with "Moonshot video description failed (HTTP 500)" |
| audio, no `--model` (control) | A ×3, result voxtral-a | A ×3, result voxtral-a (same) |
| video, no `--model` (control) | A ×3, result qwen-a | A ×3, result qwen-a (same) |
| audio `--model openai/whisper-1`, no `tools.media.models` | W model=gpt-4o-transcribe | W model=whisper-1 |

- `src/media-understanding/resolve.test.ts`: the new pin case (audio and video) fails on the merge base and passes here. `src/cli/capability-cli.test.ts` (121 tests) and the media runner/runtime suites pass.
- Full build (`--dts`) passes, including the plugin SDK export check. Head 2057fd7 adds only a `// mock-isolation:` comment on the media runtime mock in `capability-cli.test.ts` (the mock-exports ratchet asks for one when a mock factory changes; the mocked runtime would otherwise reach provider uploads and credential lookup), and drops that factory's stale grandfathered hash from `config/test-mock-exports-baseline.txt`, on top of the proven f3d3739; production code is identical.
- Deltas against the merge base: production +60/−25, tests +54/−23 (the new regression, plus one CLI case moved to the media CLI test module to stay under its line cap), docs +1.

Merge danger: two-way door. A revert restores the old selection; nothing is written or migrated, and the public plugin runtime types are unchanged. Blast radius: only `openclaw infer audio transcribe` and `openclaw infer video describe` runs that pass `--model`. Channel media understanding and runs without `--model` take the same path as before.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 23, 2026
…#190287)

Root cause: src/cli/capability-cli/media-understanding-command.ts:49 passes `--model` only as `activeModel` (a conversation-model hint), and the media selector never treats it as a choice: `src/media-understanding/runner.ts:727` takes configured `tools.media.models` entries without looking at it, and with no entries, audio swaps the requested model for the provider default (`runner.ts:439`).

Related: #176246 (reported by @yetval; the earlier strict-pin proposal #172409 was closed in favor of that issue).

## What Problem This Solves

`openclaw infer audio transcribe --model provider/model` and `openclaw infer video describe --model provider/model` ignore the flag when `tools.media.models` has an entry, and upload the file to that configured entry, which is often a different provider. With no configured entry, `--model openai/whisper-1` is sent as `gpt-4o-transcribe`. The docs say `--model provider/model` pins a specific backend (`docs/cli/infer.md`).

## User Impact

With `--model`, the file goes only to the requested provider and model. If that model fails, its existing error is returned and no configured entry, CLI backend or provider default receives the file. Runs without `--model` keep today's configured selection and fallback chain.

## Why This Change Was Made

The maintainers chose strict pinning, as the docs already promise. The requested model becomes the only media attempt. It reuses a configured descriptor (credential owner, base URL, headers) only when that entry is the same provider and model. The CLI reaches this through an internal runtime entry, so the plugin runtime API is unchanged. The earlier revision's optional public `modelOverride` field and its SDK doc are removed. `docs/cli/infer.md` keeps the pin wording and adds one line for audio and video.

Thanks @alkor2000 for the original change (kept as the first four commits) and @yetval for the report and repro.

## Evidence

Observed proof: #190287 (comment). The CLI was built from source with isolated state and local fixture providers that record every upload. A is the configured chain (a failing entry, then a working one) for audio and video, B is requested with `--model`, and W is a transcription endpoint for the whisper-1 case.

| Run | Base 5fb2315 | This PR f3d3739 |
|---|---|---|
| audio `--model openai/gpt-4o-mini-transcribe` | A ×3 (voxtral-a-broken ×2, voxtral-a), B 0 | B ×1 (gpt-4o-mini-transcribe), A 0 |
| video `--model moonshot/kimi-b` | A ×3 (qwen-a-broken ×2, qwen-a), B 0 | B ×1 (kimi-b), A 0 |
| audio `--model openai/b-fail` (B returns 500) | A ×3, exit 0 with A's text | B ×2 (500, transport retry), A 0, exit 1 with "Audio transcription failed (HTTP 500)" |
| video `--model moonshot/b-fail` (B returns 500) | A ×3, exit 0 with A's text | B ×2 (500), A 0, exit 1 with "Moonshot video description failed (HTTP 500)" |
| audio, no `--model` (control) | A ×3, result voxtral-a | A ×3, result voxtral-a (same) |
| video, no `--model` (control) | A ×3, result qwen-a | A ×3, result qwen-a (same) |
| audio `--model openai/whisper-1`, no `tools.media.models` | W model=gpt-4o-transcribe | W model=whisper-1 |

- `src/media-understanding/resolve.test.ts`: the new pin case (audio and video) fails on the merge base and passes here. `src/cli/capability-cli.test.ts` (121 tests) and the media runner/runtime suites pass.
- Full build (`--dts`) passes, including the plugin SDK export check. Head 2057fd7 adds only a `// mock-isolation:` comment on the media runtime mock in `capability-cli.test.ts` (the mock-exports ratchet asks for one when a mock factory changes; the mocked runtime would otherwise reach provider uploads and credential lookup), and drops that factory's stale grandfathered hash from `config/test-mock-exports-baseline.txt`, on top of the proven f3d3739; production code is identical.
- Deltas against the merge base: production +60/−25, tests +54/−23 (the new regression, plus one CLI case moved to the media CLI test module to stay under its line cap), docs +1.

Merge danger: two-way door. A revert restores the old selection; nothing is written or migrated, and the public plugin runtime types are unchanged. Blast radius: only `openclaw infer audio transcribe` and `openclaw infer video describe` runs that pass `--model`. Channel media understanding and runs without `--model` take the same path as before.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 577dd00)
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit b2c0c30f5eda50b952a59fac964791bbb19eff80)
(cherry picked from commit 90c5ede417cb3ae2bcd454a31c4a9d0773c4d28d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant