Skip to content

fix(agent): tell the user when the sandbox cannot use a toolchain - #566

Merged
dovvnloading merged 3 commits into
mainfrom
fix/agent-explain-unavailable-toolchain
Nov 22, 2026
Merged

dovvnloading merged 3 commits into
mainfrom
fix/agent-explain-unavailable-toolchain

Conversation

@dovvnloading

Copy link
Copy Markdown
Owner

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 logs Toolchain ... unavailable (cannot change its ACL) and leaves the folder off the sandboxed child's PATH.

Sandboxed commands run through PowerShell, so python -m pytest (including run_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

  • AppContainerLauncher records unavailable_toolchains: each folder it could not grant, mapped to the allowed tool names found there. AutoLauncher forwards it.
  • ShellTools takes a new on_notice callback. 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 command icacls "<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.
  • AgentRuns sends notices as output {source: "cortex"}. They are SSE-only and never enter the model's context; the tool result the model sees is unchanged.
  • RunTimeline labels 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 as source: "cortex" output.
  • test_agent_security_races.py: its register_shell_tools stand-in takes the new on_notice argument, 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.
  • Focused: the shell, AppContainer, shell-security, wiring and checks suites (139 passed). The RunTimeline tests pass (4). ruff and mypy are clean.

Risk and rollback

This adds a message only. Rollback is reverting this commit.

🤖 Generated with Claude Code

dovvnloading and others added 3 commits November 21, 2026 22:21
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>
@dovvnloading
dovvnloading merged commit 1df9059 into main Nov 22, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant