Repository navigation
refactor(media): deslop media - #156406
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 maintainer review before merge. Reviewed September 23, 2026, 12:12 PM ET / 16:12 UTC (Revision 5). ClawSweeper reviewWhat this changesConsolidates media-provider polling, bounded downloads, speech configuration, and attachment handling while preserving existing provider behavior. Merge readiness✅ Ready for maintainer review Keep open: this remains useful cleanup beyond the merged overlapping work. The previous documentation and conflict concerns are resolved, and no introduced correctness or security defect was found. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw’s media subsystem sends generation and understanding requests to provider plugins and processes incoming attachments. Shared helpers handle bounded responses and cleanup, while plugins retain their authentication, request formats, and transport policies. flowchart LR
A[Generation requests] --> C[Provider plugins]
B[Incoming attachments] --> D[Attachment resolution]
D --> C
C --> E[Provider transport and polling]
E --> F[Bounded response processing]
F --> G[Media assets or descriptions]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -956, Tests -96, Docs +16, Other -6. Total -1042 across 55 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep shared mechanics with the existing media owners and retain vendor-specific transport, authentication, and deadline decisions in provider plugins. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving refactor, and no introduced failing path was established. Is this the best way to solve the issue? Yes: the patch reuses existing media owners, removes duplicate mechanics, and preserves provider-specific contracts with relevant transport and integration evidence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 05996479d818. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
f626b67 to
10fe0f7
Compare
0aece0f to
95069c1
Compare
95069c1 to
31619be
Compare
|
Merged via squash.
|
* refactor(media): deslop media * docs(plugin-sdk): clarify media helper scope
What Problem This Solves
Media providers repeat request construction, polling, bounded response handling, and configuration normalization, making the same contracts harder to maintain consistently.
User Impact
No intended behavior change. Provider authentication, request/output formats, deadlines, byte limits, cleanup, configuration, and public SDK exports remain compatible.
Why This Change Was Made
pollProviderOperation, keeping each provider's transport, status decoding, and deadline scope local.readGeneratedVideoAsset; remove duplicate download callbacks and forwarding layers around existing SDK owners.Evidence
Merged through the native maintainer flow as
16908037a03439b25e314ad5a330e9df12c45f08; the coordinator-approved source head was unchanged.The coordinator reviewed the diff and explicitly approved landing as-is at 956 net production lines removed. On unchanged head
31619be2582d1419e1d7df6817fdb50f5f128d36, the coordinator reran the failed small-5 job: rerun SUCCESS, CI gate SUCCESS. The historical timing reproductions below remain recorded as flake evidence; no code, assertion, or timeout was changed for the rerun.node scripts/check-changed.mjs --base origin/main— passed lint, formatting, core/extension production and test types, boundary guards, and ratchets after rebasing onto31dd34ff194b(including the session-share and Telegram fixture repairs below).node scripts/run-vitest.mjs <affected paths and cross-importers>— 14 native test groups passed in 294.35s: 2,232 tests / 112 passing files, six existing skips. Includes image/video/music/speech providers, media-understanding, CLI consumers, bounded response readers, real-socket transport cleanup, and shared-fixture consumers.node scripts/run-vitest.mjs test/scripts/plugin-sdk-surface-report.test.ts— 11 passed;src/plugins/contracts/plugin-sdk-subpaths.test.ts— 18 passed. Public SDK surface remains 158 entrypoints / 4,569 exports / 2,681 callable exports.pnpm plugin-sdk:api:diff -- --base origin/main --head HEAD— No Plugin SDK API changes. The requestedplugin-sdk:api:checkscript does not exist; this is the repository's current comparison command.pnpm build— passed in 8m34s, including runtime/SDK declarations and native plugin loading checks.git diff --checkand Codex autoreview through P2 — clean, no accepted/actionable findings. The latest review covers the rebased runner integration, including preserved deferred provider discovery.The refreshed proof ran on Blacksmith Testbox
tbx_01m37938cgbnazzcsm6mfzyrpg(runner), against frozen base31dd34ff194b981c38ea63ecae4bf351e8496a49with all 55 changed files hash-verified. The complete delegated command exited 0; the lease is stopped. The critical integration selection additionally passed 12 Vitest shards in 375.36s, covering media auto-selection, session-share, the original nine-file Telegram sequence, and native Telegram pipeline. A Testbox lifecycle job may display cancellation during normal cleanup; delegated command results own this evidence.The fully validated head
0aece0f7c9ab0907b2f7e519de90d8921b39f4beincluded the upstream repairs described below and a reviewed documentation correction identifying private helpers as official-plugin-only. Head95069c18238e6f117d7297e35b4750f4510b553brebased that patch ontob1ec560836f0, integrating the overlapping Google/OpenAI cleanup from #156297. It retains main’s Google config/model helpers and OpenAI base-URL helper alongside this PR’s shared polling/request paths. Refreshed integration proof passed on this head. Exact-head CI reported three failures and finished cancelled; the matched-source investigation is recorded below. The earlier full proof above is explicitly tied to its original head. The net deletion fell because part of the cleanup is now already on main.Post-conflict proof on
95069c18238, Blacksmith Testboxtbx_01m37ds8fn91g1w5m6yp8w9w60(runner), frozen baseb1ec560836f0and all changed files hash-verified:node scripts/check-changed.mjs --base origin/main -- extensions/google/speech-provider.ts extensions/google/video-generation-provider.ts extensions/openai/speech-provider.ts— passed the integrated-file checks, including extension production/test types and lint. The earlier full-branch check above covers the unchanged media patch.pnpm build— exit 0, 7m39s; native loading checked 53 built modules. Its standard report-only UI-size check reports startup JS 371,507 B against the 371,332 B enforcement threshold (175 B over). No baseline/budget was changed, and no UI repair is claimed.git diff --checkand fresh Codex autoreview through P2 — clean.The complete delegated command exited 0 and the lease is stopped.
Current head
31619be2582d1419e1d7df6817fdb50f5f128d36rebases onto322e358bb0c.git range-diffconfirms both PR commits are patch-identical. It incorporates the type-fixture repair09012603235and activity-summary publication synchronization4e9e68140aa; the exact type stripe now passes locally (including Gateway, commands, SDK, and other types), and all 22 activity-summary tests pass locally (435.19s including cold transform). Exact-head CI initially reported a failure in the adjacent registry timing fixture:subagent-registry.timing.test.ts,overlap, line 174 (queue depth 0 instead of 1). The earlier steer-restart case passed in this run; that does not establish its repair. A matched comparison reproduces the exact overlap queue-depth assertion on clean base322e358bb0cand this head; CI merge0fee0177ef97f5c106abab3b38dd7cc3ae20b768has the same source tree as this head. The registry baseline failure below remains unresolved; no fix is inferred from a later passing run. The previous CI run had session-share, update-panel UI, and Telegram failures; matched investigations and owning fixes are recorded below. Windows 5 passed on that head.Behavior proof includes actual HTTP transport and cancellation through the changed owners. Representative passing cases from the refreshed provider run:
These synthetic network tests exercise real socket/transport boundaries; provider entrypoint tests additionally cover submit/poll/completion, byte caps, MIME rejection, overflow URL delivery, and cleanup. No vendor API contract changed.
The documentation follow-up passed its scoped changed-file check,
pnpm docs:check-links(14,362 links, zero broken), and fresh Codex review through P3. The shared publishing parser verifies the new anchor. The optional full anchor audit reports 56 existing broken fragments, identical on the clean base docs snapshot and edited tree, with zero failures in the edited page; those unrelated fragments were not modified or suppressed.Production-only measurement against the current frozen PR base
322e358bb0c, using. ':(exclude)**/*.test.*' ':(exclude)**/test/**' ':(exclude)docs/**':956 net lines removed under the campaign filter; below the 1,000-line target. No padding was added.
Changed-test wall times using
/usr/bin/time -p pnpm test <file> --maxWorkers=1: BytePlus video 17.95s, OpenRouter video 17.10s, Deepgram runner 15.72s, Xiaomi speech 1.75s, ElevenLabs TTS 17.48s, including runner preparation.Initial CI failures, matched A/B reproduction, and owning repairs
The initial CI run reported unused workflow scripts, incomplete lint/packaging fixtures, a workflow assertion mismatch, a Telegram timeout, and a Windows worker shutdown crash.
Clean base
7c9f2723d63282d514484b9ae0fe3475932d770band media head6af66fda81b3aef1380c4d36b530401159875f0fused separate worktrees/caches and fresh installs on macOS, Node 26.5.0, pnpm 12.4.0. Identical commands produced identical failures:json5fixture failures and one workflow assertion); head 281.80s, base 279.08s, exit 1.scripts/lib/check-limits.mts; head 100.79s, base 141.02s, exit 1.scripts/relay-build-limit-warnings.mtsandscripts/run-swiftlint.mts, exit 1.The cited green PR 156346 dependency job tested
f3c9393f58d0e7761ff2ddef8697fe0b580f1692on main parente331b970664a4f8b923e136e348b0e47f98cbe81; the green PR 156315 job testedb44f463c18445bac0427ad8cdaf8d68e1028440con parent4875b96d5b8d998ba3c66d0c990a6c07ae956ab6. Their logs identify the exact checkouts; both predate9ed5a04a655, which introduced the implicated helpers.The final rebase incorporates
54a9d03dcf0(Knip roots),2989020eca7(packaging fixture), andceb109668b4(lint/workflow fixtures and Telegram completion observation). The local replay now passes. No fix is claimed for the original Windows worker shutdown crash; its new-head CI result is tracked separately. The temporary A/B worktree was removed and its registration absence verified. No blind CI reruns or weakened assertions, limits, baselines, or dependencies.Earlier local SDK graph collection hit existing timeouts under concurrent compilation; isolated proof passed without budget changes. Provider test fixtures were corrected for MiniMax's new helper export and Together's immediately completed submission transport while preserving their assertions.
No changelog, dependency, configuration schema, protocol, or persisted-state changes. No live vendor requests were needed for this behavior-preserving refactor.
Windows worker-shutdown diagnosis on the refreshed head
The remaining Windows 5 failure occurs after 94 MSteams assertions pass: Node 24.19.0 aborts in
src/win/async.cwithUV_HANDLE_CLOSINGduring Vitest fork shutdown, exit 3221226505. No code fix is claimed for this failure.The repository's exact Windows replay workflow ran the original ordered 24 files / 8 projects, pnpm 12.4.0, Vitest 5.0.0, Node 24.19.0, four workers, 8 GiB Node heap, and serial project dispatch at one frozen workflow revision:
af7420cc367af23a395006f1eba8858e33c9a946, exit 0.10fe0f71bf0584bdf31512a86021aa4044f0a2af, exit 0.Both artifacts verify complete project order, unchanged source/dependency hashes, native win32/x64, four visible CPUs, and approximately 14 GiB RAM. These passing reproductions do not establish a code fix or identify the native handle's owner.
The original CI job tested merge snapshot
9ecc2b3398bd0641011dbb285284c3b7d882dc83, which additionally contains upstream update-progress commitb4111411166. The exact merge-snapshot replay also passed (exit 0), with complete ordered projects and unchanged source/dependency hashes. None of the three native replays reproduced the teardown crash. Its cause remains unresolved; no native code fix is claimed.The same 24-file command on local macOS passed all eight groups on the head (1321.57s). The clean-base local run stopped at an unrelated terminal-fixture timeout in
test/helpers/openclaw-test-instance.test.ts(1 failed / 122 passed / 4 skipped, 516.27s); no fix is claimed. A separate base MSteams replay passed all 94 tests, matching the head's MSteams group. Native Windows evidence owns the platform-specific result.Latest CI failures and matched-source investigation
The documentation head's CI tested merge
0300780f33e367d8258ebed68c346b9ff67d3f1cover main parent5706a0626359b52daa5feb12fe98c260153525c3. Separate clean local worktrees compare that exact parent and merge, using the same Node runtime, frozen installs, and two-worker setting.Session-share:
test/plugins/session-share.integration.test.tsreproduces identically: 3 failed / 10 passed on both clean CI base (360.45s) and candidate merge (339.31s). The original CI job reported the same three receiver-list failures. Main commit71cf3a4a16bmoved receiver invocation to the registered service's start context. The integration fixture captured commands/catalogs but never started the service, so listing intentionally returned an empty result before invocation was available. The rebase incorporates owning fixd7b45d7e76c(#156464), which starts and stops the service with its invocation context. The refreshed Linux proof passes all 13 integration tests.The command stopped at the failing tooling group. The UI group was replayed separately using the original
core-runtime-media-ui-2descriptor: 442 files, two workers, throughscripts/ci-run-node-test-shard.mtson both sources. The exact merge replay passed 442 files / 7,659 tests (1481.61s). The base passed 441 files and failed one different pasted-text handoff test (7,658 passed / 1 failed, 1576.01s). The original update-panel case passed on both sources (22ms / 39ms); no UI fix is claimed. These local replays used macOS Node 26.5.0, whereas CI used Linux Node 24.19.0. The UI CI failure expected scrollTop 0 but saw 1000. Source inspection found a likely fixture race: settingdetails.openqueues jsdom's real toggle, then the test also dispatches a synthetic toggle while only RAF timers are faked. That test was introduced by upstream317054d4273; no repair is claimed from source inspection alone.The Telegram failure is grammY's unchanged 10,000ms webhook deadline, during the first real
/helpinitialization. Plugin metadata admission invalidation and delivery failures also appear in the log, but the ordering does not establish whether they caused the timeout or followed teardown. Replaying the original nine-file sequence also hit the unchanged deadline on both old sources: the base stopped in DM-session (2 failed / 10 passed, after three passing files; total 875.80s), and the merge stopped earlier in body routing (1 failed / 49 passed, after two passing files; total 702.22s). The rebase incorporates owning fix4205a47a639(#156482), which settles tracked updates before teardown, removes unrelated API wall-clock throttling from routing fixtures, and defers unnecessary image-provider discovery. The original Telegram sequence plus native pipeline now passes in the refreshed Linux proof. No timeout, assertion, baseline, or ignore has been relaxed.Provider-integration head: CI base/merge comparison
CI tested merge
0a4e774b6739f57f56c90e27f7847ccca430a45aover main parent359a8a35b55208a6091def35d75e8836940693e9. Separate clean temporary worktrees with fresh installs compare these exact revisions.src/gateway/session-row-placement-projection.lifecycle.test.ts:12: requiredpolicyConfigis missing.commandsandothershards pass on both. The required field came from282fc78eaf6(feat: support scoped session reading and organization #155184), and the fixture is unchanged by this media PR. The matched command wasnode scripts/run-tsgo-core-test-shards.mjs --stripe 4/5 --concurrency 2, macOS Node 26.9.0 / pnpm 12.4.0. The latest rebase incorporates owning repair09012603235, which completes the fixture’s policy configuration.OPENCLAW_NODE_TEST_GROUPS_JSON=<original-descriptor> node --import tsx scripts/ci-run-node-test-shard.mts; no assertions or timeouts changed. An upstream fixture repair,4e9e68140aa(fix(zalouser): avoid Gateway stalls during credential persistence #156003), awaits the canonical publication event before asserting; the latest rebase incorporates it. Historical actual state was redacted in CI, so no stronger causal claim is made from that log.0bd1624a883made task finalization asynchronous through SQLite workers. A separate single-case diagnostic also fails identically on both (86.70s / 86.73s, 21 other cases skipped), so preceding file/shard cases are unnecessary for local reproduction. Both use macOS Node 26.9.0, two workers, separate caches, andnode scripts/run-vitest.mjs src/agents/subagents/registry/subagent-registry.steer-restart.test.ts; the single-case command adds--testNamePattern "retries deferred parent cleanup after a descendant announces". No timeout or assertion was changed.Fresh Codex review of this integrated head is clean through P2. A FAL geometry finding was rejected and independently rechecked against the complete module:
hasInputImagesis passed into size resolution before the computedimageSizereaches the geometry helper.The old matched-source worktrees have been removed through ordinary Git cleanup, with path and registration absence verified. No timeouts, assertions, baselines, or ignores were relaxed to obtain results.
Registry timing flake: matched evidence and coordinator-approved rerun
The failing job reports
src/agents/subagents/registry/subagent-registry.timing.test.ts:174,overlap: queue depth remains 0 when 1 is expected. Its shard result is 1 failed / 1,534 passed / 5 skipped. This is a different case from the earlier steer-restart failure. The only other failed job in this run is the aggregateopenclaw/ci-gate.The exact merge's tree
b94b2889bf53d0c4e0b9c947f892fb581f2d573bwas verified equal to PR head31619be2582. A clean detached base worktree at322e358bb0creceived a freshpnpm install. Both sources ran the complete three-case file with the same native Node 24.21.0, pnpm 12.4.0, two workers, and separate caches:CI used Linux Node 24.19.0. These are matched local reproductions, not an assertion of platform parity. No timeouts or assertions were changed. The fixture still polls with
vi.waitForwhile holding a session write, and upstream0bd1624a883made task finalization asynchronous before terminal effects; the precise cause of delayed queue admission remains unresolved. No production fix or fixture repair is claimed. The timing fixture is outside this media diff.The coordinator subsequently classified this as a flake, reran the failed job successfully on the unchanged head, and explicitly approved landing as-is. The media checks, focused tests, API comparison, build, and review passed as recorded above; native landing remains subject to GitHub’s enforced gates.