Repository navigation
fix(cli): stop capability video downloads on interrupt - #187563
Conversation
The capability video command downloaded provider URLs with no signal, so an accepted interrupt left the transfer running: a body that finished inside the launcher's shutdown budget was published over --output with a success envelope, and a slower one ended in the launcher's SIGKILL with the staging directory left beside the destination. Thread the ambient work signal into the request, the temp pipeline and the publish handoff, and stop the shared capability command wrapper from emitting after an accepted interrupt. Ref: BUG-259-capability-video-download-ignores-interrupt (local finding)
|
🦞👀 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. |
Observed capturesSame harness, same commit The 137 exits are the launcher's own shutdown budget, not the harness: base - 1.5 s body: interrupt accepted, then the finished download is published
base - 25 s body: launcher reaps the still-downloading process
head - 1.5 s body: nothing published
head - 25 s body: exits with the interrupt's own status
head - SIGTERM: 143head - control run (no interrupt): still publishes |
|
Codex review: needs maintainer review before merge. What this changesThis PR cancels provider-hosted video downloads on interruption and suppresses late capability-command output. Example: Send SIGTERM while downloading a 67,113,789-byte generated MP4 through
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR provides a focused, proven fix for a current-main interruption bug, with no actionable correctness findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe inference CLI receives generated video URLs, downloads them through the guarded HTTP client, and publishes completed files through the existing atomic-output owner; the invocation lifecycle owns cancellation and exit status. flowchart TD
A[Inference CLI] --> B[Video provider]
B --> C[Guarded URL download]
C --> D[Atomic output publication]
D --> E[Command result]
F[Invocation cancellation] --> C
F --> E
Technical reviewBest possible solution: Reuse invocation cancellation throughout video downloading while retaining the existing atomic publication and signal-exit owners. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the uncancelled download path, and the supplied full-build comparison reproduces continued transfer and leftover staging after accepted signals; this review ran no target code. Is this the best way to solve the issue? The patch is the smallest complete production repair: propagate the existing signal through download and streaming, reject cancelled publication handoffs, and let the existing lifecycle owner settle exit status. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 74f111a74dbd. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +25, Tests +96, Docs 0. Total +121 across 5 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 29, 2026, 7:16 AM ET / 11:16 UTC (Revision 2). |
Full-build interruption proofCandidate: Both complete source trees were independently installed and built with Fixture: a real ffmpeg-generated MP4 with a valid padding box, 67,113,789 bytes; ffprobe validated the fixture and completed output. Slow responses sent 128 KiB per 100 ms. Signals were delivered only after an HTTP transfer and on-disk staging were in progress. No clock changes or observer force-kills.
Every interrupt logged the accepted command interruption; candidate HTTP transfers closed. Both no-signal controls exited 0, atomically replaced an existing target with the complete matching SHA-256/size video, and emitted the expected output envelope. This reproduction demonstrates continued transfer and leftover staging on main, not a partially published final target. Focused checks: formatting passed for all four changed TypeScript files; Scope: provider-generation lifetime, already-started buffered writes, already-published renames, and earlier assets in a multi-video result are not changed. The fix owns cancellation during provider-URL download and suppresses late command success after an accepted stop. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in c54e9a1. Thanks @SunnyShu0925. Interrupted video downloads now stop cleanly. |
fix(cli): stop video downloads cleanly on Ctrl-C and SIGTERM An interrupted video download kept downloading and left its staging file behind. The download now uses the existing invocation signal, as other accepted CLI reads do since openclaw#187504. It stops on the first signal, leaves no target or staging file, prints no success result and exits with 130 or 143. Evidence: full builds on Node 24.22.1 with a real slow MP4 download through the bundled DeepInfra provider. On main the download continued and the staging file stayed after SIGINT and after SIGTERM (twice each); with this change the CLI exited 130 or 143 in 36 to 45 ms with no target, staging file or success output (twice each). Completed-download controls pass on both refs. Details: openclaw#187563 (comment). Thanks @SunnyShu0925. Co-authored-by: SunnyShu <0668000539@local> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
An accepted Ctrl-C or SIGTERM during
openclaw infer video generate --output …did not cancel the provider-URL download. The CLI kept streaming until the launcher's shutdown deadline killed it, leaving partial staging output.What changed?
Original fix by @SunnyShu0925; follow-up preserves the contributor commits.
Evidence
Complete main and candidate source trees were built on Node 24.22.1 in secretless Docker. The real built CLI used the bundled DeepInfra provider with a local HTTP fixture serving a valid 67 MB MP4 slowly. SIGINT and SIGTERM were each exercised twice per build after actual streaming and staging began.
Main continued downloading, then the launcher killed it after 2.1–2.3 seconds, leaving partial staging files in all four cases. Candidate exited 130/143 in 36–45 ms, closed the transfer, emitted no success envelope, and left neither target nor staging. Both completed-download controls replaced an existing target with the exact full video. This is full-build proof, not substitution of compiled modules.
Formatting passed; focused capability CLI suite passed 103/103. Detailed exact-head measurements are in the proof comment.
Limits and merge danger
Provider-generation lifetime, already-started buffered writes, already-published renames, and earlier assets in multi-video results are unchanged. This is a two-way door: reverting restores prior cancellation behavior without migrations or persisted-contract changes. Blast radius is capability command completion under an accepted interruption and video provider-URL downloads; normal completed downloads retain their existing atomic-output behavior.