Repository navigation
Add unified resource backends and local sandbox operations - #34
Conversation
There was a problem hiding this comment.
Confidence Score: 4/5
Summary
Adds unified backends and persistent local sandboxes; all three prior findings are resolved. Local validation passed: 146 Rust tests, nine Python tests, formatting, strict Clippy, and release build; native VM behavior remains independently unverified.
Deployed verification not applicable: adapt/platform-cli is outside the preview pilot and has no PR preview deployment workflow. No webhook was sent.
Important Files Changed
| File | Changes |
|---|---|
| src/backend/local.rs | Validates environment defaults and overrides; releases completed sessions with bounded retries while preserving outcomes. |
| src/backend/mod.rs | Defines resource operations and explicit unsupported-capability defaults without cloud fallback. |
| src/backend/cloud.rs | Preserves Platform operations, execution management, and confirmed temporary-sandbox cleanup. |
| src/commands.rs | Routes local resources before cloud configuration and shares lifecycle workflows. |
| src/cli.rs | Defines global backend selection while preserving credential-only local logout. |
| src/local_runtime.rs | Validates private Unix-socket discovery and serializes manager bootstrap. |
| src/shell.rs | Composes creation, readiness, execution, interruption, and cleanup across backends. |
| src/stream.rs | Preserves responsive terminal escape with bounded buffering and backpressured piped input. |
| tests/local_shell/sessions.rs | Covers 70 sequential executions, detach races, timeouts, failures, exit preservation, and merged environment rejection. |
| tests/backend/mod.rs | Verifies unsupported operations and invalid environments fail before runtime startup or cloud credential loading. |
| tests/local_shell/backend.rs | Checks persistent lifecycle, environment overrides, metadata permissions, inventory, and waits. |
| README.md | Restores the local examples’ closing code fence. |
| docs/cli-reference.md | Documents environment limits, completed-session cleanup, and retained sessions after disconnecting from running commands. |
Run info
| Field | ID |
|---|---|
| Agent | 0d6ccd7e-b62f-4075-a561-199d1a7b1bf0 |
| Automation | 1fbe37ac-ca54-4b0b-9fea-80055702da90 |
| Run | c076d559-9150-42e9-bfed-3d2bb9447680 |
Reviewed: 9f5e86c-e0e435a · ↻ Re-run review
|
@the-adaptile please review this PR again at the latest head, Both review findings have been addressed: local HTTP/WebSocket connections now use a validated private Unix socket, and Ctrl-] remains responsive at zero stdin credit with bounded buffering. The bootstrap fixture and Windows lint fixes are included, and all five build/test CI jobs are green. Please publish an updated formal review and check result for the current head. |
|
@the-adaptile please review again at d98645c. The shell-only backend enum is now a Please focus on backend dispatch, explicit unsupported capabilities, lifecycle/cleanup semantics, and isolation of local configuration and credentials. All 136 Rust tests, nine packaging tests, formatting and strict lint checks passed locally. Real Apple Silicon validation passed persistent lifecycle/environment overrides, shell execution, 512 KiB stdin, PTY resize, interruption cleanup and empty final inventory. |
|
@the-adaptile please review again at e0e435a. All three findings are addressed: completed session cleanup with bounded detach-race retries, environment validation before runtime startup and after merging defaults, and the README fence. All 146 Rust tests, strict Clippy, formatting, and native Apple Silicon checks passed, including 70 sequential executions with no retained sessions. |
Add local sandboxes to the unified
adaptCLI through a resource-levelBackendtrait. Every sandbox command, execution and file command selects a backend; volumes, images and endpoints also have backend entry points so their local implementations can be added independently. Cloud remains the default. Global--localand--cloudflags select the target, including when placed after a subcommand.The local backend supports persistent sandbox create/list/get/stop/delete/wait, attached execution, and temporary shells. For example,
adapt --local sandbox create --wait --env EDITOR=vimcreates a VM that lateradapt --local exec ID -- COMMANDinvocations can use. Creation environment settings persist privately and execution flags override them. Environment names, counts, and sizes are validated before runtime startup and again after merging execution overrides. Completed sessions are released after stream detachment, with bounded retries for detach races; running commands survive a client disconnect.sandbox shcomposes the same create/wait/execute/cleanup operations and deletes the VM on completion or handled interruption.Unsupported capabilities return explicit errors before loading cloud credentials or launching a runtime, with no cloud fallback. Local start/restart, usage, detached or retained execution management, files, and other resource families remain unsupported. Local commands currently require full sandbox UUIDs; inventory is unpaginated with optional ID-prefix filtering. JSON exposes common ID/status/resource fields alongside Goblin diagnostics.
Local management uses the private Unix HTTP/WebSocket transport and discovery protocol from the merged https://github.com/adapt/goblin/pull/154. Discovery validates the socket path, ownership, permissions, and manager UUID, uses a separate token, and serializes concurrent bootstrap. Local configuration never selects a target implicitly. Existing
auth logout --localbehavior is preserved.A compatible Goblin bundle is still supplied through
ADAPT_LOCAL_RUNTIMEor--runtime-dir. Automatic runtime installation, daemon-enforced expiry, mounts, and moves are follow-ups. An uncatchable CLI kill can leave a VM behind; local list/delete commands now provide cleanup directly through Adapt. Local output is not Platform's retained, redacted log service.Validation:
cargo fmt --all -- --checkcargo clippy --locked --all-targets -- -D warningscargo test --locked: 146 tests, covering cloud behavior, all local capability errors, global target conflicts, persistent lifecycle/environment limits, metadata permissions, discovery security, terminal cleanup, and 70 sequential executions with detach-race retries and preserved exit codes.python3 -m unittest discover -s scripts -p '*_test.py'