Repository navigation
cmux link sync push: send git's loose objects as one pack - #34537
Conversation
The streamed copy wrote every loose object of .git as its own fs.write. A push now packs the loose objects with git pack-objects into this Mac's state folder (never touching the repository) and sends that pack and its index into .git/objects/pack/ instead; existing packs go whole as before. The made packs are kept per folder and machine folder and reused, so an unchanged repository sends nothing and a commit sends one small pack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5
|
Owned by an agent session · session |
|
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)
Shipped in:
|
|
Review (codex gpt-6-astra high, via router-review): SHIP at fc55faf Visual verdict: unchanged by this diff Checked the packing path, the pull side (pack revisions match the manifest so nothing comes back), and that the user's repository is never written. Follow-ups:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5
|
Found 5 test failures on Blacksmith runners: Failures
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5
|
Review (codex, router-review): SHIP at 93f81c2 Reviewer: codex gpt-6-astra high, fast tier. SHIP at 93f81c2 Visual verdict: unchanged by this diff Reviewed the pack creation, index parsing, manifest reuse/deletion flow, alternates handling, pull behavior, and Git pack output semantics. No correctness or regression findings. Follow-ups: none |
|
Review (codex gpt-6-astra high, router-review): BLOCK at 17dea10 BLOCK at 17dea10
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5
…packs # Conflicts: # cmux-tui/crates/cmux-tui/tests/link_sync.rs
|
Review (codex gpt-6-astra high, router-review): BLOCK at 8f20654 BLOCK at 8f20654
Confirmed the Git pruning and cached-index behavior with a fixture; Cargo tests were unavailable because the box has no Rust toolchain. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-3bab30503f0b9a7059e5
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Leo asked how the file/folder syncing works and why it takes so long:
and approved the plan: "3. Send several files at once, and send git's packs whole instead of loose files." This PR is the packs half; sending several files at once follows on top of the zstd write-stream PR.
Leo-ask: ask-6e29ca080a
What changes
cmux link sync push(the streamed copy behind Move to Cloud and a chat's copy) sent every loose object in.git/objects/xx/as its ownfs.write: a repository with a few thousand loose objects cost a few thousand round trips. Now:local::collectlists (the repository's own and any it borrows through alternates) are packed withgit pack-objectsfrom their names, into this Mac's state folder (<state>/link-sync/<record key>.packs/, next to the sync record this Mac already keeps). The pack and its.idxgo into.git/objects/pack/on the machine in place of the loose files. Nothing in the user's repository is written: no gc, no repack, no change to their.git..gitfile) go as they are, whole, under the same allow-list and skip rules as before. Hooks still never go, and the secrets, config cleaning and alternates rules are untouched (they are applied before packing, and only objects already being sent get packed).gcthe kept packs drop out, and the manifest's delete step removes them from the machine.git_back::copy_objectsalready skips pack files whose manifest revision matches the push, andpull.rsnever treats.gitas tree files, so the made pack is never brought back as a new file or a conflict. The new test checks this.New code:
cmux-tui/crates/cmux-tui/src/link/sync_cli/packs.rs(it reads the pack's v2.idxwith checked slicing and no indexing). There's one call inpush_inner, gated to git copies that keep a git record (notcmux link accessshares).Tests
loose_objects_go_as_a_pack_and_the_copy_is_a_valid_repository(tests/link_sync.rs, the realcmux-tui link sync pushagainst the realFsService): a dirty repo with one pack plus 40+ loose objects. It checks that this Mac's objects are byte-identical after the push, the machine has no loose objects, the local pack arrived whole plus exactly one made pack,git fsck --fullpasses, andgit status, HEAD and the stash match. A re-push writes 0, and a pull right after writes 0 and leaves this Mac's objects alone. After a commit it sends one small new pack (the old one stays), then fsck and status are checked again. After a localgcthe made packs go away and the copy still passes fsck.gitnow passesgc.auto=0: background auto-gc during a test was repacking objects in the middle of a push.loose_object_push_bench(#[ignore], same file): a 3,000-object repo pushed through an in-process fs server that adds a per-request round trip (CMUX_SYNC_BENCH_RTT_MS, default 20). It counts requests,fs.writes and bytes sent.cmux-ci test):cargo fmt --checkclean.link_syncpasses 19/19 (1 ignored),cloud_move_journeyandlink_seedpass, and thesync_clilib tests pass.cargo clippy -p cmux-tui --all-targets -D warningsreports only two findings, both already on base (cli/automation/teleport.rs:130,cli/automation.rs:98), and none in this diff.Performance
Same harness and env for both:
loose_object_push_bench, 300 working files over 10 commits = 3,030 loose objects, fleet Linux pool. Before isfeat-cmux-nextat d7d34e6, after is this head.loose_object_push_bench,CMUX_SYNC_BENCH_RTT_MS=20CMUX_SYNC_BENCH_RTT_MS=0fs.writes (files sent)git count-objects -von both sidesMost of the time left after this is the 300 working files, one round trip each. Sending several files at once is the follow-up.
Risk
git pack-objectson this Mac, reading the repository and writing only to the state folder. Its cost is about one compression pass over the loose objects.Agent session: agent session
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
cmux link sync pushnow sends git's loose objects as one pack instead of onefs.writeper object, cutting push time by ~91% on a link with round-trip latency and ~66% locally while reducing requests and bytes sent by over 80%.What changed
git pack-objectsfrom the object names alone, written only to this Mac's state folder; nothing in the user's repository changes (no gc, no repack). Git runs throughcmux_processso the pack obeys the same sandbox as the rest of the sync..gitfiles go as before, under the same allow-list, skip, hook, secret, config, and alternates rules.gcthe made packs drop out and are removed from the machine.Tests and performance
git fsck, matches status/HEAD/stash, re-push writes 0, and post-commit pushes send one small pack; a separate test checks a made pack arrives 0600 even when reused after its objects become public.CMUX_SYNC_BENCH_RTT_MS, default 20); results below are from fleet Linux.fs.writesRisk
git pack-objects, reading the repository and writing only to the state folder; its cost is about one compression pass over the loose objects.Written for commit 7f32dfb. Summary will update on new commits.