Skip to content

Add workspace sandbox tool#24

Merged
afq984 merged 5 commits into
google:mainfrom
afq984:push-wutrmokomyrs
Apr 13, 2026
Merged

Add workspace sandbox tool#24
afq984 merged 5 commits into
google:mainfrom
afq984:push-wutrmokomyrs

Conversation

@afq984
Copy link
Copy Markdown
Collaborator

@afq984 afq984 commented Apr 13, 2026

No description provided.

afq984 added 5 commits April 13, 2026 09:39
Introduce the wsb binary (workspace sandbox launcher) with clap-based
CLI parsing. Currently only validates the workspace path exists and is
a directory.

Add serde, sha2, and toml crate dependencies to MODULE.bazel for
upcoming workspace ID and config features.
Compute workspace ID as the first 16 hex chars of SHA-256 of the
canonical workspace path. Create persistent state directory at
~/.local/share/agent-shell-tools/<id>/ with sandbox home and
workspace.toml metadata for ID recovery. Create runtime directory at
<workspace>/.agent-shell-tools/ for socket and PID file.

Detect stale instances via PID file and clean up dead sockets.
Validate socket path length against the Unix 107-byte limit.
Find sandbox and exec_server binaries as siblings of the wsb binary,
falling back to $PATH. Mount the exec_server's parent directory
read-only inside the sandbox so it is accessible.

Spawn sandbox with exec_server inside, poll for the gRPC socket to
appear (50ms interval, 10s timeout), and print 'ready: <socket_path>'
on stdout. Clean up socket and PID file on normal exit.

Signal forwarding for clean shutdown on SIGTERM/SIGINT is deferred to
a follow-up CL.
Install SIG_IGN for SIGTERM via sigaction at startup so wsb survives
process-group signals (Ctrl-C, supervisor kill) and can clean up the
socket and PID file after the child exits.

The child (sandbox/nsjail) receives signals independently through the
process group.  When the child exits, wsb's child.wait() returns and
cleanup runs normally.
Add wsb_test.rs with three integration tests:
- start_creates_directories: verifies state and runtime dirs are created
- start_end_to_end: runs a command through exec_client and verifies
  sandbox isolation (hostname = coding-agent)
- start_rejects_nonexistent_workspace: verifies error on bad path

Add wsb binary to the dist tarball alongside the other tools.
@afq984 afq984 force-pushed the push-wutrmokomyrs branch from 2a1fcc5 to e614d9a Compare April 13, 2026 00:40
@afq984 afq984 enabled auto-merge (rebase) April 13, 2026 00:40
@afq984 afq984 merged commit a7fd434 into google:main Apr 13, 2026
3 checks passed
@afq984 afq984 deleted the push-wutrmokomyrs branch April 13, 2026 00:42
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