Repository navigation
fix(cloud): wait for repo sync before native agent tools - #34782
Conversation
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-5e8301797328ccca5388
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-5e8301797328ccca5388
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-5e8301797328ccca5388
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-5e8301797328ccca5388
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-5e8301797328ccca5388
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
Unclear: CI failed on
Not re-run automatically: Written by red: web / Web status; a job it gathers is red on this change (its line here); do not merge until green; see lane-rules Shipped in:
|
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-5e8301797328ccca5388
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-5e8301797328ccca5388
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-5e8301797328ccca5388
Bugbot needs on-demand usage enabledBugbot uses usage-based billing for this team and requires on-demand usage to be enabled. A team admin can enable on-demand usage in the Cursor dashboard. |
teamleaderleo
left a comment
There was a problem hiding this comment.
Review (subagent native_tool_gate): SHIP at 09a105b
Visual verdict: no images supplied; this is a Rust/ACP hook behavior change.
The callback is handled inline, waits for sync, and is drained and written before the next Claude frame. Registration and Unix cfg paths match; timeout/error denials and wrapper exit behavior remain fail-closed. The readiness wait intentionally drops its lease before native execution, as documented.
Follow-ups: none.
…ter (clippy redundant_clone, from #34782) (#35007) c30af19 (#34782) cloned `repo` into `target` for the waiter thread in pre_tool_wait_releases_only_after_sync_completes, but the test never uses `repo` after that line: clippy::redundant_clone, so `clippy -D warnings` on all targets fails to build cmux-git's sync_barrier test on feat-cmux-next. The thread closure now takes `repo` itself. The Scratch that owns the folder stays alive in the test as before. Co-authored-by: cmux-bot[bot] <348531757+cmux-bot[bot]@users.noreply.github.com>
…ndency (#35090) #34782 added serde_json to cmux-git, a path dependency of Native/DiffSidecar, without updating its Cargo.lock. Every fleet app build then failed at the diff-sidecar step (cargo --locked: cannot update the lock file). cargo check --locked in Native/DiffSidecar (rbx): exit 101 on the base, exit 0 with this change. Agent-Session: https://cmux.com/deeplink/agent?id=aid-d750cf10922c785efa64 Co-authored-by: Austin Wang <austinwang115@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ndency (#34935) #34782 added serde_json to cmux-git, a path dependency of Native/DiffSidecar, without updating its Cargo.lock. Every fleet app build then failed at the diff-sidecar step (cargo --locked: cannot update the lock file). cargo check --locked in Native/DiffSidecar (rbx): exit 101 on the base, exit 0 with this change. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…rejects (#35066) * cmux-next: check-cargo-locks.py finds every Cargo.lock that --locked rejects The Linux compile check stayed green for hours while every Release dogfood build failed with "cannot update the lock file .../Native/DiffSidecar/Cargo.lock because --locked was passed": #34782 added serde_json to cmux-tui/crates/cmux-git, Native/DiffSidecar uses cmux-git by path, and its own lock was not updated (fixed by #34935). scripts/cmux-next/check-cargo-locks.py runs `cargo metadata --locked --format-version 1` (a full resolve; it compiles nothing) for the folder of every tracked Cargo.lock and every crate folder the Release build compiles with --locked, each with the toolchain that build uses (its rust-toolchain file, else the cmux-tui pin). One line per lock: "OK dir", "STALE dir: <cargo's error>" or "ERROR dir: <cargo's error>"; exit 1 on a stale lock, 2 when a folder could not be checked. `--no-deps` does not resolve and `cargo update --dry-run` ignores --locked, so neither sees this red. It is not a CI job: the lead's tip watcher and the dogfood builder's preflight run it (Lawrence: no new CI gates). Red at a98d3dd (before #34935), 2.2 s: STALE Native/DiffSidecar: error: cannot update the lock file .../Native/DiffSidecar/Cargo.lock because --locked was passed to prevent this (28 other lines: OK) check-cargo-locks: 1 stale of 29 Cargo.lock: Native/DiffSidecar. Run `cargo update --workspace` in each (no other change) and commit the lock. exit=1 Green at f1942ca (#34935's head: the DiffSidecar lock lists serde_json): (29 lines: OK) check-cargo-locks: all 29 Cargo.lock resolve with --locked exit=0 * check-cargo-locks: a fault of the script or host exits 2, never the stale-lock 1; rustup's cargo first; the fix names the pin Review findings on #35066 (HOLD at 43d8a44): no git checkout, no git, a failed git ls-files or an exception exited 1, the code that means a stale lock. Now they print "not checked" and exit 2. cargo_bin() looks in $CARGO_HOME/bin before PATH (the build scripts do the same; another cargo ignores the pins). The fix line names the toolchain for a crate with no pin file of its own (optchat-chief: cargo +1.95.0 update --workspace). Red at a98d3dd (before #34935), this version: STALE Native/DiffSidecar: error: cannot update the lock file .../Native/DiffSidecar/Cargo.lock because --locked was passed to prevent this check-cargo-locks: 1 stale of 29 Cargo.lock: Native/DiffSidecar. Fix: (cd Native/DiffSidecar && cargo update --workspace), then commit only the lock. exit=1 (28 other lines: OK) Green at f1942ca (#34935 head): (29 lines: OK) check-cargo-locks: all 29 Cargo.lock resolve with --locked exit=0 Not a git checkout (--repo /tmp) and no git on PATH: "check-cargo-locks: not checked: ...", exit=2. * check-cargo-locks: a missing lock is STALE (exit 1), not a host fault Review CHANGES at 43f2832 (claude-reviewer-35066): when a Release crate has no Cargo.lock, cargo says "cannot create the lock file ... because --locked was passed", which the STALE pattern did not match, so the script said ERROR and exited 2 (not checked). The Release build fails on that crate too, so it is stale. Red before: with cmux-tui/crates/cmux-rd-ffi/Cargo.lock removed, ERROR, exit 2 (reviewer's run). Green now: STALE cmux-tui/crates/cmux-rd-ffi, exit 1.
A native full-access Claude or Codex tool could run while a Cloud repository was still being seeded. Synchronous PreToolUse hooks now wait for that existing sync before letting the tool run. Claude's native ACP adapter registers the same callback. Incomplete or timed-out syncs return a provider denial; wrapper failures exit 2 instead of silently allowing the tool.
Leo's request: “Block edits until the repo sync finishes: the agent’s file-write tools wait on the sync barrier instead of racing it.” This extends #34491 to native tool hooks, including installed and fallback commands. Hooks remain on by default; reverting this PR restores the previous hook behavior.
The gate is a readiness wait: its lease ends before the native tool executes, so a later concurrent reseed can still race a native tool. The ACP filesystem write path retains its lease through the write. Tool cwd and explicit file/directory targets are checked; arbitrary shell command destinations are not parsed.
Performance
cmux-gittestnative_pre_tool_retention_measurement, same 100-iteration scheduleThis deterministic retention measurement is separate from the end-to-end first-keystroke Cloud readiness p50/p95 probes.
Validation
Pending fleet receipt: sync barrier and native-hook integration tests; hooks installer, trust and shell-wrapper suite; native Claude callback tests; hook binary compile check.
The pre-tool wait stops on readiness, failed sync, or timeout. Hook configuration allows 90 seconds around the 30-second readiness budget and lock acquisition; no background loop survives the hook.
Changelog
Cloud agent tools wait for an in-progress repository sync before editing.
🤖 Generated with Codex
Agent session: agent session