feat: add cleanroom agent codex shortcut#58
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 685a17d4bb
ℹ️ 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".
685a17d to
abcb6dd
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
51d529f to
f4f062b
Compare
c6efef4 to
4ae68fe
Compare
e677214 to
fedf12d
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fedf12d66e
ℹ️ 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".
| if info.Mode()&os.ModeSymlink != 0 { | ||
| var err error | ||
| link, err = os.Readlink(source) | ||
| if err != nil { | ||
| return fmt.Errorf("read agent credential symlink %q: %w", source, err) |
There was a problem hiding this comment.
Dereference symlinked credentials before archiving
This path preserves symlinks instead of copying their contents, so a credential source that is a symlink (common with dotfile managers) is extracted into the sandbox as the same link target rather than usable file bytes. If that link points outside the copied tree (for example an absolute host path), the sandbox gets a dangling credential path and agent auth fails even though the source existed on the host.
Useful? React with 👍 / 👎.
| test := strings.TrimSpace(spec.Test) | ||
| if test == "" { | ||
| test = "command -v " + shellQuote(name) + " >/dev/null 2>&1" |
There was a problem hiding this comment.
Base default command check on configured command
When an agent defines command but omits test, the fallback check still hardcodes command -v <agent name>. That makes valid custom commands fail the preflight check (for example absolute paths or wrapper invocations where <agent name> is not on PATH), causing an unnecessary exit 127 before exec would have worked.
Useful? React with 👍 / 👎.
a9ab404 to
d748193
Compare
Provide a first-class entrypoint so common agent workflows do not require manually composing sandbox and console commands. This keeps the implementation backend-neutral by reusing existing console execution semantics while adding parser and integration coverage for command passthrough and persistent sandbox behavior.
Generalize the agent command passthrough, default newly created agent sandboxes to the agents image, prefer a locally built alpine-agents image on local control planes, and document the current device-auth flow. Also bring up guest loopback so localhost auth listeners can bind inside the sandbox.
71530a9 to
e6cf2e1
Compare
e6cf2e1 to
4a8288d
Compare
Summary
This adds a first-class
cleanroom agentcommand for running coding agents inside a Cleanroom sandbox.Agent sessions use the repository's normal Cleanroom environment: the
cleanroom.yamlsandbox image, backend, repository bootstrap, network policy, and interactive console transport. The command keeps newly created sandboxes by default so agents can retain workspace state after the session.This also adds runtime-configured agent commands and credential copying.
How to use it
Run a built-in agent in a new sandbox from the current repository policy:
Pass agent arguments after the agent name. A leading
--is stripped when present, so both of these are valid:Run an agent in an existing sandbox:
Configured custom agents are added to the
cleanroom agent <agent>enum alongside the built-ins.What it does
cleanroom agent:cleanroom console--dangerously-allow-allThe built-in agent commands first use an agent binary already present in the sandbox image. If the binary is missing, they fall back to mise-managed Node.js plus the npm package, for example:
That means plain Debian-based Cleanroom images can run agents once they contain the required runtime libraries and the policy allows the package manager/network hosts needed by mise, Node.js, npm, and the agent itself. Images that already include agent binaries skip the fallback path.
Runtime config
cleanroom config initemits agent configuration with default commands and credential mappings. The generated commands are shell snippets; the Codex default is representative:command,test, and optionalinstallare shell snippets. Ifinstallis configured, Cleanroom runs it only whentestfails. Built-in defaults do not needinstallbecause they either use an existing binary or run the mise fallback.Credential behavior
Credential entries are explicit runtime config mappings. Each
sourceis read from the host, packaged into a tar archive, copied into the sandbox with the sandbox archive extraction API, and extracted attargetbefore the agent starts.When copying Codex config, Cleanroom preserves the host
config.tomlcontent and adds/workspaceas a trusted project in the sandbox copy.Missing credential paths are skipped. Copied credentials remain in a kept sandbox until that sandbox is terminated.
Testing
mise exec -- go test ./internal/climise exec -- go test ./...mise exec -- go run ./cmd/cleanroom agent --help