Repository navigation
moq repair refuses a recording still being written - #8823
Conversation
Quest-Claim: 50dcfde0d8f48542
export mp4 holds an exclusive file lock on its output while it records, and repair mp4 refuses a file it cannot lock. Neither runs on a filesystem without locks. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 23 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
ℹ️ No blocking issues. One Windows-specific rough edge is noted inline.
Reviewed changes
I reviewed the advisory lock that moq export mp4 now holds on its output, and the matching lock check in moq repair mp4.
- Recorder lock:
run_mp4takesFile::try_lockright aftercreate_newand keeps the lock until the file closes. If it can't lock, it deletes the new file and fails. - Repair refusal:
Mp4::runlocks before it scans.WouldBlockgets a clear "still open by a recorder" message, and any other lock error stops the repair instead of letting it run unlocked. - Tests: a new fast test holds the lock from the test process. The nightly
a_killed_mp4_recording_is_repairedtest now tries a repair mid-recording, and a helpermoq_repairreplaces the inline command it used before. - Docs:
doc/bin/cli.mddescribes the lock and the refusal.
claude-opus-5-5 | 𝕏
…error Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 563dbaf74e0734b7f57db7698b3d6ceb48bee5de.
No new actionable code defects found in this static pass. Checked that recording takes the exclusive lock immediately after creating the output, lock failure removes the new file, and repair obtains the same lock before scanning or writing. The file handle carries the lock through recording/repair, including the async conversion. Reviewed the live-recording refusal and post-kill repair test changes.
Verification limits: GitHub-only static review of the diff and relevant source/tests. I did not build, run tests, execute the model checker, or reproduce the reported integration results. This is a COMMENT review, not an approval or a CI/merge-readiness assertion.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the last Pullfrog review, the PR adds documentation about the Windows lock and merges main.
- Windows lock docs:
doc/bin/cli.mdnow says that on Windows the recorder's lock also stops other programs from reading the recording until it finishes. - Code comment:
rs/moq-cli/src/subscribe.rsexplains why a shared lock is no fix: on Windows a shared lock also blocks writes through the handle that holds it, so the recorder couldn't write its own file. This settles the earlier Windows thread.
claude-opus-5-5 | 𝕏

moq export mp4 --outputnow holds an exclusive file lock (advisory on Unix, mandatory on Windows) on its output while it records, andmoq repair mp4refuses a file it can't lock, with a message saying a recorder still has it open. Finishes quest/m1/mp4-repair-lock.md (deleted here), found by moq-dev/moq#7560.Summary
rs/moq-cli/src/subscribe.rs): aftercreate_new, takesFile::try_lockand holds it until the file closes. If it can't lock (no lock support), it removes the file it just created and fails: a recording that could never be repaired safely isn't started. The OS drops the lock with a killed recorder, so a SIGKILLed recording stays repairable.rs/moq-cli/src/repair.rs): takes the same lock non-blocking before scanning and holds it through the rewrite. Anytry_lockfailure, held or unsupported, refuses with that error (its Display says whether the file is in use), without repairing unlocked.moq-mux::repairis untouched (stillimpl Read + Seek).doc/bin/cli.md, including that on Windows the lock also blocks other programs from reading the recording until it finishes.Public API
None: CLI behavior only. Wire: none.
Validation
export::repair_refuses_a_locked_recording(fast, no relay, runs in the normal gate): the test process holds the lock, the builtmoq repair mp4binary exits non-zero with the lock message and leaves the file byte-identical; after release it proceeds to scan.export::a_killed_mp4_recording_is_repaired(just rs cli-export, ran locally, all 16 pass): repair mid-recording against the realexport mp4process refuses and does not rewrite the file; after SIGKILL the same repair succeeds (the lock died with the process).TryLockError::Errorarm and the recorder's remove-and-fail.just checkpasses.Choices for review
repairrefuses on anytry_lockfailure and reports the error itself, so held and unsupported share one message ("failed to lock FILE, so it may still be open by a recorder").repairtakes the exclusive lock too, so two concurrent repairs also refuse each other .repairin that instant sees a just-created empty file and fails to scan it rather than corrupting anything. Not worth closing (would need creating under a lock).Decisions
LockFileExlock denies writes to every handle including the one holding it, so the recorder could no longer write its own file. Locking a byte range past EOF would let readers in, but needswindows-sysand unsafe FFI inmoq-clifor an edge case nothing here tests; not worth its weight now.Follow-ups
None.
Review
Rewritten by
quest reviewafter each round.Head: 22b42f8
Base: origin/main at 1399add
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1e997-281f-7790-8076-abe998e10f88, round 1Score: 9/10,
No actionable defects were found: recorder and repair retain the lock through their writes, with refusal and crash-recovery coverage, though builds and tests were not run as instructed.Rounds: 3; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none
Models
Size: XS
Implementer: Claude Code, claude-sonnet-5-5, unknown effort (arm A)
Implementer: Claude Code, claude-opus-5-5, unknown effort