Repository navigation
Conversation
|
🦞👀 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 real behavior proof before merge. What this changesMake 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.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete 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 Decision needed
Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +38, Tests +191. Total +229 across 2 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 (1 earlier review cycle)
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.
0516926 to
eaf0313
Compare
|
Rebased onto current main (bb642e1) and addressed the review at 0516926f2ce. New head: eaf0313.
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 @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
|
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. |
…#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]>
…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]>
…#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)
Summary
openclaw infer audio transcribe --model <provider/model>andopenclaw infer video describe --model <provider/model>do not pin the requested backend. Whentools.media.modelshas 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-1uploadsmodel=gpt-4o-transcribe).docs/cli/infer.mdsays "Use--provideror--model provider/modelto pin a specific backend", andinfer image describe --modelalready pins.Root cause
src/cli/capability-cli/media-understanding-command.tsforwards--modelonly asactiveModel:In the runner,
activeModelmeans "the active chat model" for the reply pipeline. Audio deliberately replaces it with the provider transcription default (resolveAutoProviderModelEntryinsrc/media-understanding/runner.ts, because a chat model id is not a valid STT model), and wheneverresolveModelEntriesfinds configuredtools.media.modelsentries for the capability,activeModelis 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
--modelis given, the command runs with a request-local config whosetools.media.modelsis exactly one entry for this capability with the requested provider and model:pinMediaModelstarts 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. ItsbaseUrl,headers,request,profile,preferredProfileand limits are kept, and onlyprovider,modelandcapabilitiesare set. CLI entries and entries tagged only for other capabilities are never borrowed. Without--modelthe config object is passed through unchanged.Why this is the right boundary
The meaning of
--modelis owned by the CLI command; the runner'sactiveModelsemantics are correct for channel replies and stay untouched, so automatic audio still uses the provider STT default. Provider auth,tools.media.audio/tools.media.videosettings and the persisted config are unchanged; only the model list for this one invocation is narrowed. A previously working--modelinvocation that names a configured entry keeps that entry's transport and auth settings (the regression raised in review at 0516926f2ce).infer image describealready pins throughdescribePreparedImageWithModel, 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 viaimportOriginalpass-through, and the provider transport records the request it receives.baseUrl/headers case and the provider-wide video entry case), which is the review's P1.oxlint -c .oxlintrc.jsonandoxfmt --checkon 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-existingsrc/flows/doctor-plugin-source-captures.test.ts, untouched here).Real behavior proof
Behavior addressed:
openclaw infer audio transcribe --model <provider/model>andopenclaw infer video describe --model <provider/model>sent the upload to the configuredtools.media.modelsentry instead of the requested provider/model; pinning a configured model must also keep that entry's ownbaseUrland headers.Real environment tested: the real
openclawCLI entry (src/entry.ts, run from source) on pristine main bb642e1 and on this PR head eaf0313, with an isolatedHOME,OPENCLAW_CONFIG_PATHandOPENCLAW_STATE_DIRand 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 ownextensions/moonshotthroughplugins.load.paths, since it ships as an external plugin). The only external seam replaced is the provider HTTP endpoint: each providerbaseUrl(and the entry-levelbaseUrlof the configured entries) points at a local HTTP listener that logs the route, the requestedmodeland thex-entryheader. 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> --jsonfrom 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, andaudio transcribe --file tone.wav(no--model), then reading the listener log after each run.Evidence after fix:
Observed result after fix:
--model openai/whisper-1now reaches the OpenAI endpoint withmodel=whisper-1and--model moonshot/kimi-k2.6now runs video description on moonshot withmodel=kimi-k2.6, where main sent both to the configured entry;--model deepgram/nova-3still reaches the configured entry's owndeepgram-proxybase URL with itsx-entry: keptheader, exactly as on main, and omitting--modelstill 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.