fix(runway-video): bound JSON response reads#96899
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. This PR should close in favor of the newer canonical Runway bounded-reader PR, which targets the same create/poll JSON helper, is open and mergeable, has sufficient real behavior proof, and avoids this branch's duplicated test-mock JSON reader implementation. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Use #96907 as the canonical landing path, and port a real-reader overflow regression there only if maintainers want that extra committed coverage. So I’m closing this here and keeping the remaining discussion on #96907. Review detailsBest possible solution: Use #96907 as the canonical landing path, and port a real-reader overflow regression there only if maintainers want that extra committed coverage. Do we have a high-confidence way to reproduce the issue? Yes. Current main reaches direct Is this the best way to solve the issue? No for this branch as the landing path. The production fix shape is right, but the newer canonical PR solves the same issue with a cleaner test-helper boundary and stronger proof. Security review: Security review cleared: The diff introduces no dependency, workflow, secret, permission, package-resolution, or supply-chain change; it narrows an external provider response-body path. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 6830aa39eaa1. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
response.json().Responsethat verifies the stream is cancelled on overflow.readProviderJsonResponsefor provider tests that import it from the SDK facade.check:test-typesaccepts the intentional partialResponseused by the overflow regression test.What Problem This Solves
Runway video generation parsed external create and poll responses with a local helper that called
response.json()directly. A successful provider response with an unbounded body could be buffered before JSON parsing, unlike the already-bounded video download path.User Impact
readRunwayJsonResponseremains the provider-local owner for object-shape validation, while the canonicalreadProviderJsonResponsecontract remains the source-of-truth for provider JSON byte limits and malformed JSON wrapping.Origin / follow-up
Follows #96604.
response.json().readProviderJsonResponseSDK facade and keeps Runway's existing object-shape validation and provider-owned malformed JSON errors.Competition / linked PR analysis
No linked issue. Related open PR scan before implementation found no open PR touching
extensions/runway/video-generation-provider.tsor matching Runway bounded JSON response reads. This PR is limited to the uncovered Runway video sibling path.Real behavior proof
/media/vdb/code/ai/aispace/openclaw-worktrees/pr-96899, usingbuildRunwayVideoGenerationProvider().generateVideo()with a real streamedResponsebody.pnpm check:test-types,node scripts/run-vitest.mjs extensions/runway/video-generation-provider.test.ts, and a local loopback HTTP proof that streams a >16 MiB provider JSON response into the productionreadProviderJsonResponsepath./media/vdb/code/ai/aispace/openclaw-pr-96899-evidence/runway-video-test-types-after-response-cast.txt,/media/vdb/code/ai/aispace/openclaw-pr-96899-evidence/runway-video-vitest-after-response-cast.txt, and/media/vdb/code/ai/aispace/openclaw-pr-96899-evidence/runway-provider-json-loopback-overflow.txtpnpm check:test-typescompleted successfully. The Runway Vitest shard reportedTest Files 1 passed (1)andTests 10 passed (10). The local loopback proof observedRunway video generation failed: JSON response exceeds 16777216 bytes,cancel_observed=true, and server close after 16,908,288 streamed bytes.Response.Review findings addressed
unknownintermediate cast for the intentional partialResponse, andpnpm check:test-typespasses at current head.readProviderJsonResponsepath and observes overflow plus server close/cancel./media/vdb/code/ai/aispace/openclaw-pr-96899-evidence/runway-provider-json-loopback-overflow.txt.pnpm check:test-typesafter making the oversized response fixture type-correct.Responsecast accepted by TypeScript while preserving the guard that directresponse.json()would fail the test.Regression Test Plan
extensions/runway/video-generation-provider.test.tsRunway video generation failed: JSON response exceeds 16777216 bytes.buildRunwayVideoGenerationProvider().generateVideo()path and a realReadableStreambody with a cancel hook, so it fails if the helper regresses to directresponse.json()or stops cancelling oversized streams.pnpm check:test-typesnode scripts/run-vitest.mjs extensions/runway/video-generation-provider.test.tsRisk / Compatibility
Low. Successful Runway JSON responses still parse into the same typed payloads and still require top-level objects. Responses larger than 16 MiB now fail with a bounded-reader error, matching existing provider JSON response limits.
Merge risk
merge-risk: compatibility, provider/auth surface, shared test-helper surface.Responsecast fix.Response.What was not changed
Root Cause
response.json()for HTTP success responses instead of the shared bounded reader contract.