Repository navigation
test: fix the three fork-window flakes (#224) - #226
Conversation
All three were a test reading state a concurrently forked process could still hold, or that a just-forked process did not have yet. - wr-agent flock tests (`without_the_barrier_...`, `instance_lock_is_exclusive`): a process forked by any concurrent test holds a copy of the flock's open file description until it execs, so a single check right after the parent drops the lock can see it held (measured: 4 in 3000 with a concurrent spawner, 0 in 3000 without). The free checks now poll briefly — 200 ms while the child runs, well inside its 1 s sleep, so a real holder is still caught. - pty `reports_the_foreground_process`: the foreground group exists before the child execs, and a process between fork and exec has no readable args; poll for the name too. - AgentHarness.start waits until a connect succeeds, not until the socket path exists: `UnixListener::bind` creates the path before `listen()`, and a connect in between is refused (measured 3 in 300), which a test read as `.connectionLost`. The app already retries. 40 consecutive `cargo test -p wr-agent --lib` runs pass (the unfixed code failed 3 times in a shorter loop). Fixes #224 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedUse the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughAgent startup now waits for a successful Unix-socket connection. Several ChangesAgent and test synchronization
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The test synchronization changes are mergeable after normal checks. The existing child-startup timing race is separate from these changes. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
|
@coderabbitai pause 🤖 Left by Claude Code |
|
✅ Action performedReviews paused. |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Fixes #224. The two flakes it names had the same cause, and so does a third (
reports_the_foreground_process, the other known wr-agent flake), which failed in the reproduction loop. In each, a test read state that a concurrently forked process could still hold, or that a just-forked process didn't have yet. Only test code changes.Causes (measured, not assumed)
vcs::tests::without_the_barrier_the_lock_dies_with_the_parents_descriptor(andserve::tests::instance_lock_is_exclusive)(false, true)twice in about 10 full lib runs, the same values as CI run 35935900854. A standalone probe saw the lock still held after release 4 times in 3000 with a concurrent spawner, and 0 in 3000 without.pty::tests::reports_the_foreground_processAgentFileIntegrationTests.testTheViewersReadCapIsTheAgentsReadCeiling(anyAgentHarnessuser)UnixListener::bindcreates the socket path atbind()and only then callslisten(). The harness connected as soon as the path existed, and a connect in that window is refused, which read as.connectionLost.Fixes
lock_is_free(within:)polls for 200 ms while the child runs (the child sleeps 1 s and the lock is dropped at 400 ms), so a child that genuinely holds the lock still reads as held; after the child exits it polls for 1 s. The instance-lock re-acquire retries for 1 s.AgentHarness.start: waits until aconnect()succeeds, not until the path exists.Production
Not affected, which is why only tests change. Both production snapshot locks (
SnapshotLock::acquire,JJProcessBarrier.acquire) already retry for up to 30 s, andJJProcessBarrier.releaseusesLOCK_UN, which releases every holder of the description. The app already retriesconnectafter spawning an agent (LocalAgentVCS).Validation
cargo test -p wr-agent --libruns pass. The unfixed code failed 3 times in a shorter loop.make app-test: 2932 tests pass.cargo fmt --checkandcargo clippy --all-targets -D warningsare clean, and so ismake app-lint.🤖 Generated with Claude Code
Summary by CodeRabbit