Add workspace sandbox tool#24
Merged
Merged
Conversation
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.
2a1fcc5 to
e614d9a
Compare
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.
No description provided.