Repository navigation
fix(cli): honor agent selection for image descriptions - #147456
Conversation
Carry the validated agent identity alongside its directory in image description, audio transcription, and video description calls. Add optional audio and video runtime parameters and check identity forwarding through registered CLI commands. Refs #145119 (cherry picked from commit 8dfa5563e6307eac624ca9257cff7685ca5f1196)
|
🦞👀 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: blocked before merge. Reviewed September 13, 2026, 6:13 PM ET / 22:13 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR forwards the selected agent identity alongside its credential directory through image, audio, and video inference, adds optional audio/video runtime parameters, and strengthens command-routing assertions. Merge readiness⛔ Blocked before merge - 1 item remains This remains a useful, focused fix: current main still drops the selected image agent identity. No actionable correctness or security findings remain, and the supplied terminal evidence demonstrates the repaired behavior. The prior SDK compatibility concern is explicitly addressed in the PR body. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s media inference CLI selects an agent and passes media to the shared understanding runtime. That runtime uses the agent’s model and credential context to obtain descriptions or transcripts from providers. flowchart LR
A[Media file and CLI options] --> B[Resolve configured agent]
B --> C[Prepare selected credentials]
C --> D[Media understanding runtime]
D --> E[Provider request]
E --> F[Description or transcript]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +6, Tests +35. Total +41 across 5 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve the selected identity and credential directory together through the existing media runtime while retaining directory-only SDK compatibility. Do we have a high-confidence way to reproduce the issue? Yes. Current source establishes the missing identity forwarding, and the supplied before/after CLI traces demonstrate the failure with three explicit-owner agents; this read-only review did not independently execute it. Is this the best way to solve the issue? Yes. Forwarding the already-resolved identity repairs the existing owner boundary without duplicating selection logic, changing defaults, or requiring migration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 04f20b56bf4d. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
landpr-approve-admin-merge |
|
Thanks @MertBasar0! Proof: In an explicit multi-agent fleet, all three image description commands now succeed with the selected agent and reach the provider. Sole-agent image, audio, and video controls keep passing.
|
## What Problem This Solves Image inference accepts `--agent`, discards the selected identity, and fails in explicit multi-agent fleets—even when the named agent exists. Supersedes openclaw#145188 by @MertBasar0. Reported in openclaw#145119 by @jarvis-stephens-bot. ## User Impact Image description works with the selected agent. Audio and video commands carry the same selected identity and retain their existing successful output behavior. ## Why This Change Was Made The decision which agent owns the operation stays with `resolveCapabilityProviderAgentId` in `src/cli/capability-cli/shared.ts`. All four CLI call sites now forward that decision alongside its credential directory. Tests check both values at the runtime boundary. Current audio evaluation order and provider/model output are preserved. ## Evidence With three explicit-owner agents and a synthetic loopback provider, the following commands failed before any HTTP request on main `bccb84ab286d`. They succeed on `068dc9c759d9`: ```sh pnpm openclaw infer image describe --file image.png --prompt describe --agent finance --json pnpm openclaw infer image describe --file image.png --prompt describe --model stubvision/stub-vision-1 --agent finance --json pnpm openclaw infer image describe-many --file image.png --file image.png --prompt describe --agent finance --json ``` Sanitized terminal captures: ```text Before: exit 1; ok=false; AgentSelectionRequiredError; HTTP requests=0 After describe: exit 0; ok=true; SYNTHETIC_IMAGE_DESCRIPTION; requests=1 After explicit model: exit 0; ok=true; SYNTHETIC_IMAGE_DESCRIPTION; requests=1 After describe-many: exit 0; ok=true; two descriptions; requests=2 ``` The real Gateway passed its health check. These media commands use local transport. Sole-agent image, configured audio transcription, and configured video description succeed before and after; audio/video are consistency controls, not reproduced failures. The new registered-command assertions fail nine cases on trusted main `d8799ec248a5` and pass after the repair. On merge `e0665878861f` (parents `068dc9c759d9` and main `3642fc8281b9`), all five selected test files pass: **332 tests**. <details> <summary>Validation commands and limits</summary> ```sh node scripts/run-vitest.mjs run --config test/vitest/vitest.cli.config.ts src/cli/capability-cli.test.ts --testNamePattern 'owner selection' node --import tsx scripts/ci-run-node-test-shard.mts pnpm openclaw infer audio transcribe --file audio.wav --agent finance --json pnpm openclaw infer video describe --file video.mp4 --agent finance --json ``` The CI test runner selected the full capability CLI, local account-secret, media runtime, settings-storage, and proxy lifecycle test files. CLI/account tests: 259; media runtime: 33; settings: 15; proxy: 25. An inherited color setting first affected the settings numeric-output assertion; disabling forced color passed without source or test changes. The successful owner/runtime suites were not repeated. Formatting, syntax lint, assertion safety, line limits, and unused-export checks pass. [CI run 34784959798](https://github.com/openclaw/openclaw/actions/runs/34784959798) passed at `068dc9c759d99233ed17b668bef97b94ad10ab86`, including production and test typechecks. The original PR's settings failure was repaired upstream in openclaw#147029. Its old proxy child-exit failure remains unexplained; both exact tests passed in its matched main-parent CI. The current tests pass, but this does not waive fresh CI or declare the old proxy failure unrelated. </details> **External SDK compatibility:** The same external consumer compiled and ran against the shipped 2026.9.4 package and the packaged candidate at `068dc9c759d9` in one isolated container. Directory-only and `agentId` calls passed for both audio and video: four successful calls per package, with the expected credential directory and loopback-only transport. ## Compatibility Audio/video SDK parameter types gain optional `agentId` fields. Existing directory-only callers remain valid. There is no new export, config key, schema, migration, protocol, or dependency. ## Consumers The selected agent identity and its credential directory now reach all four media CLI runtime calls. The existing runtime uses that identity for image model and workspace context. Audio and video retain their existing credential-directory behavior. The optional audio/video `agentId` fields extend the existing SDK parameter types. Existing directory-only callers remain valid. Browser screenshot description, sticker description, and voice transcription callers are unchanged; this PR does not claim to repair their separate identity-forwarding gaps. The three image command cases fail before any HTTP request on the recorded main baseline and succeed on the candidate. Configured audio/video and sole-agent image commands pass before and after. Automatic-selection cases were not executed. The media commands use local transport. The running Gateway is a health control. The 332 passing tests are the selected complete test files on the recorded fresh merge; full CI and typechecking passed in the exact-head run linked above. No cache or persisted state is added; existing account preparation and request cleanup keep their owners. Co-authored-by: MertBasar0 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Image inference accepts
--agent, discards the selected identity, and fails in explicit multi-agent fleets—even when the named agent exists.Supersedes #145188 by @MertBasar0. Reported in #145119 by @jarvis-stephens-bot.
User Impact
Image description works with the selected agent. Audio and video commands carry the same selected identity and retain their existing successful output behavior.
Why This Change Was Made
The decision which agent owns the operation stays with
resolveCapabilityProviderAgentIdinsrc/cli/capability-cli/shared.ts. All four CLI call sites now forward that decision alongside its credential directory. Tests check both values at the runtime boundary. Current audio evaluation order and provider/model output are preserved.Evidence
With three explicit-owner agents and a synthetic loopback provider, the following commands failed before any HTTP request on main
4394ad538cac. They succeed on068dc9c759d9:Sanitized terminal captures:
The real Gateway passed its health check. These media commands use local transport. Sole-agent image, configured audio transcription, and configured video description succeed before and after; audio/video are consistency controls, not reproduced failures.
The new registered-command assertions fail nine cases on trusted main
21aaac7ad6e7and pass after the repair. On mergee0665878861f(parents068dc9c759d9and main1692f891b167), all five selected test files pass: 332 tests.Validation commands and limits
node scripts/run-vitest.mjs run --config test/vitest/vitest.cli.config.ts src/cli/capability-cli.test.ts --testNamePattern 'owner selection' node --import tsx scripts/ci-run-node-test-shard.mts pnpm openclaw infer audio transcribe --file audio.wav --agent finance --json pnpm openclaw infer video describe --file video.mp4 --agent finance --jsonThe CI test runner selected the full capability CLI, local account-secret, media runtime, settings-storage, and proxy lifecycle test files. CLI/account tests: 259; media runtime: 33; settings: 15; proxy: 25. An inherited color setting first affected the settings numeric-output assertion; disabling forced color passed without source or test changes. The successful owner/runtime suites were not repeated.
Formatting, syntax lint, assertion safety, line limits, and unused-export checks pass. CI run 34784959798 passed at
068dc9c759d99233ed17b668bef97b94ad10ab86, including production and test typechecks.The original PR's settings failure was repaired upstream in #147029. Its old proxy child-exit failure remains unexplained; both exact tests passed in its matched main-parent CI. The current tests pass, but this does not waive fresh CI or declare the old proxy failure unrelated.
External SDK compatibility: The same external consumer compiled and ran against the shipped 2026.9.4 package and the packaged candidate at
068dc9c759d9in one isolated container. Directory-only andagentIdcalls passed for both audio and video: four successful calls per package, with the expected credential directory and loopback-only transport.Compatibility
Audio/video SDK parameter types gain optional
agentIdfields. Existing directory-only callers remain valid. There is no new export, config key, schema, migration, protocol, or dependency.Consumers
The selected agent identity and its credential directory now reach all four media CLI runtime calls. The existing runtime uses that identity for image model and workspace context. Audio and video retain their existing credential-directory behavior.
The optional audio/video
agentIdfields extend the existing SDK parameter types. Existing directory-only callers remain valid. Browser screenshot description, sticker description, and voice transcription callers are unchanged; this PR does not claim to repair their separate identity-forwarding gaps.The three image command cases fail before any HTTP request on the recorded main baseline and succeed on the candidate. Configured audio/video and sole-agent image commands pass before and after. Automatic-selection cases were not executed.
The media commands use local transport. The running Gateway is a health control. The 332 passing tests are the selected complete test files on the recorded fresh merge; full CI and typechecking passed in the exact-head run linked above.
No cache or persisted state is added; existing account preparation and request cleanup keep their owners.