Skip to content

Unconditionally seed agent config files and mount them - #475

Closed
jbcoe wants to merge 1 commit into
mainfrom
jbcoe-agentic-sandbox
Closed

jbcoe wants to merge 1 commit into
mainfrom
jbcoe-agentic-sandbox

Conversation

@jbcoe

@jbcoe jbcoe commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Unconditionally seed agent config files and mount them in the agentic sandbox script.

The previous setup meant that running the sandbox and later starting an agent would run the agent without user-authentication.

…c sandbox.

The previous setup meant that running the sandbox and later starting an agent
would run the agent without user-authentication.
@jbcoe
jbcoe force-pushed the jbcoe-agentic-sandbox branch from 89be581 to edb1db6 Compare October 17, 2026 11:46
@jbcoe
jbcoe marked this pull request as ready for review October 17, 2026 11:55
@jbcoe
jbcoe requested a review from philipcraig October 17, 2026 11:55

@philipcraig philipcraig left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Mounting every agent's config in the plain shell makes sense for the case in the description. Two side effects look unintended: an agent session now also gets the other agent's credentials, and --offline mounts credentials that nothing in a container without network can use. Keeping main's per-agent _agent_mount_args(agent) and looping over AGENT_CLIS only for the plain shell keeps the fix and avoids both. Details inline.

Blocking: the two credential mounts, on line 279.

Non-blocking: the seeding changes on line 279, the CONTRIBUTING.md wording and the help text below. The suggested change fixes most of them anyway.

Non-blocking: the --skip-permissions help text, which this diff doesn't touch, still names only ~/.claude. ~/.claude.json was already missing from it, and with this PR ~/.gemini is mounted too. With per-agent mounts, "mounts the project, ~/.claude and ~/.claude.json read-write" would be accurate.

run_args.extend(["--network", "none"])

run_args.extend(_agent_mount_args(args.agent))
run_args.extend(_agent_mount_args())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Blocking: this mounts all three paths whichever agent is chosen:

  • claude --skip-permissions now runs with ~/.gemini, Gemini OAuth tokens included, mounted read-write, with open network and no prompts. agy gets ~/.claude and ~/.claude.json.
  • --offline gets every agent's credentials, but with --network none no agent can authenticate, so the mounts only add exposure. Before this PR the plain shell mounted none, offline or not.

Non-blocking: seeding has moved too. _seed_agent_config() now runs for every agent, before git rev-parse and docker build, so a run that fails still writes ~/.gemini/settings.json (selectedAuthType: oauth-personal), ~/.gemini/trustedFolders.json and an empty ~/.claude.json into the host home. agy and the plain shell now exit when ~/.claude.json is a directory. And with seeding split from mounting, the two functions build the same paths separately, and the mounts are only safe once seeding has run.

Keeping main's _agent_mount_args(agent), which seeds and mounts together, and changing only this call site fixes all of these:

    if args.agent is not None:
        run_args.extend(_agent_mount_args(args.agent))
    elif not args.offline:
        for agent in AGENT_CLIS:
            run_args.extend(_agent_mount_args(agent))

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

The aim of this CL is to allow any supported agent to be used from the sandbox. There is no problem to 'fix' here.

Comment thread CONTRIBUTING.md
the rest of the host file system, but the network is unrestricted and the
project and `~/.claude`, credentials included, are mounted read-write. Pass
`--skip-permissions` only when that is acceptable.
project and the host config of every supported agent, credentials included,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Non-blocking: this paragraph is about claude and --skip-permissions, but readers most need to know that a plain shell now gets every agent's credentials read-write. A sentence under Usage, after "Omit it for a plain shell in the container", would say so. With per-agent mounts this line can go back to naming ~/.claude and ~/.claude.json.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Why do "readers most need to know that a plain shell now gets every agent's credentials read-write"? The script is called "agentic-sandbox".

Removing per-agent mounts is the point in this CL.

@jbcoe

jbcoe commented Oct 17, 2026

Copy link
Copy Markdown
Owner Author

@philipcraig pointed out that sharing agent credentials between agents might not be wise.

@jbcoe jbcoe closed this Oct 17, 2026
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