fix(cloud): wait for repository seeding before agent startup and writes
An agent that starts while a Cloud Git seed is still checking out files can edit a partial checkout and have its changes overwritten. Publish a persistent sync barrier before git.seed.start answers, and open it only after checkout, submodules, and LFS finish successfully. Failed or interrupted seeds remain blocked until a successful retry.
Requested behavior: “Block edits until the repo sync finishes: the agent's file-write tools wait on the sync barrier instead of racing it.”
Harness startup and live-child lookup wait for the barrier. Mutating or unclassified native permission requests wait before approval, including automatic approval. ACP file writes retain their read lease through the filesystem mutation. Per-path creation leases also prevent a first seed from overtaking an operation that observed no marker, without making sibling repositories wait for each other.
This covers the Git-seed path and daemon-mediated operations. Already-running full-access native tools can bypass permission callbacks; a startup/lookup lease ends when that operation returns, not at the end of a native turn. The legacy fs-v1 copy path needs its own begin/finish transaction; coordination is recorded on #34362. This does not claim OS-level enforcement over arbitrary native writes.
Enabled by default. Reverting this change restores the previous behavior. The 100 ms agent wait runs only while a sync is active and stops on completion, failure, cancellation, or its 10-minute deadline. The per-path creation-lock retry stops when acquired or after 30 seconds; all lock leases release on drop.
| Performance metric | Before | After | Delta | Harness |
|---|---|---|---|---|
| Agent edits retained in 100 overlapping sync/write schedules | 0/100 | 100/100 | +100 percentage points | cmux-git --test sync_barrier, sync_race_retention_measurement; same deterministic schedule |
This metric measures edit safety. End-to-end first-keystroke-to-ready p50/p95 belongs to the Cloud readiness probes and is not inferred from this test.
Validation: fleet tests passed for the barrier (7 tests), cancellation and ACP writes (3 tests), and real Git clone success/failure (1 test) at 9c9b6a0e44145ef0e8ac51b601b0ff231e9c3f4c. The final permission-kind extension is independently reviewed; its exact-head fleet run is 41751471953, pending. Static pre-push checks passed against the full branch diff. Independent review: gpt-6-astra/high at 90e51b20e9c75d86fbd7886756a31ca77b80a7e5.
🤖 Generated with Codex
Agent session: agent session