Skip to content

codex: default sandbox to danger-full-access for CI - #519

Merged
max-sixty merged 1 commit into
mainfrom
codex-sandbox-ci
May 16, 2026
Merged

max-sixty merged 1 commit into
mainfrom
codex-sandbox-ci

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

On Linux, codex's workspace-write / read-only sandbox jails command execution with bubblewrap (bwrap). The GitHub Actions ubuntu-24.04 runner image does not ship bwrap, so under the previous workspace-write default codex could not execute any local command — even reading a file — and the agent immediately reported it was blocked. This was the remaining hard blocker for the Codex harness in CI (observed in a real tend-review-runs run on the codex harness).

The fix flips the sandbox input default in codex/action.yaml to danger-full-access. The action only ever runs inside an ephemeral single-use GitHub Actions runner VM, which is itself the isolation boundary; codex's inner bwrap jail is redundant there and unavailable on the standard runner image anyway. The boundaries that are load-bearing for tend — the bot cannot merge its own PRs (branch protection), and credentials are scope-limited (env-scoped CODEX_REFRESH_PAT, repo-scoped CODEX_AUTH_JSON) — are enforced outside codex's local-exec sandbox and are unaffected. danger-full-access is the standard codex-in-CI configuration.

docs/security-model.md gets a brief note appended to the existing "Claude executes attacker-controlled code" risk (the paragraph already covering this boundary), making the Codex harness's posture explicit rather than rewriting the section.

Scope is intentionally narrow: the action default is the canonical single fix. The generator is unchanged (no per-workflow sandbox: option), and the two other known codex-in-CI blockers (cold cargo-install build time, static TEND_EOF heredoc capture) are deliberately untouched.

Validation: pre-commit run --all-files passes; generator/tests/ is 230 passed with zero golden changes, confirming the default is a pure action input not referenced by the generator.

The Codex composite action only ever runs inside an ephemeral
single-use GitHub Actions runner VM, which is itself the isolation
boundary. Codex's inner bwrap jail (workspace-write / read-only on
Linux) is redundant there — and unavailable anyway, since the
standard ubuntu runner image ships no bubblewrap, so any
non-full-access mode blocks codex from running even a file read and
the agent immediately reports it is blocked.

The boundaries that are load-bearing for tend (the bot cannot merge
its own PRs; credentials are scope-limited) are enforced outside
codex's local-exec sandbox and are unaffected. danger-full-access is
the standard codex-in-CI configuration and the correct default for
this action's actual execution context.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 20f4edd into main May 16, 2026
6 checks passed
@max-sixty
max-sixty deleted the codex-sandbox-ci branch May 16, 2026 00:19
max-sixty added a commit that referenced this pull request May 16, 2026
…522)

Tend's Codex action built the CLI from source via `cargo install --git`
at a pinned tag — ~22 min on a cache miss, plus a Rust toolchain and a
binary-cache layer to make hits fast. We did this because the `codex
plugin add` subcommand tend needs (PR
[#21396](openai/codex#21396), merged 2026-05-14)
postdated every npm release.

That PR is now on npm. PR #21396 first appears in release tag
`rust-v0.131.0-alpha.17` (verified via merge-commit ancestry: `alpha.16`
diverged from it, `alpha.17`+ contain it). On npm it's published on the
`alpha` dist-tag — `latest`/stable is still `0.130.0` and lacks it. I
installed `@openai/[email protected]` from npm into a scratch dir
and confirmed directly: prebuilt per-platform binary, ~3 s install,
`codex plugin --help` lists `add` / `marketplace` / `list` / `remove`.

This performs the cut-over the old comment documented: the four build
steps (Cache codex / Set up Rust / Build / Verify) and the commented
swap-in block are gone, replaced by a single `npm install -g
"@openai/codex@${codex_version}"`. `codex_version` becomes an npm
version string (default `0.131.0-alpha.22`); since npm `latest` predates
#21396, the default pins an explicit alpha rather than tracking
`latest`. The empty-string fallback from the old commented block is
dropped — its `else` resolved to `latest` (0.130.0), which silently
lacks the subcommand; one canonical pinned path is correct and
lower-cardinality. The explanatory comment is rewritten and date-stamped
(the npm version-state note drifts).

Net: ~22 min cold build (and the toolchain + cache machinery) gone;
install is ~3 s prebuilt, works without the GitHub release path.

Scope is the codex install region + the `codex_version` input only. Not
touched: the `final_message`/`TEND_EOF` heredoc (handled separately on
`codex-final-message-delimiter`), the `sandbox` default (#519), the
generator. `pre-commit run --all-files` (incl. actionlint) and `wt test`
(230 passed, 0 regtest changes — action-internal) both green.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
@max-sixty max-sixty mentioned this pull request May 16, 2026
3 tasks
max-sixty added a commit that referenced this pull request May 16, 2026
## Summary

Release 0.0.21 — makes the Codex harness functional on GitHub Actions
runners.

3 commits since 0.0.20:
- #519 — codex sandbox defaults to `danger-full-access` for CI (the
runner VM is the isolation boundary; `bwrap` isn't on the runner image)
- #521 — random heredoc delimiter for `final_message` output (static
`TEND_EOF` broke on awkward agent output)
- #522 — codex CLI installed from npm prebuilt instead of ~45min source
build

## Test plan

- [ ] CI green (test, test-worker, lint)
- [ ] After merge: tag `0.0.21`, PyPI publish succeeds, `uvx [email protected]
--help` works
- [ ] Regenerate tend's own workflows to pin `@0.0.21`

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request May 16, 2026
Routine post-release regen. Pins the eight `tend-*.yaml` workflows to
`max-sixty/[email protected]`. Until this merges, tend's deployed workflows
lag the just-released generator.

0.0.21 makes the Codex harness functional on GHA (#519/#521/#522); tend
itself stays on the Claude harness — only the pinned action version
changes here.

## Test plan

- [ ] CI green (test, test-worker, lint)

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request May 16, 2026
0.0.21 carries the three fixes that make the Codex harness work on
GHA: sandbox defaults to danger-full-access (#519), npm prebuilt
install (#522), random heredoc delimiter for output (#521).

Co-Authored-By: Claude <[email protected]>
max-sixty added a commit that referenced this pull request May 16, 2026
## Summary

Flips tend's own CI from the Claude harness to the Codex harness by
setting `harness: codex` in `.config/tend.yaml` and regenerating the
eight `tend-*.yaml` workflows. Each now invokes
`max-sixty/tend/[email protected]` with `CODEX_AUTH_JSON` instead of
`max-sixty/tend@<v>` with `CLAUDE_CODE_OAUTH_TOKEN`.

Motivation is cost: API billing scales per token; a flat-rate ChatGPT
subscription funds unlimited runs. tend dogfoods its own setup, so it
should run the harness we recommend for cost-sensitive adopters.

The net diff is small — config (+ `harness: codex`, + `secrets.allowed:
[CODEX_AUTH_JSON]`) and the regenerated workflow files (action ref, auth
secret, model, skill-invocation syntax). Supporting infrastructure
landed separately on main:

- `codex-auth-refresh.yaml` + env-scoped `CODEX_REFRESH_PAT` rotation
(#500, #510)
- `CODEX_AUTH_JSON` as a repo secret, refresher writes it back at repo
scope (#514)
- Codex-on-GHA fixes, all in release 0.0.22: sandbox
`danger-full-access` (#519), npm prebuilt install (#522), base64
`final_message` capture (#525)

## Validation

The original "do not merge until…" prerequisite is **satisfied**:

- `tend-review-runs` `workflow_dispatch` on this branch (pinned
`[email protected]`) ran **green end-to-end** — codex authenticated,
installed via npm, ran without the `bwrap` block, executed the full
agent (real review-runs work: posted evidence to the tracking issue,
commented on the outage issue), and the action exited 0.
- Deterministic CI (`test`, `test-worker`, `lint`) green; `tend-review`
(Claude harness via `pull_request_target`) approved.

Each codex blocker found during stabilization was fixed and released:
auth scoping → sandbox → install → output framing. The smoke test going
green on 0.0.22 confirms convergence.

## Post-merge follow-up

Watch the first unattended nightly `codex-auth-refresh` cron (`17 3 * *
*`) succeed. Manual dispatches (incl. the post-#514 recovery) have all
succeeded; this just confirms the scheduled path runs without a human.
Failure degrades gracefully over the ~8-day refresh window, with manual
rotation as fallback.

---------

Co-authored-by: Claude <[email protected]>
max-sixty added a commit that referenced this pull request May 16, 2026
## Summary

Flips tend's own CI from the Claude harness to the Codex harness by
setting `harness: codex` in `.config/tend.yaml` and regenerating the
eight `tend-*.yaml` workflows. Each now invokes
`max-sixty/tend/[email protected]` with `CODEX_AUTH_JSON` instead of
`max-sixty/tend@<v>` with `CLAUDE_CODE_OAUTH_TOKEN`.

Motivation is cost: API billing scales per token; a flat-rate ChatGPT
subscription funds unlimited runs. tend dogfoods its own setup, so it
should run the harness we recommend for cost-sensitive adopters.

The net diff is small — config (+ `harness: codex`, + `secrets.allowed:
[CODEX_AUTH_JSON]`) and the regenerated workflow files (action ref, auth
secret, model, skill-invocation syntax). Supporting infrastructure
landed separately on main:

- `codex-auth-refresh.yaml` + env-scoped `CODEX_REFRESH_PAT` rotation
(#500, #510)
- `CODEX_AUTH_JSON` as a repo secret, refresher writes it back at repo
scope (#514)
- Codex-on-GHA fixes, all in release 0.0.22: sandbox
`danger-full-access` (#519), npm prebuilt install (#522), base64
`final_message` capture (#525)

## Validation

The original "do not merge until…" prerequisite is **satisfied**:

- `tend-review-runs` `workflow_dispatch` on this branch (pinned
`[email protected]`) ran **green end-to-end** — codex authenticated,
installed via npm, ran without the `bwrap` block, executed the full
agent (real review-runs work: posted evidence to the tracking issue,
commented on the outage issue), and the action exited 0.
- Deterministic CI (`test`, `test-worker`, `lint`) green; `tend-review`
(Claude harness via `pull_request_target`) approved.

Each codex blocker found during stabilization was fixed and released:
auth scoping → sandbox → install → output framing. The smoke test going
green on 0.0.22 confirms convergence.

## Post-merge follow-up

Watch the first unattended nightly `codex-auth-refresh` cron (`17 3 * *
*`) succeed. Manual dispatches (incl. the post-#514 recovery) have all
succeeded; this just confirms the scheduled path runs without a human.
Failure degrades gracefully over the ~8-day refresh window, with manual
rotation as fallback.

---------

Co-authored-by: Claude <[email protected]>
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