fix(bin): parallelize startup network sweeps - #2927
Merged
Merged
Conversation
Run per-secondmate liveness and convergence probes concurrently and overlap clone refresh, while replaying each mate's fail-closed diagnostic in original order. Ignore scratchpad* so untracked scratch no longer blocks remote sync. Co-authored-by: Cursor <cursoragent@cursor.com>
Confidence Score: 5/5The PR appears safe to merge; no concrete changed-code failure remains after checking the new concurrency, result propagation, shared-resource, and timing paths. The parallel workers retain explicit synchronization and isolated output capture, liveness completes before convergence consumes respawned IDs, and the overlapped fleet refresh operates on a separate mutation surface. Reviews (1): Last reviewed commit: "no-mistakes: apply CI fixes" | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Parallelize session-start network sweeps in bin/fm-startup-network.sh and bin/fm-bootstrap.sh: run per-secondmate remote liveness/relaunch concurrently rather than a sequential for-loop; run per-secondmate convergence sync concurrently; overlap project-clone refresh (fleet_sync) with those sweeps where they are independent. Keep the 120-second overall stage bound and the existing fail-closed guards (dirty worktree, unknown remote, unreachable remote; never force, stash, or discard unlanded work). Every per-mate SECONDMATE_LIVENESS: and SECONDMATE_SYNC: line must still be emitted, attributed to the correct mate, and not lost, duplicated, or interleave-corrupted under concurrency. Liveness must finish before sync because sync consumes respawned ids; do not overlap liveness with sync. Gitignore files and directories whose names start with scratchpad (scratchpad, scratchpad2/, scratchpad-foo) so untracked scratch no longer trips the remote-secondmate dirty-sync guard, without newly ignoring any currently-tracked path. Include a concurrency-safety regression test and keep colocated tests updated. Worker output is captured per-mate and replayed in original spawn order so concurrent probes cannot interleave or mis-attribute lines; respawned ids are recorded via files because background subshells cannot mutate parent state; sequential fallback remains if mktemp -d fails; the parent waits on explicit PIDs, never a bare wait.
What Changed
scratchpad*paths and add regression coverage for concurrency safety, fail-closed behavior, and dirty-sync guards.Risk Assessment
✅ Low: The implementation is well-bounded, preserves liveness-before-sync ordering and fail-closed behavior, captures per-mate output deterministically, retains explicit-PID waits and sequential fallback, and includes behavioral concurrency coverage.
Testing
Exercised the network-only bootstrap through fake remote endpoints in parallel and with forced
mktemp -dfailure, demonstrating concurrent liveness and sync sweeps, fleet-fetch overlap, strict liveness-before-sync ordering, spawn-order output replay, and preserved dirty/unreachable fail-closed diagnostics. Gitignore behavior, secondmate dirty-work guards, fleet-sync safety, and the startup stage bound also passed targeted tests; an exploratory broad bootstrap run exceeded its local 180-second limit after the relevant assertions had passed.Evidence: Bootstrap parallel/fallback output and remote-operation timeline
Source: Bootstrap parallel/fallback output and remote-operation timeline
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-bootstrap-network-parallel.test.shFM_TEST_EVIDENCE_FILE=/Users/kunchen/.no-mistakes/evidence/01M0S38M6EC9BH7VZ9W4PBJVD8/bootstrap-network-parallel-transcript.txt bash tests/fm-bootstrap-network-parallel.test.shbash tests/fm-gitignore-config.test.shbash tests/fm-secondmate-sync.test.shbash tests/fm-startup-network.test.shbash tests/fm-fleet-sync.test.shbash tests/fm-bootstrap.test.sh— exploratory broad run stopped at the 180-second local timeout after its relevant network partition, lock-ownership, and timing checks passed✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed (2) ✅
🔧 Fix: Fix empty environment assignment lint warning
1 warning still open:
🔧 Fix: Confirm lint passes with pinned actionlint
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.