Repository navigation
cmux vm run: remove the guest's sync and pull archives on every exit path - #29722
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-75b7a03d1a2084cf16af
…path The sync archive was removed only after a successful unpack, and a failed removal of the pull archive was ignored, so a kept (paused) VM could hold up to 64 MiB (sync) or 256 MiB (pull) of the user's files. The unpack now removes its archive on exit (a trap), and once anything may be staged the run removes both archives before it ends the VM, failure and interrupt included, reporting a failed removal on a kept VM with the command that finishes it. Fixes #29704. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-75b7a03d1a2084cf16af
Contributor
|
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:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-75b7a03d1a2084cf16af
teamleaderleo
temporarily deployed
to
ci-routing-agent
October 31, 2026 22:01 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
artifacts
October 31, 2026 22:18 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
sentry-dsyms
October 31, 2026 22:18 — with
GitHub Actions
Inactive
An interrupted run drops its in-flight exec, but the guest's upload or pull pack can still be running or not yet started, so it could reopen an archive after the cleanup, or hold a removed one open. Writers now refuse once a fence file exists; the cleanup makes it, then in rounds kills any process holding an archive open and removes them. The hint for a failed removal on a kept VM now resumes it first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-75b7a03d1a2084cf16af
… stops them A single fence check let a writer that had passed it open its archive after the cleanup. Each upload and pull now runs in its own process group, registers itself, then checks the fence; the cleanup makes the fence, then kills every registered group until none is left, then removes the archives. Whichever comes second sees the other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-75b7a03d1a2084cf16af
teamleaderleo
temporarily deployed
to
ci-routing-agent
October 31, 2026 22:34 — with
GitHub Actions
Inactive
The unpack and the pull's chunk reads hold an archive open as well, so a reader left behind by an interrupted run kept a removed archive's bytes on a kept VM. They now register like the writers, and the unpack removes its archive explicitly once tar ends (its own EXIT trap would have replaced the registration's). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-75b7a03d1a2084cf16af
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
temporarily deployed
to
ci-routing-agent
October 31, 2026 23:01 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
sentry-dsyms
October 31, 2026 23:10 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
artifacts
October 31, 2026 23:10 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
artifacts
October 31, 2026 23:15 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
artifacts
October 31, 2026 23:22 — with
GitHub Actions
Inactive
teamleaderleo
temporarily deployed
to
artifacts
October 31, 2026 23:26 — with
GitHub Actions
Inactive
Collaborator
Author
|
Review (codex gpt-6-astra high, next-review): SHIP at 95f231b SHIP at 95f231b Visual verdict: no images; Leo tries the build
Direct shell checks passed for interruption, delayed writers, and repeated cleanup. Rust tests could not run because Cargo is unavailable. Follow-ups:
|
teamleaderleo
added a commit
that referenced
this pull request
Nov 1, 2026
The --pull size check now measures the fenced pull command that #29722 sends (pull_command), not the bare pack script. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-75b7a03d1a2084cf16af
teamleaderleo
added a commit
that referenced
this pull request
Nov 1, 2026
lifecycle.rs: both sides added tests at the end (revoke_removes_an_unreadable_stored_token here, #29722's kept-run archive tests on base); both are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-75b7a03d1a2084cf16af
This branch was previously deployed
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.
cmux vm runnow removes its archives on the guest on every exit path, failures included, and says so when it couldn't remove them from a kept VM.From #29704: "
cmux vm runremoves the sync archive on the guest only after a successful extraction, and ignores a failed removal of the pull archive (/tmp/cmux-pull.tgzand its.rc). With--keep(pause instead of delete), a failed extraction or cleanup leaves up to 64 MiB (sync) or 256 MiB (pull) of the user's files on the paused VM. Fix: remove both archives on every path, failure included (a trap in the guest script), and report a failed removal when the VM is kept."How:
trap 'rm -f /tmp/cmux-run.tgz' EXITbeforetar -xzf, so the archive goes whether tar succeeds or fails.rm -f /tmp/cmux-run.tgz /tmp/cmux-pull.tgz /tmp/cmux-pull.tgz.rcbefore it pauses or deletes the VM. That covers a failed upload, a failed unpack, a failed pull and an interrupt. The old pull-only cleanup, which ignored its own result, is replaced by this step.cmux vm exec <id> -- 'rm -f ...'). The run's exit status is unchanged.Fixes #29704
Changelog
cmux vm run --keepno longer leaves the synced or pulled archive of your files on the paused VM when an upload, unpack or pull fails, and it reports a cleanup it could not finish.Tests
tests/lifecycle.rs, against a mock API with a kept (paused) VM:a_kept_run_removes_a_partly_uploaded_sync_archive: the upload fails, and the archives are removed once before the pause.a_kept_run_removes_a_sync_archive_that_failed_to_unpack: tar fails. The unpack script carries the trap, and the archives are removed once.a_kept_run_reports_pull_archives_it_could_not_remove: the pull fails, then the removal fails. stderr reports it with the command to run, and the VM is still paused.Focused command (in
workers/cmux-vm/cli):cargo test --locked -p cmux-vm --test lifecycle a_kept_run. Red withrun.rsat the test commit ac70722 (all 3 fail). Green at the head 5c28ed0.Observed / Not run
cargo test --locked -p cmux-vm(all suites pass), andcargo clippy --locked -p cmux-vm --all-targets -- -D warnings(clean).trap ... EXITin the unpack script, plus onerm -fexec before the VM is paused or deleted.No capture: CLI only, no UI change.
🤖 Generated with Claude Code
Agent session: agent session