fix(media-proof): time out hung ffmpeg and ffprobe - #1173
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 29, 2026, 9:59 PM ET / August 30, 2026, 01:59 UTC. ClawSweeper reviewWhat this changesAdds a two-minute default deadline to media-proof subprocesses and tests that a timed-out video probe becomes a failed artifact. Merge readiness⛔ Blocked until stronger real behavior proof is added - 5 items remain Keep open: the per-command timeout bounds a single hung decoder, but the full sequential media pipeline can still exceed the review worker’s preprocessing allowance; the current proof also does not meet the repository’s required Crabbox provenance. Priority: P2 Review scores
Verification
How this fits togetherReview workers extract linked image and video evidence before giving it to Codex. Media downloads, probing, and contact-sheet generation feed the review prompt and must complete within the worker’s reserved preprocessing time. flowchart LR
A[Review context] --> B[Media URL selection]
B --> C[Download proof]
C --> D[Probe video metadata]
D --> E[Create contact sheet]
E --> F[Review prompt evidence]
G[Review worker time budget] --> C
G --> D
G --> E
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use one diminishing deadline per video pipeline that fits the scheduler allowance, record a failed artifact at exhaustion, cover the multi-video bound, and publish current-head Crabbox proof. Do we have a high-confidence way to reproduce the issue? Yes. The supplied terminal trace demonstrates Node’s timeout behavior, and current source establishes the remaining sequential deadline mismatch without requiring a live review worker. Is this the best way to solve the issue? No. The per-command default removes an infinite wait for one child process, but a shared deadline across each video pipeline is needed to honor the existing worker budget. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fa535d54a032. LabelsLabel justifications:
EvidenceAcceptance criteria:
What 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
HistoryReview history (3 earlier review cycles)
|
b63b38b to
3294904
Compare
|
@SebTardif, thank you—your contribution is welcome. If you would like to continue with this PR, please bring it up to date and ready for maintainer look. If you would prefer Martin to take it over as a maintainer, please say so. This note does not indicate approval or a merge decision. |
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>
3294904 to
b40dc57
Compare
We want to continue. The branch is now replayed onto current Please take another look when you have time. |
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.