Skip to content

Stop sandbox when .git directory is missing during exec#390

Merged
robinaugh merged 1 commit intomainfrom
jason/stop-sandbox-on-no-git-dir
Mar 2, 2026
Merged

Stop sandbox when .git directory is missing during exec#390
robinaugh merged 1 commit intomainfrom
jason/stop-sandbox-on-no-git-dir

Conversation

@robinaugh
Copy link
Contributor

@robinaugh robinaugh commented Mar 2, 2026

Summary

  • When sandbox exec detects a missing .git directory during sync, the sandbox is now stopped and the session removed from storage
  • Previously the sandbox was left running, requiring a manual rwx sandbox reset before retrying
  • Uses a sentinel error (ErrSandboxNoGitDir) so ExecSandbox can identify the specific failure and clean up via the already-open SSH connection
  • We can use this for other cases as we discover them where an error should kill a sandbox (i.e. possibly the sandbox run definition file becoming dirty)

Test plan

  • Existing test updated to verify __rwx_sandbox_end__ is sent and session is removed from storage
  • All other sandbox tests continue to pass
  • Manual: configure a sandbox without preserve-git-dir: true, run rwx sandbox exec, confirm it errors and the sandbox is stopped (next exec creates a fresh one)
╰─⠠⠵ ~/code/cli/rwx sandbox exec -- pwd
Started sandbox: fb6726b9d3d549d68322e3f9b7579363
https://cloud.rwx.com/mint/rwx/runs/fb6726b9d3d549d68322e3f9b7579363
Error: failed to sync changes to sandbox: no .git directory found in sandbox. Set 'preserve-git-dir: true' on your git/clone task

# Fix it, try again, note the new sandbox URL below


╰─⠠⠵ ~/code/cli/rwx sandbox exec -- pwd
Started sandbox: 50e3de01ad524efcaf1300b33c11030c
https://cloud.rwx.com/mint/rwx/runs/50e3de01ad524efcaf1300b33c11030c
/var/mint-workspace
No changes to pull from sandbox.

@robinaugh robinaugh self-assigned this Mar 2, 2026
@robinaugh robinaugh force-pushed the jason/stop-sandbox-on-no-git-dir branch 2 times, most recently from e5b8f37 to aae798e Compare March 2, 2026 19:24
When syncChangesToSandbox detects a missing .git directory, the sandbox
was left running and the session stayed in storage. Users had to manually
reset before retrying. Now we send __rwx_sandbox_end__ and remove the
session so the next exec gets a fresh sandbox automatically.
@robinaugh robinaugh force-pushed the jason/stop-sandbox-on-no-git-dir branch from aae798e to 2a9f11a Compare March 2, 2026 19:28
@robinaugh robinaugh marked this pull request as ready for review March 2, 2026 19:42
@robinaugh robinaugh merged commit eb4f813 into main Mar 2, 2026
1 check passed
@robinaugh robinaugh deleted the jason/stop-sandbox-on-no-git-dir branch March 2, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants