Skip to content

fix(core): unsigned agent commits, and caches for sandboxed workers - #19

Merged
pakgin merged 3 commits into
mainfrom
fix/worker-sandbox
Nov 17, 2026
Merged

pakgin merged 3 commits into
mainfrom
fix/worker-sandbox

Conversation

@pakgin

@pakgin pakgin commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

What

M2's sandbox trial, run on macOS with a real worker session through createClaudeSessionStarter (the bot's own sandbox, guard, tool allowlist, and agent account) in a fresh worktree of the scratch repo. It found two bugs, fixed here, and one decision.

  • The agent's commits were signed with the owner's GPG key. The machine's global git config signs commits, so pakgin-agent's commits on the scratch repo carried the owner's signature (GitHub: signed, unknown_key). This happened with or without the sandbox; inside it, signing failed outright. agentAccountEnvironment now sets commit.gpgsign and tag.gpgsign to false, which wins over the machine's config.
  • npm install couldn't write its cache in ~/.npm. The sandbox is now { cacheDirectory }: that directory is writable inside it, and npm_config_cache, XDG_CACHE_HOME, YARN_CACHE_FOLDER, and PIP_CACHE_DIR point there. The app uses $SUPERAGENT_DATA_DIR/cache.
  • gh can't verify TLS inside the sandbox on macOS (Go asks trustd, which the sandbox blocks), so sandboxed workers can't open pull requests there. The docs say so. enableWeakerNetworkIsolation fixes it (tried: gh api user and gh pr list worked), at the cost the SDK warns of: trustd as a possible exfiltration path. It's the roadmap's open decision 2, left to the owner.

The trial

Command Before After
touch ~/superagent-sandbox-probe refused refused
write in the worktree works works
git commit gpg failed works, unsigned
npm install --no-save left-pad EPERM on ~/.npm works
git ls-remote, git push --dry-run work work
gh api user TLS fails TLS fails (works with weaker network isolation)
curl https://example.com refused by the proxy refused by the proxy

Checks

  • pnpm format, pnpm lint, pnpm typecheck, and pnpm test pass: core 434, agent 20.
  • Mutation checks: removing either signing setting, the cache's write access, or the cache environment fails a test, and so does setting the caches outside the sandbox.

🤖 Generated with Claude Code

pakgin and others added 2 commits November 8, 2026 21:20
The machine's global git config signs commits, and its key is the
owner's, so the agent's commits on the scratch repo carried the owner's
signature: GitHub listed them as signed by a key unknown to pakgin-agent.
A sandbox trial caught it, where signing failed outright because gpg
couldn't reach ~/.gnupg. agentAccountEnvironment now sets commit.gpgsign
and tag.gpgsign to false, which wins over any machine config, so the
agent's commits are unsigned and its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A sandbox trial on macOS: writes outside the worktree and network outside
the allowlist were refused, as meant, but npm install failed on its cache
in ~/.npm, which the sandbox doesn't let workers write. The session
starter now takes the sandbox as { cacheDirectory }, adds that directory
to the sandbox's writable paths, and points npm_config_cache,
XDG_CACHE_HOME, YARN_CACHE_FOLDER, and PIP_CACHE_DIR into it. The app
uses $SUPERAGENT_DATA_DIR/cache and creates it when the sandbox is on.

gh still can't verify TLS inside the sandbox on macOS (Go asks trustd,
which the sandbox blocks), so the docs say workers can't open pull
requests there yet; enableWeakerNetworkIsolation fixes it, at a cost the
roadmap's open decision weighs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pakgin added a commit that referenced this pull request Nov 9, 2026
The sandbox holds on macOS: writes outside the worktree and hosts off the
allowlist were refused. Commits and npm installs failed until #19, which
stops signing the agent's commits with the owner's key and gives package
managers a cache the sandbox lets workers write. gh can't verify TLS
inside it on macOS without enableWeakerNetworkIsolation, which open
decision 2 now weighs, leaning toward turning it on there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous documentation issue is fixed and no new issues were found.

Summary

Turns off commit and tag signing for the agent account and gives sandboxed workers a writable package cache.

  • Agent-account commits and tags are unsigned.
  • Sandboxed workers can install packages without using home caches.

Reviews (2) · Last reviewed commit: "docs(core): show the sandbox option as i..." · Reviewed by Greptile

Greptile on #19: the README still passed sandbox: true, which no longer
typechecks. It now passes { cacheDirectory }, says what the sandbox
writes, that the directory must exist, and the macOS gh limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pakgin
pakgin merged commit 5fbfbab into main Nov 17, 2026
3 checks passed
@pakgin
pakgin deleted the fix/worker-sandbox branch November 17, 2026 21:48
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