Repository navigation
fix: the agent asks for a folder grant rather than leaving the sandbox command by command - #513
Merged
Merged
Conversation
…x command by command The unsandboxed argument's description sent every write outside the workspaces out of the sandbox and never named add_directory, whose own description fired only on a folder the user named. Both now say a folder the work keeps writing in is add_directory once, and a bash result names the folder and the grant on a second unsandboxed request there in one turn or a sandboxed run there that failed, read off the call's cd and the shell's directory, never its output.
…failure Neither Seatbelt nor Landlock reports a denial, so a confined run's output is read for the kernel's own errno (EPERM, EACCES) naming a path outside every write the sandbox granted. Those paths fill the result's violations, so the model is told the failure was the sandbox's, and they are what the add_directory note names. A command that only failed in an outside folder gets neither.
…e reads it Denials are read where a confined run ends, in LocalShell, so every run under a sandbox reports them, from CommandSandbox.writes, the one list the helpers grant from, and only once the output holds an errno. ShellResult gains a general copyWith, the command's start directory is worked out once, AgentTool.handed is the tool list's predicate, and repositoryRootOf is the .git walk the instructions, worktree grants and the note share.
Merge master (#514): the gate's confinement memo carries where the command starts. The note now skips a call the user denied on the banner, not one a classifier or a rule refused, which a grant is still the way on from.
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.
A chat working in a repository outside the workspace set `unsandboxed` 105 times, raised 72 approval banners, had 12 commands refused in never mode, and never called `add_directory`. The model did what its descriptions told it to: `unsandboxed` said to call again with it set whenever a command had to write elsewhere, and `add_directory` only fired on a folder the user had named.
Descriptions
What the sandbox refused (`lib/domain/sandbox_denials.dart`, read in `LocalShell`)
Neither enforcer reports a denial:
Both leave the kernel's errno in the output: Seatbelt's EPERM ("Operation not permitted") and Landlock's EACCES ("Permission denied"). The output is read where the confined run ends, in `LocalShell`'s one-shot run, so every run under a sandbox reports them on its `ShellResult`. Output with neither errno returns before anything is resolved. A path counts as refused when it:
Those paths fill `violations` (at most five), so the observation says "Denied by the sandbox" and the activity draws its Sandbox row. The model can now tell that the sandbox caused the failure.
The nudge (`tools/grant_nudge.dart`, carried on `ToolResult.notes`)
Also: `ShellResult.copyWith` replaces the hand-written copy. The start directory is worked out once per command and passed to the gate and the run. `AgentTool.handed` is the predicate the tool list is built from, and `grantsDirectories` reads it. `repositoryRootOf` is the `.git` walk shared by the instruction files, a worktree's git directory and the note.
Folders granted up front by project setting are another PR. The `lib/data/builtin/AGENTS.md` sandbox and Approvals sections are updated.
Tests