Skip to content

Role eval: the sandbox keeps runs out of the real home - #590

Merged
lydakis merged 8 commits into
mainfrom
claude/project-thread-hue6af
Nov 1, 2026
Merged

lydakis merged 8 commits into
mainfrom
claude/project-thread-hue6af

Conversation

@lydakis

@lydakis lydakis commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Refs #521. That issue stays open until a live run on the Mac shows an empty outside.txt.

Why

bench/role_eval.py answered every permission ask with allow. The sandbox asks exactly when a call would leave it, so a fake HOME did not keep agents out of the real one. In run A1, an S1 backup landed in the owner's real ~/Backups/shop.

The first version of this PR scanned each command for paths into the real home. Review showed that can't work: a command can build the path at run time, for example Python reading the home folder from the user database. So the sandbox itself is now the boundary.

What

  • An eval permissions row. Runs start with default_permissions = "eval", which extends ask. The sandbox writes the agents' own folders plus the run's backups and origin.git. It does not write the whole run, because the run's copy of the build lives there. The network is off, so no Unix socket is reachable: with the network on, a Docker socket would let a bot write anywhere.
  • Every call that would leave the sandbox comes to the eval. The lead's calls arrive through ACP and tasks' calls through agent answer. The eval allows a call only when its effects provably stay in the run: one plain call of ~/.agent/trigger or ~/.agent/memory, which write only under the run's HOME, with no shell operators, $ expansions, backticks or line breaks. Everything else is denied, including calls listed cut or offered only to deny. Each answer is logged to acp.jsonl.
  • An after-run check. At the end of every run, changed_outside lists what changed in the real home. It looks three levels down and skips hidden folders, Library and the run's root. The list goes to outside.txt and is reported on stderr.
  • docs/ROLE_EVAL.md and the module docstring describe the boundary.

What this changes in the eval: the run's agents now get ask-style approvals answered by the eval, not the default auto row with a model reviewer. They also run with the network off. The model reviewer can approve unconfined calls by itself, so leaving it in charge would not give a boundary. The day's work needs neither: commits are allowed by the row's git, the backup and pushes go to writable folders, and triggers and memory go through the allowed scripts.

Tests

python3 -m unittest tests.test_role_eval passes (7 tests):

  • Allowed: plain ~/.agent/trigger and ~/.agent/memory calls, in both the ACP and the agent answer shapes.
  • Denied: mkdir ~/Backups, cd /Users && mkdir me/..., a Python pwd.getpwuid home path, operators, $(...), backticks, redirects, line breaks, environment prefixes, git push, write calls, and cut arguments.
  • Config: the run's config holds the eval row.
  • After-run check: changed_outside finds a new Backups/shop.git and ignores noise.

This has not been run against live models; the next role eval on the Mac exercises it. #594 is a do-not-merge PR that gets this design a security review.

🤖 Generated with Claude Code

The eval answered every ask with allow, and the sandbox asks exactly
before a write outside the run, so a fake HOME did not keep agents out of
the real one: an S1 backup landed in the owner's ~/Backups. The ACP
client and allow_waiting now deny a call that names a path in the real
home outside the run's root, and allow the rest as before (escalations
with no path, system paths, anything in the run). After each run, what
changed in the real home a few levels down (past hidden folders and
Library) goes to outside.txt and is said on stderr.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrVNEpqFFEqPCMbC2
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T07:48:09.440980Z 9cba023 New commits
🔒 Security Review ✅ Completed 2026-11-01T07:08:37.777773Z 9e4a6d0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e4a6d0f6c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bench/role_eval.py Resolved
Comment thread bench/role_eval.py Resolved
A command's write targets can't be read from its words, so the check now
denies what could reach the real home rather than only literal paths in
it: a folder above it (cd /Users && mkdir me/x), a `..` that climbs out
of the run from its shallowest folder, a `~name`, and a call listed cut
(task asks whose arguments were bounded) or one Sonny offered only to deny.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrVNEpqFFEqPCMbC2
…scripts

Scanning a command's words can't stop a path built at run time (a Python
call reading the real home from the user database), so the path check was
a mitigation, not isolation. Runs now use an `eval` permissions row: the
sandbox writes the agents' folders plus the run's backups and origin, the
network (and with it every Unix socket) is off, and every call that would
leave the sandbox comes to the eval, which allows only one plain call of
~/.agent/trigger or ~/.agent/memory (no operators, expansions or line
breaks) and denies the rest, logging each answer. outside.txt stays as the
after-run check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrVNEpqFFEqPCMbC2
@lydakis lydakis changed the title Role eval: allowed calls may not reach the real home Role eval: the sandbox keeps runs out of the real home Nov 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e5e9612be3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bench/role_eval.py Resolved
Comment thread bench/role_eval.py Resolved
Comment thread bench/role_eval.py Resolved
An approved `~/.agent/trigger add --if CMD` ran CMD in the scheduler,
outside every sandbox. The eval now allows each script's verbs with only
the flags that run nothing else: no `--if`, no `--start`, no
`memory schedule` or `cleanup`.

Runs lived under /tmp/role, which every sandbox writes, so an agent could
replace the run's copy of the build, its sources' script, or another run.
They now live under ~/.role-eval.

Refs #521

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrVNEpqFFEqPCMbC2
The eval row's reviewer is the person, so a task's call parks until the
eval answers it. Only settling answered them, after the lead's prompt
returned, so a lead waiting on a task before answering waited out the
prompt. Acp.ask now serves them every few seconds while a request is out.

Refs #521

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrVNEpqFFEqPCMbC2

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9edbf43ca9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bench/role_eval.py Resolved
shlex read `{watch,--if,'cmd'}` as one name, but Bash expands it into
`--if cmd`. The allowlist now tokenizes the command itself and refuses
anything Bash would expand, substitute or redirect: outside quotes a word
holds only letters, digits and `_./:,@%+-`; double quotes refuse `$`, a
backtick, a backslash and `!`.

Refs #521

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrVNEpqFFEqPCMbC2
The eval row extends `ask`, so start_task, subscriptions and triggers wait
on the eval, which denied every call but a shell one: the lead could not
delegate or subscribe, and the scores would have measured the harness. The
eval now allows a task started in the lead's folder (its setup is the
lead's read-only .agents/setup), a removal, a subscription and a trigger
without `if` or `start`; new projects, panes, scripts, goals and the
browser stay denied.

Refs #521

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrVNEpqFFEqPCMbC2

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44cd204b77

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bench/role_eval.py Resolved
Sonny runs `git worktree add` outside the sandbox in the folder's
repository, and a repository an agent made inside the lead's has hooks,
config and filters the agent wrote. The day needs no folder, so a start
naming one is denied (#597 tracks it in Sonny).

Refs #521

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrVNEpqFFEqPCMbC2
@lydakis
lydakis merged commit b2314dc into main Nov 1, 2026
9 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.

2 participants