Skip to content

fix(agent-isolation): source the clean-env wrapper only from the user-scope copy - #2387

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:fix/agent-iso-source
Nov 26, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
potiuk:fix/agent-iso-source

Conversation

@potiuk

@potiuk potiuk commented Nov 26, 2026

Copy link
Copy Markdown
Member

Summary

The harness pages (Aider, Antigravity, Codex, Copilot, Cursor, Goose, local LLM, Pi, Kiro, OpenCode, and the add-a-harness guide) told the operator to put source <framework>/tools/agent-isolation/agent-iso.sh (or /path/to/magpie/...) in their shell. The rc file runs that script outside every sandbox at each login, and every tree it named can be written by the agents the operator runs there:

  • a framework checkout and a pinned snapshot inside the tracker repo are the agents' own working trees;
  • on a marketplace install, <framework> is ~/.cache/apache-magpie/framework/, which sandboxed commands can write (and which the Claude Code and Codex plugins do not even ship tools/agent-isolation/ into).

An agent that edited that file would get its code run in the operator's next shell. This is the same gap #2383 closed for the gatherer agent.

  • Every harness page now sources the global install, ~/.claude/agent-isolation/agent-iso.sh, with a comment pointing at how it is installed.
  • docs/setup/secure-agent-setup.md makes the global install the one for the secure setup and says why; it is copied once from a checkout whose agent-iso.sh matches upstream. The per-repo example stays, marked as not for the secure setup.
  • Edit(~/.claude/agent-isolation/**) joins the user-scope deny list (in the docs, the framework's own .claude/settings.json and the sandbox-lint baseline), so Claude Code's file tools cannot rewrite the copy; its sandboxed commands already cannot write ~/.claude/.
  • Other harnesses, which ignore that Claude Code rule, keep the copy out of reach as their own pages describe, and the doc now says so: Codex (workspace-write), Goose (the whole process in sandbox-runtime), Antigravity (allowNonWorkspaceAccess: false), OpenCode and Kiro (OS sandbox) keep writes inside the workspace; Pi asks before a native write outside the working folder; Cursor, Copilot and Aider have only their per-write approval prompt, so the doc tells the operator never to approve a write to that folder there.

Type of change

  • Documentation (docs/adapters/, docs/setup/secure-agent-setup.md)
  • Secure setup (.claude/settings.json deny rule, tools/sandbox-lint/expected.json; the secure-setup fingerprint is regenerated)

Test plan

  • prek run --all-files --skip workspace-pytest and prek run workspace-pytest --from-ref origin/main --to-ref HEAD, including the sandbox-lint baseline tests and the lychee link check

RFC-AI-0004 compliance

  • Sandbox: narrows what an agent can change; no new grant.

🤖 Generated with Claude Code

…-scope copy

The harness pages told the operator to source agent-iso.sh from
<framework>/tools/agent-isolation/ or a framework checkout. Their
shell rc file runs it outside every sandbox at each login, and every
one of those trees can be written by the agents they run there: a
framework checkout, a pinned snapshot inside the tracker repo, and
~/.cache/apache-magpie/framework/ on a marketplace install (where it
is not even present for Claude Code or Codex).

- Every harness page now sources ~/.claude/agent-isolation/agent-iso.sh,
  the global install, copied once from a checkout checked against
  upstream.
- secure-agent-setup.md makes the global install the one for the
  secure setup and says why; the per-repo example stays, marked as not
  for it.
- Edit(~/.claude/agent-isolation/**) joins the user-scope deny list,
  in the docs, the framework's own .claude/settings.json and the
  sandbox-lint baseline, so Claude Code's file tools cannot rewrite the
  copy. The doc says what holds it for the other harnesses, which
  ignore that rule: their workspace sandboxes (Codex, Goose,
  Antigravity, OpenCode, Kiro), Pi's ask on writes outside the working
  folder, and the per-write prompt in Cursor, Copilot and Aider.

Generated-by: Claude Opus 5
@potiuk potiuk added family:setup setup-* skills family:docs Docs, MISSION.md, READMEs capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) labels Nov 26, 2026
@potiuk
potiuk enabled auto-merge (squash) November 26, 2026 22:48
@github-actions github-actions Bot added family:tools tools/* substrate:sandbox Tool substrate: agent isolation, egress control, settings audit family:dev Repo dev: .asf.yaml, spec-loop specs, Node manifests, .claude/settings.json labels Nov 26, 2026
@potiuk
potiuk merged commit e36a08e into apache:main Nov 26, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:platform Framework / agent substrate skills (install, verify, doctor, override, status, setup bootstrap) family:dev Repo dev: .asf.yaml, spec-loop specs, Node manifests, .claude/settings.json family:docs Docs, MISSION.md, READMEs family:setup setup-* skills family:tools tools/* substrate:sandbox Tool substrate: agent isolation, egress control, settings audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant