fix(media-proof): time out hung ffmpeg and ffprobe - #1173
Conversation
Review-worker media proof runs curl, ffprobe, and ffmpeg through one spawnSync helper. curl already has --max-time 90, but ffprobe and ffmpeg had no process deadline. A corrupt or huge video can hang the review worker until the job is killed. Pass timeout: 120000 on that helper so spawnSync kills the child and the existing failed-artifact path records ETIMEDOUT. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 15, 2026, 5:17 PM ET / 21:17 UTC. ClawSweeper reviewWhat this changesThe PR adds a two-minute timeout to the shared media-proof subprocess runner and tests timeout handling for video inspection failures. Merge readiness⛔ Blocked until stronger real behavior proof is added - 7 items remain This PR addresses a real review-worker availability gap, but its per-command timeout can still exhaust the exact-review job deadline when multiple video proofs are processed sequentially. Priority: P2 Review scores
Verification
How this fits togetherMedia-proof preparation downloads linked images and videos, then invokes curl, ffprobe, and ffmpeg before the review model runs. It produces inspectable artifacts or failed-artifact details that feed the review workflow. flowchart LR
A[PR proof links] --> B[Media-proof preparation]
B --> C[Download and inspect media]
C --> D{Each command finishes?}
D -->|Yes| E[Prepared artifacts]
D -->|Timeout or error| F[Failed artifact detail]
E --> G[Codex review]
F --> G
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use one bounded media-processing budget that covers every sequential stage and all accepted proof URLs, then demonstrate the current-head timeout and failed-artifact recovery in the required Crabbox environment. Do we have a high-confidence way to reproduce the issue? Yes, from source: use two or more accepted video URLs whose ffprobe or ffmpeg stage reaches its new 120-second limit; the sequential preprocessing plus Codex allowance exceeds the exact-review deadline. Is this the best way to solve the issue? No. A per-process timeout is useful, but the outer review budget must also cover every sequential media stage or impose one shared media deadline. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d389e6addf4d. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Fixes an issue where review workers would hang forever when a pull request linked a corrupt or huge video as proof.
curlalready uses--max-time 90, butffprobeandffmpegran throughspawnSyncwith no process deadline. One stalled decoder blocked the worker until an outer job timeout (or a human) killed it.Why This Change Was Made
The media-proof helper now passes
timeout: 120000tospawnSync. That bound covers curl, ffprobe, and ffmpeg. When the child exceeds it, Node setserror.codetoETIMEDOUTand a non-zero/null status. The existing failed-artifact path records that detail and the review continues. Git fetch and webhookspawnSynccallers are unchanged.User Impact
A bad video proof no longer stalls a review worker. The worker records a failed media-proof artifact (
ffprobe failed: spawnSync ... ETIMEDOUT) and moves on.OpenClaw Bay Impact
Unaffected. This change is review-worker media preparation only. It does not alter Bay lifecycle, queue, status, telemetry, or dashboard data contracts.
Documentation Lifecycle
No documentation lifecycle changes.
Evidence
Before this change, the default media-proof
spawnSyncoptions had notimeoutfield. After the change, a livenodeimport of the compiled helper printstimeout: 120000, andsleep 30with a 50ms runner timeout returnsETIMEDOUTinstead of running to completion.Related: video inspection landed in #144 (2026-05-20). The unbounded
spawnSynchelper was extracted in #998 (2026-08-01). Git helpers already have the same class of bound in #508.Real behavior proof
Behavior or issue addressed: Review-worker media proof could hang forever on
ffprobe/ffmpegbecause the sharedspawnSynchelper had notimeout. A corrupt or huge video blocked the worker.Real environment tested: macOS, Node v26.7.0, worktree
/tmp/oc-impl-clawsweeper-ffmpegat the patched commit.Exact steps or command run after this patch:
The script imported
createMediaProofCommandRunnerForTestandprepareMediaProofArtifactsForTestfrom./dist/clawsweeper.js, printed default spawn options, ransleep 30with a 50ms timeout, then prepared a.movURL whoseffprobestep reused that hungsleep.Evidence after fix: terminal output from the live
nodecommand above. Default options includetimeout: 120000. The hungsleep 30returnsstatus: null,signal: SIGTERM,error.code: ETIMEDOUT.prepareMediaProofArtifactsrecordsstatus: "failed"withdetail: "ffprobe failed: spawnSync sleep ETIMEDOUT".Observed result after fix: The helper no longer waits for a 30 second sleep. Node kills the child and the media-proof artifact is failed, which is the same path a hung ffprobe would take on the review worker.
What was not tested: A real corrupt video file through host
ffmpeg/ffprobeon a live review-worker VM. Git fetch and webhookspawnSynccallers were left unchanged on purpose.Keep Allow edits from maintainers enabled.