Skip to content

fix(cloud): wait for repo sync before native agent tools - #34782

Merged
teamleaderleo merged 8 commits into
feat-cmux-nextfrom
fix/codex-sync-pretool
Nov 4, 2026
Merged

teamleaderleo merged 8 commits into
feat-cmux-nextfrom
fix/codex-sync-pretool

Conversation

@teamleaderleo

Copy link
Copy Markdown
Collaborator

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

Metric Before After Delta Harness
Native pre-tool edits retained during an existing seed 0/100 100/100 +100 percentage points cmux-git test native_pre_tool_retention_measurement, same 100-iteration schedule

This 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

teamleaderleo and others added 5 commits November 4, 2026 04:02
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
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 09a105b: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr34782 -f ref=fix/codex-sync-pretool -f platform=macos -f backend_mode=local

Unclear: web / diff-sidecar-check failed: no known signature; failed step: Test Rust sidecar.

CI failed on 09a105b9b0 (run 41775447206 attempt 1): 1 unknown.

Job Verdict Why
web / diff-sidecar-check unknown no known signature; failed step: Test Rust sidecar

Not re-run automatically: web / diff-sidecar-check is not a machine failure.

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

red: web / Web status; a job it gathers is red on this change (its line here); do not merge until green; see lane-rules
red: web / diff-sidecar-check; no finished base run on 851f9ed to compare; do not merge until green; see lane-rules

Shipped in:

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Nov 4, 2026
teamleaderleo and others added 2 commits November 4, 2026 04:27
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
@cursor

cursor Bot commented Nov 4, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot 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 teamleaderleo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@teamleaderleo
teamleaderleo merged commit c30af19 into feat-cmux-next Nov 4, 2026
174 of 178 checks passed
@teamleaderleo
teamleaderleo deleted the fix/codex-sync-pretool branch November 4, 2026 05:34
lawrencecchen added a commit that referenced this pull request Nov 4, 2026
…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>
teamleaderleo added a commit that referenced this pull request Nov 4, 2026
…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>
lawrencecchen pushed a commit that referenced this pull request Nov 4, 2026
…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>
lawrencecchen added a commit that referenced this pull request Nov 4, 2026
…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.

This branch was previously deployed

3 inactive deployments
artifacts — 09a105b9 Deployed Nov 4, 2026 by teamleaderleo via publish tree-addressed cmux-tui #109603
sentry-dsyms — 09a105b9 Deployed Nov 4, 2026 by teamleaderleo via upload cmux-tui dSYMs to Sentry #109603
ci-routing-agent — 09a105b9 Deployed Nov 4, 2026 by teamleaderleo via cmux-tui tree preflight #109603
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant