Repository navigation
fix(media): keep deferred audio and extraction providers discoverable - #139231
Conversation
…ted provider is not already loaded extractStructuredWithModel built the provider registry without telling it which provider the caller asked for. On a warm gateway the plural capability resolve returns only active providers plus tools.media.models owners (src/plugins/capability-provider-runtime.ts:347-354, :615), so an explicitly requested owner that is in neither set never reached the registry and the call threw "Provider does not support structured extraction" before any provider work started. Forward the requested id into buildMediaUnderstandingRegistry and resolve it through resolvePluginCapabilityProvider, the same by-id path the image tool already uses (src/agents/tools/image-tool.ts:116-125, :618-632). The merge runs ahead of the config-derived image entries so a plugin's own hooks are not shadowed by a synthetic entry that only carries describeImage/describeImages. Refs openclaw#119772 Co-Authored-By: Claude Opus 5 <[email protected]>
|
🦞👀 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 maintainer review before merge. Reviewed September 6, 2026, 5:29 PM ET / 21:29 UTC. ClawSweeper reviewWhat this changesKeeps enabled audio and structured-extraction providers discoverable while limiting capability inference to shared model entries that need it, with regression coverage and clarified documentation. Merge readiness✅ Ready for maintainer review This remains a useful fix absent from current main. No actionable introduced defects were found, and the final Gateway evidence addresses the earlier runtime, loading-cost, and warm-reuse concerns. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s media subsystem discovers eligible plugin providers, selects configured or automatic models, and turns media inputs into transcripts or structured results. This change separates complete provider discovery from model selection and capability inference. flowchart TD
A[Plugin metadata and policy] --> B[Eligible provider catalog]
C[Active providers] --> B
D[Shared model settings] --> E[Scoped capability inference]
E --> F[Model selection]
B --> F
F --> G[Audio or extraction dispatch]
G --> H[Transcript or structured result]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -20, Tests +370, Docs 0, Other 0. Total +350 across 10 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep provider discovery complete at its shared owner while preserving explicit execution choices and narrowly resolving capability metadata. Do we have a high-confidence way to reproduce the issue? Yes: current-main source can return only active media providers when no additional configured owner is requested, omitting an eligible deferred provider. The supplied before/after Gateway evidence exercises that scenario; this review did not execute it. Is this the best way to solve the issue? Yes: repairing the shared catalog addresses both affected consumers without adding a competing fallback, and scoped inference avoids unnecessary owner loading. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7e21eebac413. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
…ed-provider-by-id
…ed-provider-by-id
Integrate current main and repair the shared media provider catalog instead of adding a consumer-only requested-provider fallback. Preserve explicit model and CLI execution selection and the image tool's deliberate lazy provider loading. The final source tree is identical to the independently reviewed and validated maintainer candidate. Keep the contributor branch ancestry. Related: openclaw#119772 Co-authored-by: Rodrigo Oliveira <[email protected]>
|
Heads-up on These look specific to this head rather than the flake this PR hit earlier (that was Plausible mechanism: adding |
…ed-provider-by-id
Integrate the verified CI correction with the contributor main merge, preserving both histories and the exact reviewed integration tree. Keep model selection separate from complete provider discovery; infer capabilities only for shared provider entries that need them. Related: openclaw#119772
|
@clawsweeper re-review The CI correction is integrated at |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Final verification on Redacted summary of the recorded results: {
"head": "e0f848cf4a82664261de1e82ff5565c19ffb599c",
"ci": {
"run": 34060063771,
"conclusion": "success",
"completedJobs": 157,
"successfulJobs": 141,
"skippedJobs": 16
},
"audio": {
"cases": 8,
"sdkRequests": 16,
"pass": true
},
"structured": {
"cases": 4,
"sdkRequests": 8,
"expectedHookCalls": 6,
"pass": true
},
"fullBundledInventory": {
"owners": 18,
"baselineCases": 3,
"candidateCases": 3,
"requestsPerBuild": 6,
"candidateSentinelMode": "discovery",
"registrationsPerFreshGateway": 1,
"warmReregistrations": 0,
"pass": true
},
"candidateSdkMs": {
"cli": [
191.71,
51.76
],
"activeApi": [
133.57,
4.16
],
"budget": [
104.87,
1.21
]
},
"cleanup": {
"forcedKills": 0,
"remainingOwnedListeners": 0,
"runtimeErrors": 0,
"privateStateRemoved": true
},
"build": {
"seconds": 80.71866625,
"fullSealVerified": true
},
"scope": "Real isolated Gateways with synthetic provider hooks; no real model/native Codex/channel delivery claim"
}The first/warm measurements are one pair per fresh isolated Gateway. Every response, registry-mode assertion, source/build seal and cleanup receipt was inspected. Broader #119772 and generic extraction fallback #119773 remain outside this PR. |
|
Merged via squash.
|
* commit '294df333c58f2da104eccffc623ccb3c4d43d4d8': (1802 commits) fix: clear stale diagnostics after Gateway changes (#140426) fix: keep plugin catalogs intact after discovery timeouts (#140441) perf(tui): prepare session picker rows once per overlay (#140462) refactor(config): reuse environment substitution for write-back (#140460) refactor(discord): remove retired auto-presence templates (#140463) fix(ui): finish roster refreshes during session activity (#140459) fix(setup): match prepared credentials to the model provider (#140461) fix: keep MiniMax discovery on the selected credential (#140438) refactor(tests): remove unused parent context cache reset (#140456) fix: avoid repeated xAI OAuth refresh during discovery (#140434) perf(routing): reuse prepared event session targets (#140454) fix(media): keep deferred audio and extraction providers discoverable (#139231) refactor(codex): remove redundant app-server forwarding (#140451) fix(test): avoid false native polling timeouts (#140119) test(gateway): retain saved source in reload fixtures (#140453) fix(gateway): reduce repeated model work when listing sessions (#140414) fix(feishu): fall back to post mode over table limit (#136382) fix: use the bundle-compatible Proxyline runtime under Bun (#140411) refactor(trace): reuse the canonical usage counter type (#140444) refactor(node-host): share execution policy result fields (#140446) ...
…able providers Root cause: only the bundled Codex plugin implements `extractStructured`, and registry hydration never bound one for any other image-capable provider, so `extractStructuredWithModel` failed with "Provider does not support structured extraction" for every non-Codex `visionModel` even though those providers already describe images through the shared model runtime. Owner: media-understanding registry hydration (`provider-registry.ts`) plus the shared image runtime (`image.ts`, `image-runtime.ts`), which already own the describeImage/describeImages defaults. Canonical fix: hydrate `extractStructured` next to those defaults from a new lazy `extractStructuredWithImageModel` export. `structured-extraction.ts` runs one completion through `completeImagesWithModel` with the extraction instructions (including a no-secrets rule) as the prompt, supplemental text as `userText` in the user message, and `promptDelivery: "system-required"`. That flag makes the shared runtime refuse, before any request, exactly the routes on which it would itself demote the prompt into user content (the GitHub Copilot, OpenRouter, and Alibaba Model Studio endpoint classes and both MiniMax VLM branches), because the output is persisted. A plugin stream that demoted `Context.systemPrompt` would break every agent turn on that provider, so that boundary stays with the plugin install, not this gate. The shared extractor defaults an empty `agentDir` to the configured default agent dir. The dispatcher still passes "" through unchanged, so a bespoke extractor such as Codex - which uses a non-empty agentDir as its thread cwd (bounded-turn.ts:125) - sees no change. On the shared path that key selects prepared-model owners and "" matches none on a long-lived gateway; Logbook never passes one. Regression: structured-extraction.test.ts. Replies are parsed strictly first; a fenced or prose-wrapped reply falls back to the first balanced JSON object or array (normalization-core's extractBalancedJsonPrefix) so model formatting drift does not fail a whole batch. A reply with no JSON in it is still a controlled error. Regression: structured-extraction.test.ts (fenced reply; no-JSON reply). Removed versus the previous head of this branch: - the by-id provider resolver in `buildMediaUnderstandingRegistry` and its runtime call: superseded on main by openclaw#139231 - the `SYSTEM_INSTRUCTION_TRANSPORTS` allowlist and `api` inspection: an unverifiable promise about plugin transports; the gate now records only the one decision the runtime owns - `imagePayloadTransform` and the opencode rewrite: opencode-only and separable Production LOC: +220/-11 (image.ts +55/-8, provider-registry.ts +9/-2, image-runtime.ts +8/-1, structured-extraction.ts +148); tests +347/-3; docs and the Logbook manifest help text shortened to the rule above. The config-doc baseline hash (docs/.generated/config-baseline.sha256) is regenerated for the help-text change, as its check instructs. Sibling coverage: describeImage/describeImages hydration is untouched and Codex keeps its own `extractStructured` hook (provider-registry.test.ts). The boundary test in image.test.ts asserts the exact `Context` handed to `complete`, and the refusal cases assert no stream registration, completion, or fetch. Proof gap: a live gateway run of Logbook against a non-Codex `visionModel` is still pending. Local proof: focused Vitest suites (media-understanding, image-tool provider loading, opencode), oxfmt, oxlint, `plugin-sdk:surface:check`, and the assertion-safety and coercion guards. Closes openclaw#119772 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…openclaw#139231) Keep enabled audio and structured-extraction providers discoverable after another media plugin loads, and when shared models select only images. Merge eligible manifest owners at the shared catalog; leave execution selection with the runner and preserve active instances, policy filtering, and selected image loading. Resolve capability metadata only for normalized, deduplicated untagged provider entries. Pair synthetic audio fixtures with their matching runtime/metadata generation to avoid unrelated cold plugin imports. Verified the final integration with 69 focused tests, formatting/lint/core typecheck, a fresh independent review, a sealed build, 12 audio/extraction Gateway cases, and three paired full-inventory discovery cases. Exact-head CI 34060063771 succeeded (141 successful jobs, 16 skipped). Production delta: -20 lines. Related openclaw#119772 remains open; generic extraction fallback openclaw#119773 is outside scope. Thanks to @rodrigo-fonseca-oliveira for the original diagnosis and fix. Co-authored-by: Rodrigo Oliveira <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Related: #119772, which remains open. The generic structured-extraction fallback requested in #119773 is outside this change.
What Problem This Solves
Fixes an issue where audio transcription and structured extraction lose an enabled provider after another media plugin loads first. Automatic audio can report
skipped / no-model; extraction can reject a provider before its hook runs. An image-only model list can also hide eligible automatic audio providers.Why This Change Was Made
The shared media catalog now merges eligible manifest owners with active providers. It removes the model-list filter from discovery and leaves model/CLI execution selection with the media runner, preserving active instances and plugin eligibility policy.
The CI repair keeps that catalog complete while making capability inference resolve only normalized, deduplicated shared provider entries that lack valid explicit capability tags. CLI and tagged entries need no inferred lookup; a later untagged entry for the same provider still does. Existing singular resolution preserves runtime metadata, policy, aliases, and config-image fallback precedence. The two synthetic audio fixtures now bind matching metadata and runtime registries in one generation, retaining their real file/runner paths, timeouts, and behavior assertions.
Rodrigo Oliveira's original diagnosis and contributor ancestry are preserved. Integrated candidate
e0f848cf4a82664261de1e82ff5565c19ffb599cpreserves both the contributor's main merge4cc1e32dc5533d09ff38c62a88d668fc42daab87and the tested correction28f6a6192f69b2e4cc02faf19df4eb309f767ac4.User Impact
Deferred audio and extraction providers remain discoverable without changing explicit execution choices. Capability inference avoids unnecessary known-owner loading for entries that already declare their capabilities. The image tool retains its deliberate selected-provider loading contract.
Across ten files, production is −20 net lines and tests +370. Docs have a one-line clarification with zero net growth; there is no configuration-surface change. The assertion allowance shrinks from 15 to 14 for the deleted assertion.
Evidence
Validation complete: exact-head CI34060063771 is green (141 successful jobs and 16 skipped jobs; 157 completed), and final integrated runtime proof is complete. Native landing verification remains.
Pre-integration correction
28f6a619…: 148 passed, zero failed or skipped, across nine files, including the unchanged 22-case inference consumer suite, both audio fixtures, real-loader inference regressions, catalog/selection siblings, and seven image-loading controls. The complete ten-path changed-check gate passed in 961.108 seconds, exit 0, with source/index unchanged.The integrated candidate passed 69 cases across six files, including all three CI-failing surfaces and the provider HTTP error suite. Targeted formatting/lint and the integrated core typecheck passed. Its uncached build passed in 80.719 seconds with source/dependency identity unchanged and a separately verified full artifact seal. Fresh independent review found zero actionable P0–P2 findings.
Qualified inference regressions first exposed four unwanted-import failures. A follow-up case exposed one tagged-peer failure with four passing controls. All are included in the final passing suite. The accepted final single-packet independent review reported zero actionable P0–P2 findings.
CI run 34054536528 exposed the inference timeout (job
101543979531), audio-disposition timeout/next-case assertion failure (101543981395), and Discord audio-fixture timeout (101543981547). These drove the owner and fixture repairs; that failed run is not reported green or blindly rerun.Earlier built proof at
7c7856901fe20782de836666cd71c3a8d59aeb94, tree-identical to published12943c7b…, completed eight audio cases/16 SDK requests and four extraction cases/eight requests. The omission scenarios failed on the baseline and reached the intended hooks after repair; exact synthetic inputs, denied/disabled controls, warm registration counts, seals, and cleanup were verified.Final
e0f848cf…Gateway proof passed eight audio cases/16 SDK requests and four structured-extraction cases/eight requests with six expected extraction hook calls. Exact inputs, disabled/denied controls, warm registration stability, full artifact seals, process/listener absence, and private-state cleanup were independently checked.Full bundled-inventory proof passed three cases/six SDK requests per build. Each fresh Gateway had all 18 bundled media owners available; the deferred sentinel registered exactly once in discovery mode on the candidate and never activated. Explicit CLI/API execution and budget-only behavior held, with no runtime errors. The two final built plugin-entry import profiles also passed.
Each row measures one fresh Gateway followed by one warm request. Inventory inspection and seal verification can warm filesystem caches.
Runtime evidence uses ordinary synthetic SDK plugins on real isolated Gateways. It proves discovery and dispatch, not real-model quality, native Codex execution, external-provider services, channel delivery, or a full Logbook run. Complete discovery can load additional eligible owners; unknown singular IDs retain the existing family-wide alias lookup.
The latest review's final-candidate runtime, loading-cost, and warm-reuse requests are all addressed by the completed results above. No candidate source changes followed those measurements.