Skip to content

PAN-5754 - #5993

Open
eltmon wants to merge 129 commits into
mainfrom
feature/pan-5754
Open

eltmon wants to merge 129 commits into
mainfrom
feature/pan-5754

Conversation

@eltmon

@eltmon eltmon commented Dec 4, 2026 •

Copy link
Copy Markdown
Owner

Scope: layer 1. Except for the residual risks listed in configuration/agent-isolation.mdx, this PR stops an isolated Claude Code pipeline agent's own tool calls from reading operator credentials or reaching operator-only services. It does not yet stop Overdeck itself from running agent-edited files outside the sandbox (the verification gate, workspace installs, the pan reload build), and it does not sandbox agents on harnesses other than Claude Code. Those are epic #6004.

Important

Rollout requirement (Linux): isolated Claude Code agents run inside Claude Code's OS sandbox, which needs bwrap (package bubblewrap) and socat. Install both on every Linux host before this deploys, or every isolated Claude Code agent (work, review, test, plan, …) is refused at launch:

  • Debian/Ubuntu: sudo apt-get install bubblewrap socat
  • Fedora/RHEL: sudo dnf install bubblewrap socat
  • Arch: sudo pacman -S bubblewrap socat
  • openSUSE: sudo zypper install bubblewrap socat · Alpine: sudo apk add bubblewrap socat

Escape hatch: agents.isolation.enabled: false in ~/.overdeck/config.yaml keeps the old behaviour. pan install, pan sync and pan doctor warn when either binary is missing and print the command for the host's distribution. This dev host currently lacks socat.

Push credentials: sandboxed agents push over https through the gh credential helper (gh auth setup-git). ssh remotes, the ssh agent and keyring helpers (libsecret, credential-cache) do not work inside the sandbox; pan doctor warns for each registered project whose agents could not push.

