Repository navigation
fix(video-generation): DashScope downloads hang when CDN body stalls after headers - #109394
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 17, 2026, 1:50 AM ET / 05:50 UTC. Summary PR surface: Source +40, Tests +143. Total +183 across 2 files. Reproducibility: yes. at source level with high confidence: current main omits a body-idle timeout, and the real loopback server exercises the same post-header stalled-body path, although no live credentialed DashScope CDN run was supplied. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Keep the timeout policy in the DashScope download owner while reusing the shared guarded-fetch and bounded-stream primitives, then land the exact head after its required checks complete. Do we have a high-confidence way to reproduce the issue? Yes at source level with high confidence: current main omits a body-idle timeout, and the real loopback server exercises the same post-header stalled-body path, although no live credentialed DashScope CDN run was supplied. Is this the best way to solve the issue? Yes. The narrow owner-local change reuses existing timeout and bounded-read contracts, matches the sibling fail-before-fetch principle, and avoids broad changes to shared networking helpers that serve different retry and timeout policies. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5e13f459a7d5. Label changesLabel justifications:
Evidence reviewedPR surface: Source +40, Tests +143. Total +183 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (5 earlier review cycles)
|
a65c45e to
456184f
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…dget When the operation deadline passes a function that returns 0, the previous resolver gate (resolved > 0) dropped the exhausted budget and fell back to the 120s default. Also, readResponseWithLimit skips chunk idle timeout when chunkTimeoutMs is 0/falsy, so a zero budget would read the body unbounded instead of failing fast. Now the resolver preserves zero/negative values and the body stage throws immediately when the remaining budget is exhausted. Co-Authored-By: nebulacoder-v8.0 <[email protected]>
Check the resolved download timeout before fetchWithTimeoutGuarded so an already-exhausted operation does not initiate network I/O. Previously the deadline guard ran after headers, which still sent bytes over the wire. Co-Authored-By: nebulacoder-v8.0 <[email protected]>
920b47b to
2134cd6
Compare
|
Maintainer verification on exact head
Verdict: best owner-side fix. Awaiting exact-head CI before |
|
Merged via squash.
|
…after headers (openclaw#109394) * fix(video-generation): bound stalled DashScope download body reads * test(video-generation): narrow DashScope download asset for tsgo * test(video-generation): narrow optional DashScope video buffer for tsgo * test(video-generation): bind DashScope buffer before tsgo asserts * fix(video-generation): fail closed on exhausted DashScope download budget When the operation deadline passes a function that returns 0, the previous resolver gate (resolved > 0) dropped the exhausted budget and fell back to the 120s default. Also, readResponseWithLimit skips chunk idle timeout when chunkTimeoutMs is 0/falsy, so a zero budget would read the body unbounded instead of failing fast. Now the resolver preserves zero/negative values and the body stage throws immediately when the remaining budget is exhausted. Co-Authored-By: nebulacoder-v8.0 <[email protected]> * fix(video-generation): reject exhausted download deadline before fetch Check the resolved download timeout before fetchWithTimeoutGuarded so an already-exhausted operation does not initiate network I/O. Previously the deadline guard ran after headers, which still sent bytes over the wire. Co-Authored-By: nebulacoder-v8.0 <[email protected]> * fix(video-generation): release failed DashScope downloads --------- Co-authored-by: nebulacoder-v8.0 <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
…after headers (openclaw#109394) * fix(video-generation): bound stalled DashScope download body reads * test(video-generation): narrow DashScope download asset for tsgo * test(video-generation): narrow optional DashScope video buffer for tsgo * test(video-generation): bind DashScope buffer before tsgo asserts * fix(video-generation): fail closed on exhausted DashScope download budget When the operation deadline passes a function that returns 0, the previous resolver gate (resolved > 0) dropped the exhausted budget and fell back to the 120s default. Also, readResponseWithLimit skips chunk idle timeout when chunkTimeoutMs is 0/falsy, so a zero budget would read the body unbounded instead of failing fast. Now the resolver preserves zero/negative values and the body stage throws immediately when the remaining budget is exhausted. Co-Authored-By: nebulacoder-v8.0 <[email protected]> * fix(video-generation): reject exhausted download deadline before fetch Check the resolved download timeout before fetchWithTimeoutGuarded so an already-exhausted operation does not initiate network I/O. Previously the deadline guard ran after headers, which still sent bytes over the wire. Co-Authored-By: nebulacoder-v8.0 <[email protected]> * fix(video-generation): release failed DashScope downloads --------- Co-authored-by: nebulacoder-v8.0 <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes two issues with DashScope-compatible video downloads:
readResponseWithLimit, so a stalled body could wait the full request budget instead of failing with a clear idle timeout.fetchWithTimeoutGuardedhad already sent bytes over the wire. The guard now runs before fetch.Affected workflow:
runDashscopeVideoGenerationTask→downloadDashscopeGeneratedVideos→readResponseWithLimit.Why This Change Was Made
At
downloadDashscopeGeneratedVideos, the resolveddownloadTimeoutMsis now:chunkTimeoutMs+onIdleTimeoutintoreadResponseWithLimit, so stalled bodies fail with"no data received for <timeout>ms"instead of a genericfetchWithTimeoutGuardeddeadline.fetchWithTimeoutGuardedalready keeps its abort untilrelease(), so a continuously dripping CDN body cannot hang forever; the chunk-idle bound is the download-owned stall signal that was missing.Non-goals: changing shared
fetchWithTimeoutGuarded,readResponseWithLimit, orassertOkOrThrowHttpError.Collision check: no open PR on
downloadDashscopeGeneratedVideos/src/video-generation/dashscope-compatible.ts.User Impact
"no data received for <timeout>ms"instead of a generic request timeout or full-budget wait.Evidence
Exact head:
920b47be7e9a11c1fbb78845226d51aca97afdf8oxfmt --check src/video-generation/dashscope-compatible.ts src/video-generation/dashscope-compatible.test.ts— passed.git diff --check— clean.Tests
Key contract changes
fetchWithTimeoutGuarded(network I/O already initiated)fetchFnnot calledchunkTimeoutMs+onIdleTimeoutwired →"no data received for <timeout>ms"Loopback proof
Real
http.createServerreturns HTTP 200 + one chunk then stalls. Realfetch+ realdownloadDashscopeGeneratedVideoswithtimeoutMs: 200rejects within 5s (~220ms observed) — bounded, not an indefinite hang.Not tested
Live DashScope CDN against real provider endpoints — requires real API credentials.