-
Notifications
You must be signed in to change notification settings - Fork 34
test(e2e): cover fspy in agent sandboxes #564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
...ite_task_bin/tests/e2e_snapshots/fixtures/sandboxed_fspy/claude-code-default-sandbox.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "network": { | ||
| "allowedDomains": [], | ||
| "deniedDomains": [] | ||
| }, | ||
| "filesystem": { | ||
| "denyRead": [], | ||
| "allowRead": [], | ||
| "allowWrite": ["."], | ||
| "denyWrite": [] | ||
| } | ||
| } |
1 change: 1 addition & 0 deletions
1
crates/vite_task_bin/tests/e2e_snapshots/fixtures/sandboxed_fspy/input.txt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| tracked input |
4 changes: 4 additions & 0 deletions
4
crates/vite_task_bin/tests/e2e_snapshots/fixtures/sandboxed_fspy/package.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "name": "sandboxed-fspy", | ||
| "private": true | ||
| } |
78 changes: 78 additions & 0 deletions
78
crates/vite_task_bin/tests/e2e_snapshots/fixtures/sandboxed_fspy/snapshots.toml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| [[e2e]] | ||
| name = "fspy_under_codex_sandbox" | ||
| comment = """ | ||
| Runs `vt run inner` under Codex CLI's built-in `:workspace` permission profile, representing its default workspace-editing posture for a trusted repository. The profile makes the workspace roots and system temp directories writable without adding network or Unix socket access. See [Codex permissions](https://learn.chatgpt.com/docs/permissions#define-and-select-a-profile). | ||
|
|
||
| The nested `vt` enables fspy for automatic input inference; changing the file read inside the sandbox checks whether it invalidates the cache. | ||
| """ | ||
| platform = "macos" | ||
| ignore = true | ||
| steps = [ | ||
| [ | ||
| "codex", | ||
| "sandbox", | ||
| "-P", | ||
| ":workspace", | ||
| "vt", | ||
| "run", | ||
| "inner", | ||
| ], | ||
| [ | ||
| "vtt", | ||
| "replace-file-content", | ||
| "input.txt", | ||
| "tracked", | ||
| "modified", | ||
| ], | ||
| [ | ||
| "codex", | ||
| "sandbox", | ||
| "-P", | ||
| ":workspace", | ||
| "vt", | ||
| "run", | ||
| "inner", | ||
| ], | ||
| ] | ||
|
|
||
| [[e2e]] | ||
| name = "fspy_under_anthropic_sandbox_runtime" | ||
| comment = """ | ||
| Runs `vt run inner` under a profile matching Claude Code's default enabled Bash sandbox: the working directory and session temp directory are writable, with no pre-allowed network domains or extra Unix socket access. See [Claude Code sandboxing](https://code.claude.com/docs/en/sandboxing#filesystem-isolation). | ||
|
|
||
| Claude Code normally creates the writable session temp before invoking Sandbox Runtime, so the harness creates the runtime's default `/tmp/claude` directory before calling `srt` directly. The fixture profile provides only `allowWrite: ["."]`; Sandbox Runtime supplies `/tmp/claude` and its other built-in compatibility paths. See [`getDefaultWritePaths` and `generateProxyEnvVars`](https://github.com/anthropic-experimental/sandbox-runtime/blob/main/src/sandbox/sandbox-utils.ts). | ||
|
|
||
| The nested `vt` enables fspy for automatic input inference; changing the file read inside the sandbox checks whether it invalidates the cache. | ||
| """ | ||
| platform = "macos" | ||
| ignore = true | ||
| steps = [ | ||
| { argv = [ | ||
| "mkdir", | ||
| "-p", | ||
| "/tmp/claude", | ||
| ], comment = "create the session temp that Claude Code supplies before sandboxed Bash commands" }, | ||
| [ | ||
| "srt", | ||
| "--settings", | ||
| "claude-code-default-sandbox.json", | ||
| "vt", | ||
| "run", | ||
| "inner", | ||
| ], | ||
| [ | ||
| "vtt", | ||
| "replace-file-content", | ||
| "input.txt", | ||
| "tracked", | ||
| "modified", | ||
| ], | ||
| [ | ||
| "srt", | ||
| "--settings", | ||
| "claude-code-default-sandbox.json", | ||
| "vt", | ||
| "run", | ||
| "inner", | ||
| ], | ||
| ] | ||
37 changes: 37 additions & 0 deletions
37
...shots/fixtures/sandboxed_fspy/snapshots/fspy_under_anthropic_sandbox_runtime.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # fspy_under_anthropic_sandbox_runtime | ||
|
|
||
| Runs `vt run inner` under a profile matching Claude Code's default enabled Bash sandbox: the working directory and session temp directory are writable, with no pre-allowed network domains or extra Unix socket access. See [Claude Code sandboxing](https://code.claude.com/docs/en/sandboxing#filesystem-isolation). | ||
|
|
||
| Claude Code normally creates the writable session temp before invoking Sandbox Runtime, so the harness creates the runtime's default `/tmp/claude` directory before calling `srt` directly. The fixture profile provides only `allowWrite: ["."]`; Sandbox Runtime supplies `/tmp/claude` and its other built-in compatibility paths. See [`getDefaultWritePaths` and `generateProxyEnvVars`](https://github.com/anthropic-experimental/sandbox-runtime/blob/main/src/sandbox/sandbox-utils.ts). | ||
|
|
||
| The nested `vt` enables fspy for automatic input inference; changing the file read inside the sandbox checks whether it invalidates the cache. | ||
|
|
||
| ## `mkdir -p /tmp/claude` | ||
|
|
||
| create the session temp that Claude Code supplies before sandboxed Bash commands | ||
|
|
||
| ``` | ||
| ``` | ||
|
|
||
| ## `srt --settings claude-code-default-sandbox.json vt run inner` | ||
|
|
||
| **Exit code:** 1 | ||
|
|
||
| ``` | ||
| $ vtt print-file input.txt | ||
| ✗ Failed to set up task communication: Operation not permitted (os error 1) | ||
| ``` | ||
|
|
||
| ## `vtt replace-file-content input.txt tracked modified` | ||
|
|
||
| ``` | ||
| ``` | ||
|
|
||
| ## `srt --settings claude-code-default-sandbox.json vt run inner` | ||
|
|
||
| **Exit code:** 1 | ||
|
|
||
| ``` | ||
| $ vtt print-file input.txt | ||
| ✗ Failed to set up task communication: Operation not permitted (os error 1) | ||
| ``` |
28 changes: 28 additions & 0 deletions
28
...sts/e2e_snapshots/fixtures/sandboxed_fspy/snapshots/fspy_under_codex_sandbox.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # fspy_under_codex_sandbox | ||
|
|
||
| Runs `vt run inner` under Codex CLI's built-in `:workspace` permission profile, representing its default workspace-editing posture for a trusted repository. The profile makes the workspace roots and system temp directories writable without adding network or Unix socket access. See [Codex permissions](https://learn.chatgpt.com/docs/permissions#define-and-select-a-profile). | ||
|
|
||
| The nested `vt` enables fspy for automatic input inference; changing the file read inside the sandbox checks whether it invalidates the cache. | ||
|
|
||
| ## `codex sandbox -P :workspace vt run inner` | ||
|
|
||
| **Exit code:** 1 | ||
|
|
||
| ``` | ||
| $ vtt print-file input.txt | ||
| ✗ Failed to set up task communication: Operation not permitted (os error 1) | ||
|
wan9chi marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| ## `vtt replace-file-content input.txt tracked modified` | ||
|
|
||
| ``` | ||
| ``` | ||
|
|
||
| ## `codex sandbox -P :workspace vt run inner` | ||
|
|
||
| **Exit code:** 1 | ||
|
|
||
| ``` | ||
| $ vtt print-file input.txt | ||
| ✗ Failed to set up task communication: Operation not permitted (os error 1) | ||
| ``` | ||
14 changes: 14 additions & 0 deletions
14
crates/vite_task_bin/tests/e2e_snapshots/fixtures/sandboxed_fspy/vite-task.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "tasks": { | ||
| "inner": { | ||
| "command": "vtt print-file input.txt", | ||
| "cache": true, | ||
| "input": [ | ||
| { | ||
| "auto": true | ||
| } | ||
| ], | ||
| "output": [] | ||
| } | ||
| } | ||
| } |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.