Repository navigation
refactor(providers): shared generated-media download guard and binary-response adoption - #120351
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 7, 2026, 5:54 PM ET / 21:54 UTC. ClawSweeper reviewWhat this changesThe branch centralizes generated-media download handling and stream payload patching, and cancels unread binary response bodies rejected by content-type validation. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep open for maintainer review: current main does not contain this refactor, and source review found no concrete patch defect. The protected Priority: P2 Review scores
Verification
How this fits togetherProvider plugins fetch generated media and stream model requests through Plugin SDK seams. Those seams preserve provider-owned transport policy while returning bounded media assets or patched model streams to the agent runtime. flowchart LR
A[Provider plugin] --> B[Plugin SDK seam]
B --> C[Guarded download or payload wrapper]
C --> D[Provider transport]
D --> E[Bounded response reader]
E --> F[Media asset or model stream]
Decision needed
Why: The existing ClawSweeper comment is known to exist but its body was unavailable in this review context, so its merge gate cannot be reconstructed safely. Before merge
Agent review detailsSecurityNone. PR surfaceSource -68, Tests +100. Total +32 across 28 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the canonical shared seams after confirming the prior ClawSweeper rank-up moves are satisfied or explicitly waived, while retaining provider-owned guarded acquisition paths. Do we have a high-confidence way to reproduce the issue? No live provider reproduction was run in this read-only review; source and focused tests establish the rejected-content path and the intended cancellation behavior. Is this the best way to solve the issue? Yes: keeping guarded fetch, retry, and dispatcher policy in each provider while centralizing behaviorally identical response consumption is the narrowest maintainable boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fb0812c857ff. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…-response adoption (openclaw#120351) * fix(agents): cancel rejected provider binary bodies * refactor(providers): share generated media downloads * refactor(providers): adopt payload patch stream wrapper * fix(providers): preserve generated media helper contracts
What Problem This Solves
Generated video, music, and speech providers repeated the same bounded binary download checks, deadline handling, filename derivation, and payload-patch stream wrappers. The shared binary reader also leaked an unread response body when content-type validation rejected a successful response before body consumption.
Why This Change Was Made
readProviderBinaryResponserejects text/JSON content, without awaiting cancellation on capture-backed tee streams.media-generation-runtimePlugin SDK surface, while preserving provider-owned guarded acquisition, retry, SSRF/dispatcher policy, and release behavior.readProviderBinaryResponsepreserve caller-specific overflow messages and migrate the behavior-identical TTS/video/music guards.createPayloadPatchStreamWrapper.Exact provider error strings, media filenames, MIME fallbacks, size caps, timeout behavior, retry/provider attribution, and guarded transport cleanup are preserved.
User Impact
Malformed provider binary responses now release their unread socket instead of leaving the connection open. Valid generated-media and stream behavior is unchanged; providers continue to report their existing error messages and enforce their existing caps and transport policies.
Evidence
provider-http-errors, generated video assets, generated music assets).node scripts/run-oxlint.mjs <all touched paths>passed.pnpm plugin-sdk:surface:checkpassed.pnpm plugin-sdk:api:gencompleted; the hash stayed unchanged becausemedia-generation-runtimeis a local-only subpath, so no public surface-budget ledger increment applies.node scripts/check-changed.mjscould not acquire any remote backend (Blacksmith doctor failed; Daytona/Azure/AWS doctors timed out). The named local fallback,OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs, passed all core/core-test/extension/extension-test typecheck, lint, SDK, boundary, deadcode, cycle, format, and guard lanes.Production vs test numstat against the requested base
c691f2e41cd61:+514 / -582(net-68).+102 / -2(net+100).+616 / -584(net+32).The production reduction is smaller than the research target because exact behavior preservation required retaining guarded acquisition callbacks for MiniMax, xAI, and OpenAI, and excluding non-identical Vydra/Google paths rather than flattening their security/lifecycle contracts.
Migration counts:
Premise mismatches / explicit exclusions:
deliveryUrlfallback; MiniMax’s two-hop file-id flow and fal remain excluded as requested.scripts/committer; commits used the allowedgit commit --no-verifyfallback after focused proof and autoreview.Intentional behavior fixes
readProviderBinaryResponsethrew on a text/JSON success response without cancelling the unread body, which could leave the underlying socket open.