Repository navigation
fix(agent): tell the user when the sandbox cannot use a toolchain - #566
Merged
Merged
Conversation
Sandboxed commands run through PowerShell inside an AppContainer. When a toolchain folder (for example an admin-owned C:\Python314) cannot be granted read access, the launcher leaves it off the child's PATH, so "python -m pytest" fails with a generic error and nothing says why. The AppContainer launcher now records each folder it could not grant and the allowed tools in it. The shell tool reports each such folder to the user once per run as a Cortex notice in the timeline: the folder, the affected tools, the one-time administrator command that grants ALL APPLICATION PACKAGES read and execute, or a per-user install. The notice never enters the model's context, and which interpreter Cortex picks is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
On a standard Windows install, Python (
C:\Python314) and Node (C:\Program Files\nodejs) live in admin-owned folders that grant read access to Users but not to ALL APPLICATION PACKAGES. The AppContainer launcher cannot grant itself read access there. It logsToolchain ... unavailable (cannot change its ACL)and leaves the folder off the sandboxed child's PATH.Sandboxed commands run through PowerShell, so
python -m pytest(includingrun_checks) then fails with a generic "not recognized" error, and nothing tells the user why. This was seen in a live Agent run and in the benchmark.Decision (maintainer)
Show a clear message only. Do not fall back to a different interpreter.
Change
AppContainerLauncherrecordsunavailable_toolchains: each folder it could not grant, mapped to the allowed tool names found there.AutoLauncherforwards it.ShellToolstakes a newon_noticecallback. After each launch, including a failed one, it reports each unavailable folder once per run, in plain text: the folder, the affected tools, and the one-time administrator commandicacls "<folder>" /grant "*S-1-15-2-1:(OI)(CI)(RX)". S-1-15-2-1 is ALL APPLICATION PACKAGES, and the grant is read and execute only. It also mentions a per-user install as the alternative.AgentRunssends notices asoutput {source: "cortex"}. They are SSE-only and never enter the model's context; the tool result the model sees is unchanged.RunTimelinelabels these entries Cortex notice and shows them open. They are distinct from command output and from the agent's answer.Which interpreter is chosen, ACL handling and sandbox enforcement are all unchanged.
Tests
test_sandbox_appcontainer.py: the launcher names the folder it could not grant, and reports nothing after a successful grant.test_agent_shell_tool.py: one notice per folder per run across two commands, and the host path is not in the model-visible result. A notice is still sent when the launch itself fails.test_agent_runs_wiring.py: a shell notice reaches the run's events assource: "cortex"output.test_agent_security_races.py: itsregister_shell_toolsstand-in takes the newon_noticeargument, matching the real signature. The pre-push run caught the mismatch.RunTimeline.test.tsx: the notice is labelled, open, and not taken for command output or the agent's answer.Risk and rollback
This adds a message only. Rollback is reverting this commit.
🤖 Generated with Claude Code