Partly verified live: a full isolated agent launch was not run (this host has no socat). The review-fix pass ran the rendered isolation settings of a real worktree through claude -p --settings with a scratch socat (probes P25–P33 in docs/AGENT-ISOLATION.md): git commit, fetch, merge and push, the CLI transport through the sandbox proxy, and the file and socket denies. Open gaps and residual risks R-1 to R-13 (follow-ups #5996, #5997, #5998, #6002) are documented in configuration/agent-isolation.mdx.

Issue: #5754

Acceptance Criteria

  • Add agents.isolation config and the isolated-role predicate
  • Move agent tokens under agent-tokens/ and add a fail-closed isolation mint
  • Build the pure isolation policy and its input resolver
  • Render the Claude Code isolation settings file
  • Add the agent-isolation-guard PreToolUse hook
  • Wire isolation into the launcher (settings flag, env, root registration)
  • Spread prepareAgentIsolation at the agent spawn, recovery and resume sites
  • Spread prepareAgentIsolation at the planning and conversation launch sites
  • Serve the dashboard HTTP app on the agent Unix socket
  • Add the isolated-context credential and transport helper
  • Route CLI-side dashboard calls through the credential helper
  • Use the agent token in the in-pane memory hook, Codex prompt memory and Channels bridge
  • Make the Claude Code hook scripts use the agent token
  • Let hook and self-report routes accept an agent token that speaks for itself
  • Add route-scope rows for agent-callable routes
  • Add POST /api/self/cli, the forwarded-verb table and the CLI forwarder
  • Forward tell, ask and sync-main for isolated agents
  • Forward plan finalize and the review/test verdict verbs
  • Forward swarm, worker, backlog and knowledge verbs
  • Refuse local trust to connections owned by an isolated process tree
  • Stop trusting uncredentialed Traefik-forwarded requests while isolation is on
  • Make gate admission tolerant of PID namespaces
  • Clamp isolated Codex launches to workspace-write
  • Declare each harness's isolation class and report it in pan doctor
  • Document agent isolation for users and developers
  • Make the pi extension authenticate with the agent token
  • Let the pi extension's control-ack and auto-complete routes accept a self agent token
  • Prove every agent-facing pan verb is forwarded or known-local
  • Prepare isolation inside every runtime spawnAgent (crash recovery, rotation, Codex and the other runtimes)

🤖 Generated with Claude Code

overdeck-agent[bot] and others added 30 commits December 3, 2026 15:49
Plan-Finalized: 4bc96701b264c44addc3b284a940ec06706bd414bfc5cf9f8a60e68a8ea5da2d
Overdeck-Agent: agent-pan-5754
PAN-5754 WI-1. agents.isolation.{enabled, allow_docker, allow_write} is read
from the global config.yaml only (loadGlobalConfig is now exported for that);
stripProjectSecurity drops agents.isolation from .pan.yaml and keeps the other
agents keys. isIsolatedTokenRole is false only for conversation and flywheel.
paths.ts holds the agent-tokens, isolation and agent-socket locations and the
isolation env var names.

Item: iso-config
Item: iso-config.ac1
Item: iso-config.ac2
Item: iso-config.ac3
Item: iso-config.ac4
Item: iso-config.ac5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
…sed isolation mint

PAN-5754 WI-2. An owner's token now lives at
<home>/agent-tokens/<kind>/<id>/mcp-token (directory 0700, file 0600), so the
sandbox can deny agent-tokens/ and re-allow only the owner's own directory.
agentMcpTokenPath(dir) becomes agentMcpTokenPathFor({ agentId, agentKind }),
which refuses an owner id that is not one path segment. Revoke unlinks the new
file and the legacy <dir>/mcp-token. ensureIsolationToken mints regardless of
the MCP switch and rethrows a failure as 'agent isolation: token mint failed
for <id>: ...'.

Tests that asserted the old <owner dir>/mcp-token location now assert the new one.

Item: token-location
Item: token-location.ac1
Item: token-location.ac2
Item: token-location.ac3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
…lver

PAN-5754 WI-3. buildIsolationPolicy turns one launch's paths into the D-8
policy: the operator secret set and the masked socket dirs (Herdr, tmux,
~/.overdeck/sockets, the user runtime dir, X11, Docker unless allow_docker)
are denied for read and write; the owner's own token dir is re-allowed; writes
are allowed only to the workspace, /tmp, the git common dirs, the DB files,
logs/, tmp/ and the admission queue inside OVERDECK_HOME, the caches present
at launch and allow_write. Workspace .git files, .claude/, .mcp.json, git
hooks/config and cache executable dirs are write-denied.

Deviation: the input carries repoRoots (workspace plus polyrepo child repos)
so each child's .git file is write-denied too, and drops the unused uid
(the resolver uses it to find the tmux socket dir).

Item: iso-policy
Item: iso-policy.ac1
Item: iso-policy.ac2
Item: iso-policy.ac3
Item: iso-policy.ac4
Item: iso-policy.ac5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
PAN-5754 WI-4. renderIsolationClaudeSettings turns the isolation policy into
the --settings file: sandbox enabled with failIfUnavailable, no unsandboxed
retry, auto-allowed sandboxed Bash, all Unix sockets (the policy's masks block
the terminal-backend ones) and every domain; Read(//...) and Edit(//...) deny
rules for each denied path, bare and /** so files and directories both match;
and the PreToolUse write guard hook with the policy file. writeIsolationFiles
writes claude-settings.json and policy.json (0600) under
<home>/isolation/<kind>/<id>/ (0700).

Item: claude-settings
Item: claude-settings.ac1
Item: claude-settings.ac2
Item: claude-settings.ac3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
PAN-5754 WI-5. Claude Code's sandbox covers Bash only, so this hook keeps
Edit, Write, MultiEdit and NotebookEdit inside the isolation policy: it
resolves the target with realpath -m (a symlink is judged by its
destination), allows a path under an allowWrite root and no denyWrite root,
and otherwise prints a PreToolUse deny. A missing or invalid policy, a
missing jq or a payload with no path all deny. pan sync already installs
every file in sync-sources/hooks/ to ~/.overdeck/bin.

Item: write-guard-hook
Item: write-guard-hook.ac1
Item: write-guard-hook.ac2
Item: write-guard-hook.ac3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
PAN-5754 iso-policy follow-up. buildIsolationPolicy write-denied <root>/.git
for every repo root, but in a plain clone that path is the git common dir it
also allows, and a deny wins, so the agent could not commit. Only a .git that
is not a common dir (a worktree pointer file) is denied now; the common dir's
hooks/ and config stay denied. resolveIsolationPolicyInput also takes the
global config layer, so callers and tests pass their own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754 write-guard-hook follow-up. BSD realpath (macOS) has no -m, and the
guard fails closed, so it would have denied every edit there. It now falls
back to a node one-liner that canonicalizes the longest existing prefix and
keeps the missing tail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754 WI-6. prepareAgentIsolation returns {} for conversations, the
Flywheel and when agents.isolation.enabled is false. Otherwise it fails
closed: a Linux claude-code launch without bwrap or socat is refused with the
D-12 install hint, then ensureIsolationToken mints (and throws on failure),
the policy is built and, for claude-code, the settings and policy files are
written. LauncherConfig.isolation adds, before cd: mkdir of the masked socket
dirs, the OVERDECK_AGENT_TOKEN_FILE / OVERDECK_DASHBOARD_SOCKET /
OVERDECK_ISOLATED / NODE_USE_ENV_PROXY exports, unset OVERDECK_INTERNAL_TOKEN
and the root-registry line (pid + /proc start time). Claude commands get
--settings "$PAN_ISO_SETTINGS". The review sub-role's post-exit pan tell and
pan admin agents exited run under env -u OVERDECK_AGENT_TOKEN_FILE (D-15).

Deviation: skill overrides already pass --settings "$PAN_SKILL_SETTINGS", and
Claude Code keeps one --settings value. The launcher folds the skill JSON into
a per-launch copy of the isolation settings (arrays concatenated, isolation
scalars win) and clears PAN_SKILL_SETTINGS; a failed merge keeps the isolation
file alone, so the sandbox is never dropped. Helpers live in
agent-isolation/launcher-lines.ts to keep launcher-generator.ts under its cap.

Item: launch-isolation
Item: launch-isolation.ac1
Item: launch-isolation.ac2
Item: launch-isolation.ac3
Item: launch-isolation.ac4
Item: launch-isolation.ac5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
PAN-5754 launch-isolation follow-up. The bwrap/socat check now uses the
cached resolveHostTool lookup (bwrap and socat join HostToolName) instead of
its own PATH scan, so it shares the PATH-only, no-spawn lookup and the test
convention (OVERDECK_TEST_ASSUME_HOST_TOOLS; setHostToolFinderForTests) with
every other host tool probe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
PAN-5754 WI-23 (D-13). codexLaunchPermissions maps codex.permissionMode to
the Codex home's approval policy, sandbox mode and reviewer, and turns
full-access into workspace for an isolated launch. getCodexLauncherFields uses
it with the role's isolation; conversation-runtime uses it with the
conversation's token role, so a lane conversation (token role worker) is
clamped too while operator conversations keep their configured mode. The
mapping was duplicated in both files; it now lives once.

CP-5: codex-cli 0.173 offers named permission profiles and extra readable
roots but no setting that denies reads of given paths, so isolated Codex
agents can still read the operator secret set (class write-sandbox). Recorded
in agent-isolation/codex.ts.

Item: codex-clamp
Item: codex-clamp.ac1
Item: codex-clamp.ac2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
PAN-5754 WI-7. prepareAgentLaunchAccess returns the overdeck MCP launcher
fields plus prepareAgentIsolation's, so a site cannot wire one without the
other. spawn.ts (spawnRun), spawn-prep.ts (buildAgentLaunchConfig, fresh and
resume), recovery.ts and messaging.ts (fresh-launch fallback) call it in
place of prepareClaudeOverdeckMcp. An isolation error (missing sandbox
prerequisite, failed mint) throws, so the spawn fails like a missing binary.
Every spawn-path test file (60) passes with isolation on by default.

Item: launch-sites-agents
Item: launch-sites-agents.ac1
Item: launch-sites-agents.ac2
Item: launch-sites-agents.ac3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
Overdeck-Agent: agent-pan-5754
…sites

PAN-5754 WI-8. spawn-planning-session.ts and the planning continuation route
(routes/misc/planning.ts) launch the planner (role plan, isolated) through
prepareAgentLaunchAccess. conversation-runtime.ts does the same for a
conversation with a row, using its token role: a plain operator conversation
(token role conversation) gets no isolation fields (FR-11), and a lane
conversation (token role worker) gets the --settings file and its own token.

Deviation: the conversation cases are asserted in the existing
conversation-runtime-launch.test.ts (which already mocks the launch stack)
instead of a new conversation-isolation.test.ts. planning-routes.test.ts
asserted the pre-WI-2 <agent dir>/mcp-token path; it now asserts the
agent-tokens location and the planner's isolation.

Item: launch-sites-planning-conv
Item: launch-sites-planning-conv.ac1
Item: launch-sites-planning-conv.ac2
Item: launch-sites-planning-conv.ac3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
overdeck-agent[bot] and others added 14 commits December 3, 2026 21:19
PAN-5754. With unix sockets denied in the sandbox, an isolated CLI call
falls back to the sandbox's HTTP proxy, with the proxy's credentials and
the agent token, before plain TCP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754. An isolated-role token is refused on terminal attach,
conversation creates and operator-wide writes, and may message or change
only itself, its parent, what it started and its own issue's agents.
Forwarded tell checks the same rule and drops --steer; memory writes are
project-only; a self handoff pins the caller's role and issue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754. A failed peer lookup marks the connection as an isolated
agent's, and a request carrying an agent token is judged by that token
whatever its peer. The fd scan reads links in parallel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754. The dashboard sets core.hooksPath=/dev/null and
core.fsmonitor=false through GIT_CONFIG_COUNT for itself and its
children. Terminal panes start without it, so agents' own commits still
run the project's hooks in their sandbox.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754. pan doctor warns for each registered project whose origin no
credential helper allowed in the sandbox can push to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754. Token fence, socket default, private caches, git guard, push
credentials, probes P25-P28, and residuals R-10 to R-12 with follow-ups
#5996, #5997 and #5998.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
… file

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754 CI fix. An isolated agent writes project memory only, so the
round trip that writes a user fact runs with isolation switched off; the
isolated refusal is covered in self-memory.test.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
…to Bash

PAN-5754. Claude Code mounts a worktree's shared git dir writable, so the
policy denies every entry present at launch by name except object, ref
and reflog data and the agent's own worktree dir, and pre-creates the
shared per-worktree config. Package cache variables now reach only
sandboxed Bash commands through CLAUDE_ENV_FILE, never hooks or MCP
servers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754. Isolated tokens start workers and lanes only through their own
doors, on this machine, with a harness or model that runs in an OS
sandbox; the bare and fleet start routes are fenced, and so are worker
and lane stops outside the allowed targets. A forwarded tell runs with
the target id the fence approved. A test classifies every write route an
agent token reaches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754. The app server's agents run the repository's hooks for their
own commits, as pane agents do. Adds a test that the dashboard applies
the guard at startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754. Probes P29-P33, the git dir denies, cache variables via
CLAUDE_ENV_FILE, the tsx CLI under denied sockets, start-route limits,
and residual R-13 with follow-up #6002.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754

@overdeck-agent overdeck-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

review verdict: passed

Prior blocker fixed: isolated-agent fence closes /ws/terminal, conversation starts and unpinned handoff; caches/memory advisories fixed; CI shards pending; socat install needed before deploy

@eltmon

eltmon commented Dec 4, 2026

Copy link
Copy Markdown
Owner Author

Flywheel review: CHANGES REQUESTED

Head reviewed: a80da5709e3. The branch has since moved to ca636f27cfe, a merge of origin/main that changes no isolation file. The one route the merge adds (POST /api/merge-train/generations/:name/void) needs admin, which agent tokens never hold.

Most of the last round is fixed, and the fixes I checked each have a test that would fail if the fix were reverted:

  • Unix sockets are denied by default.
  • Package caches are private per agent, and the shared caches are read-only.
  • Overdeck's databases can no longer be read or written.
  • Forwarded tell targets are fenced and --steer is dropped.
  • Forwarded memory writes are limited to the project store.
  • The isolated-agent fence has a test that checks every operate and tell route.
  • The peer check fails closed.
  • The home credential deny list is wider.
  • pan doctor checks for a usable push credential.
  • A real-git test covers the dashboard's git guard.

What still blocks is the shared git directory. I reproduced each point in throwaway repositories only, not on the live system.

Blocking

  1. The shared object store can still be altered. GIT_COMMON_WRITABLE_ENTRIES (src/lib/agent-isolation/policy.ts:128) keeps the object data writable, which the agent's own commits need. Git does not re-verify stored objects on checkout, so a checkout of a SHA verified as CI-green can still produce content the agent supplied. pan reload builds the dashboard from a worktree of the operator's repository (src/lib/deploy/build-from-origin.ts:399). Agent workspaces need their own writable object store, with the operator's store read-only to them. Alternatively, the build and the operator's checkout must stop sharing an object store with agent workspaces. The last review's notes treated the object data as safe to keep writable. That was a gap in the review, not a failed fix.
  2. R-13 is not only a residual. The agent can add one top-level entry to the shared git directory that changes how git behaves in the primary checkout. Git runs there outside any sandbox, including pan reload's fetch (build-from-origin.ts:346). The dashboard guard (src/lib/git-repo-exec-guard.ts:15) removes only hooks and the fsmonitor command, which does not cover this. The likely fix is a placeholder file in the shared git directory. I left the details out of this thread.

Should fix

  1. Widen the dashboard git guard beyond hooks and fsmonitor. Repository config can name other commands too. The guard also applies only inside the dashboard process. A pan command or plain git that the operator or the Flywheel runs in an agent workspace still runs that workspace's hooks, so either guard it as well or document it.
  2. Forwarded pan done resumes a rebase outside the sandbox (src/lib/rebase-helper.ts:256). It reads rebase state from the agent's own worktree git dir, which stays writable. Not reproduced. Please make sure that step cannot run commands taken from that state.
  3. The home credential deny list (policy.ts:104) misses common credential stores. Package-registry tokens, other cloud CLIs, other forge CLIs, backup tools and GPG private keys are not covered. Please extend it, or deny ~/.config by default and allow only what agents need.
  4. Role prompts still tell isolated agents to message the Flywheel. roles/work.md, test.md, strike.md, plan.md and review.md all do, and the new tell fence refuses those targets. Please switch them to the fallback (pan ask or an issue comment).

On the listed deviations

  • Narrowed tell targets: acceptable once item 6 is done.
  • R-13 as a residual: not acceptable. See item 2.
  • Unix sockets denied (the tsx CLI and packed-branch deletion fail in the sandbox): acceptable and documented.
  • Dashboard git skips all repository hooks: acceptable. Hooks were never a control against the agent, and the agent's own commits still run them in its sandbox.
  • Isolated callers cannot pick the machine, placement, harness or model: acceptable. Only os-sandbox harnesses pass this check.
  • Advisories left open (peer-check cost, first-turn hook refusal, contracts test include): acceptable as follow-ups. Please confirm CI runs packages/contracts tests, since that file is outside the root Vitest include.
  • No full isolated launch yet: isolation defaults to on, so a full launch on a host with socat (CP-1) should be a precondition for merging or deploying.

Verified

  • Touched tests, run on an exported copy of a80da57: 44 files and 713 tests passed under the root config. packages/contracts/src/harness-behavior.test.ts passed 50/50 under its own config.
  • CI on ca636f27cfe: at the time of writing, 14 checks passed, 6 were pending and none had failed.

overdeck-agent[bot] and others added 6 commits December 3, 2026 22:18
…Flywheel tell

PAN-5754. Plan, work, review, test and strike agents are isolated, and an
isolated agent's tell reaches only its own issue's agents, its parent and
the agents it started, so a tell to the Flywheel is refused. The role
prompts now raise a stall with pan ask (the Needs-you list the Flywheel
reads) and record a push-back as an issue comment. pan ask is forwarded
for plan, review and test as well as work and strike.

Prompt-Change: pipeline role prompts escalate with pan ask, not pan tell conv-flywheel

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754. Adds npm, doctl, glab, wrangler, restic, rclone, sentry, gnupg
and codex credential locations to the home entries an isolated Claude
Code agent cannot read, when present at launch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754. pan done runs outside the agent's sandbox, and a workspace's
rebase state is agent-writable. The rebase helper now refuses to act while
any rebase is already in progress, and before rebase --continue it checks
that the state names the onto and original head it began with and holds
only pick steps; otherwise it aborts with an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754. The launcher creates <commondir>/commondir containing "." when
it is missing, the same way it creates config.worktree: never
overwriting an existing file and never through a symlink. "." names the
git dir itself, so git behaves as before, and the policy can then deny
the file. No shallow placeholder is created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
PAN-5754. The user page, developer notes and changelog now say plainly
that this layer stops an isolated agent's own tool calls from reading
operator credentials or reaching operator-only services, and that it does
not yet cover Overdeck processes that run agent-edited files outside the
sandbox or agents on other harnesses (epic #6004). Documents the commondir
placeholder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
… file

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
@eltmon

eltmon commented Dec 4, 2026

Copy link
Copy Markdown
Owner Author

Flywheel review: CHANGES REQUESTED

Head reviewed: 2912d16fcc9, judged as layer 1. Layer 1 means an isolated agent's own tool calls cannot read operator credentials or reach operator-only services. Escapes through processes Overdeck runs outside the sandbox are out of scope (epic #6004). This round I looked for two things: whether the docs overclaim, and whether anything gets worse than on main.

This round's commits look right:

  • the extra home credential read-denies;
  • the role prompts escalating with pan ask, with --option values, and an issue comment;
  • the . placeholder for commondir, created with noclobber so it never replaces an existing file or follows a symlink;
  • pan done refusing to touch a rebase it didn't start.

One change, older than this round, is worse than main. Two doc sentences also need tightening.

Blocking

  1. The launcher turns on git rerere in repositories where it is off. buildIsolationPolicy adds <commondir>/rr-cache to mkdirBeforeLaunch (src/lib/agent-isolation/policy.ts:211) and keeps it writable (:148). When rerere.enabled is unset, git enables rerere whenever an rr-cache directory exists. I confirmed this in a throwaway repo.
    • Effect: the first isolated launch in a project quietly turns rerere on for that whole repository. That covers the operator's checkout, the dashboard's merges and UAT assembly, and their recorded resolutions then come from a directory the agent can write.
    • Most locally registered repositories leave rerere unset. This one sets it explicitly, so it isn't affected.
    • This has been in the policy since a80da57. Earlier rounds of this review missed it.
    • Fix: don't create rr-cache, and make it writable only where it already exists.
  2. Two sentences in the docs overclaim.
    • configuration/agent-isolation.mdx, intro: "Agent isolation closes those paths for pipeline agents." That isn't true for agents on non-Claude harnesses, which can still read internal-token. Please say "for Claude Code pipeline agents", or point to the layer-1 section.
    • The layer-1 sentence (also in the PR body and docs/AGENT-ISOLATION.md): "stops an isolated agent's own tool calls from reading your credentials or reaching services only you should reach". R-7 to R-10 on the same page are exceptions to that: the gh token, config.yaml keys, other agents' files and other loopback services. Please say "except the residual risks listed below".

Should fix

  1. Refuse an existing commondir that is not . (deviation c). The placeholder never overwrites, so a commondir that already exists with other content, or as a non-regular file, gets locked in place instead of flagged. It should never exist in a primary git dir. Since the PR is going back anyway, have prepareAgentIsolation refuse the launch with a clear reason and pan doctor report it.
  2. pan done still has a check-then-use window. It checks the rebase state, then runs checkout --ours, add and rebase --continue (src/lib/rebase-helper.ts), and the state can change in between. This belongs to Agent isolation layer 2: no operator-authority process consumes agent-writable input #6004.

Deviations

  • (a) pan ask for the plan, review and test roles: fine. It writes an operator decision to the caller's own issue journal, and issuePositional must match the caller's issue. Two side effects:
    • the question text reaches the Needs-you list, which the operator and the Flywheel read;
    • any agent of the issue can supersede or withdraw the issue's open decision. Those agents can already write that journal file in the shared workspace.
  • (b) Rebase guard: correct. The in-progress check now runs before the already-rebased path. main has this bug today: the new rebase-helper-state.test.ts fails against main's rebase-helper.ts, which reports success and pushes the half-rebased HEAD. Through pan done it only triggers when the clean-tree preflight passes, for example a cleanly paused rebase or --force.
  • (c) See item 3.
  • (d) --ours keeps the target branch's copy during a rebase. The code comment says "local wins", but in a rebase "ours" is the target branch, so a conflicting .pan file reverts to main's copy and that commit's planning edits are silently dropped. The comment's "never shared in main" premise is also stale. Not a security issue; please file it as a follow-up.

Confirmed

  • Shared git dir: isolation adds the empty config.worktree, the commondir placeholder and rr-cache (item 1). Nothing else.
  • Role prompts: no prompt or skill tells an isolated role to tell conv-flywheel anymore.
    • Handoff successors default to role conversation, which is not isolated, so they can still tell it.
    • An isolated handoff can still tell its parent conversation, because the fence reads parentConversationName. A --fresh handoff has no parent and uses pan ask instead.
  • New denies:
    • Public-registry npm install works; private-registry tokens in ~/.npmrc are out of reach in the sandbox, as documented.
    • Https push goes through the gh credential helper, which stays readable.
    • Agents with ssh remotes cannot push from inside the sandbox. This is documented, and pan doctor warns. The forwarded pan done pushes outside the sandbox.
    • No commit.gpgSign is set, so the ~/.gnupg deny breaks nothing.
  • Tests: on an exported copy of 2912d16fcc9, 47 touched test files passed (729 tests) under the root config. packages/contracts/src/harness-behavior.test.ts passed 50/50 under its own config.
  • CI on 2912d16fcc9: 13 checks passed and 7 were still pending at posting (four test shards, e2e, the bare-host lanes and the flake lane); none had failed.
  • Before merge: a full isolated launch on a host with socat (CP-1) is still required.

overdeck-agent[bot] and others added 4 commits December 3, 2026 22:50
PAN-5754. The launcher no longer creates <commondir>/rr-cache, and an
existing one is denied like any other shared git dir entry. The agent's
sandboxed git runs with rerere.enabled=false, appended through the Bash
env file after the GIT_CONFIG_* entries already set, so it never tries to
write rr-cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
…ign commondir

PAN-5754. If <commondir>/commondir exists and is not a regular file
holding exactly ".", the placeholder the launcher creates, isolated
launches in that repository are refused with a clear reason before any
token is minted, and pan doctor reports it as an error per project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754
…iduals

PAN-5754. The user page, developer notes and changelog now say "Claude
Code pipeline agents" and qualify each layer-1 statement with the
residual risks. Documents the commondir refusal and the rerere setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Overdeck-Agent: agent-pan-5754

@overdeck-agent overdeck-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

review verdict: passed

New commits verified: pan ask escalation, rebase-state check, commondir placeholder/check, rr-cache deny, more home creds denied, scoped docs; focused tests green; CI on this head pending; socat needed before deploy

@eltmon

eltmon commented Dec 4, 2026

Copy link
Copy Markdown
Owner Author

Flywheel review: CHANGES REQUESTED

Head reviewed: c48a793940f. Scope: 2912d16fcc9..c48a793940f, which covers 59722fa, 51efe95 and 7170a1b, plus the origin/main merge. That merge touches no isolation files: its changes are the PAN-5990 reaper, forge and workspace files only. CI is green on this head.

Required

1. The pan doctor shared-git-dir row never reports the case it is for.

  • registeredProjectGitDirs gets each project's shared git dir by running git rev-parse --git-common-dir in the primary checkout. That resolution goes through the same commondir file the check is meant to inspect.
  • When the file is present and is not the placeholder, the result is one of two things: the check inspects a different directory, or the rev-parse fails and the catch drops the project. Either way, no row is reported.
  • The new doctor test injects sharedGitDirs, so the default resolver is never exercised.
  • Suggested fix: inspect <project>/.git/commondir directly, or use --git-dir from the primary checkout, which does not depend on that file. Add a real-git test of the default resolver with a non-placeholder file present.
  • The launch check has the same dependency on how the path is resolved. From a linked worktree it resolves correctly, and every launch path I traced (work, plan, worker) runs in a linked worktree, so this is not blocking there. To make the launch check independent of the cwd, it could also check <gitDir>/commondir for any git dir that is not under <commonDir>/worktrees/.

Should fix

2. A refused launch still mints a token. At the real launch sites, prepareAgentLaunchAccess runs prepareClaudeOverdeckMcp before prepareAgentIsolation, and the first one mints the agent's token through ensureAgentMcpToken. A refused launch therefore still leaves a minted token behind. The unit test checks only that ensureIsolationToken was not called. Either run the commondir check before the MCP prep, or revoke the token when a launch is refused. This does not open a path through the boundary, because other agents' token files are read-denied, but it contradicts "before any token is minted".

Nits

  • Env file dedupe. renderSandboxGitConfig skips the append when the key is already present, whatever its value, so an inherited rerere.enabled=true entry would be kept. Two fixes work:
    • match on key and value;
    • always append, since a later GIT_CONFIG_KEY_n wins. Sourcing the file twice is then still harmless.
  • Doctor fix text. echo . > commondir writes a trailing newline. The check accepts exactly ., so it refuses that file, while git itself trims the newline. Either accept a single trailing newline or say printf . in the fix text.
  • Docs wording. "the agent's git runs with rerere.enabled=false, so it never writes one" is accurate for git with the default env. A new top-level entry in the shared git dir is still possible under R-13, so name directories as well as files in R-13, or soften that sentence.

Verified

  • Index-correct append. The env file reads GIT_CONFIG_COUNT as n, writes GIT_CONFIG_KEY_n and GIT_CONFIG_VALUE_n, and sets the count to n+1. Existing entries are kept. The new test covers a pre-set entry and sourcing the file twice.
  • Reach. The setting reaches every sandboxed Bash command through CLAUDE_ENV_FILE, and the git hooks those commands run inherit it. If the agent overrides it, git only fails to write the denied rr-cache. In git that error is not fatal and the merge continues, which is acceptable.
  • Merge and rebase with rerere disabled. I checked this with plain git in a throwaway repo that has rerere enabled and an existing read-only rr-cache:
    • With rerere.enabled=false set through GIT_CONFIG_*, a conflicting merge, a rebase and rebase --continue behave normally, and rr-cache is untouched.
    • With rerere on, git prints a write error and carries on.
  • The commondir check.
    • It uses lstat, so it does not follow a symlink.
    • It runs before ensureIsolationToken.
    • It fails closed on any stat or read error.
    • There is no meaningful race between the check and the launch: the launcher creates the placeholder with noclobber (O_EXCL), and a sandboxed agent cannot create or replace the file whether it exists or not.
  • No overclaiming. The docs, the changelog and the PR body now scope the claims to Claude Code pipeline agents, except for the listed residual risks.
  • The tests fail when the fixes are reverted. I checked each revert on an exported copy:
    • Reverting policy.ts and claude-settings.ts fails 3 tests: policy, placeholder and env file.
    • Reverting launch.ts fails the refusal test.
    • Reverting the doctor fails the doctor test.
    • Swapping lstat for stat fails the refusal test, through its symlink case.

After these fixes, a full isolated launch on a host with socat is still required before merge.

This branch has not been deployed

No deployments
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