Skip to content

feat: let sessions share a sandbox, and run one in its own git worktree - #37

Merged
insertt merged 3 commits into
feat/nightly-image-downloadfrom
feat/shared-sandbox-worktrees
Dec 2, 2026
Merged

insertt merged 3 commits into
feat/nightly-image-downloadfrom
feat/shared-sandbox-worktrees

Conversation

@insertt

@insertt insertt commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Stacked on #36; the base will move to main once that merges.

feat: let several sessions share a sandbox

Sessions of one sandbox no longer exclude each other. A setup lock keeps two
from setting the sandbox up at once, each attached session holds its own
lock, and one leader runs the network prompt bridge, the status refresher and
the nightly updater for all of them, handing over when it ends. Recreating,
switching to a newer nightly image and disposing of a dedicated scratch
sandbox wait until the session is alone. The sandbox record is changed under
a lock so concurrent sessions keep each other's changes, and sand status
lists every attached session.

feat: run a session in its own git worktree with --worktree

sand <harness> --worktree[=NAME] starts the agent in a git worktree of the
primary workspace, on a new or named branch, kept in sand's directory for the
sandbox and mounted at the same path inside it. A worktree with no work left
is removed when its session ends; sand worktree ls and sand worktree rm
list and remove the others.


Checked locally on stable Rust: cargo fmt --check, cargo clippy --all-targets --locked (with -D warnings) and cargo test --locked pass.

Sessions of one sandbox no longer exclude each other. A setup lock keeps two
from setting the sandbox up at once, each attached session holds its own
lock, and one leader runs the network prompt bridge, the status refresher and
the nightly updater for all of them, handing over when it ends. Recreating,
switching to a newer nightly image and disposing of a dedicated scratch
sandbox wait until the session is alone. The sandbox record is changed under
a lock so concurrent sessions keep each other's changes, and `sand status`
lists every attached session.
`sand <harness> --worktree[=NAME]` starts the agent in a git worktree of the
primary workspace, on a new or named branch, kept in sand's directory for the
sandbox and mounted at the same path inside it. A worktree with no work left
is removed when its session ends; `sand worktree ls` and `sand worktree rm`
list and remove the others.
On Windows git lists worktrees with forward slashes, so looking for the backslashed path in its output failed. Read the porcelain list and compare canonical paths, as the code itself does.
@insertt
insertt force-pushed the feat/shared-sandbox-worktrees branch from f0f0f8f to c2d35a4 Compare December 2, 2026 20:30
@insertt
insertt merged commit abd1281 into main Dec 2, 2026
5 checks passed
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.

1 participant