Add codex-sandbox example - #22
Draft
opencolin wants to merge 1 commit into
Draft
Conversation
Runs OpenAI Codex headless against a real Git checkout inside a disposable Tenki microVM, then reads back the diff the agent produced. Same repo and task as claude-code-sandbox so the two read side by side. Codex ships its own bubblewrap sandbox; nesting it inside a microVM buys nothing and warns about a missing bubblewrap, so the example bypasses that layer and says why. verify.mjs proves the Tenki-facing half with no model key: boot with cloneRepoUrl, npm i -g the CLI, assert its version and that run.mjs's flags still exist, edit a file in the checkout, assert the diff round-trips. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uz85xGA4zWSge1BtiDNnSN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenAI Codex running headless against a real Git checkout inside a disposable Tenki microVM — the counterpart to #20, deliberately using the same repo and the same task so the two read side by side.
Shape:
createAndWait({ cloneRepoUrl })→npm i -g @openai/codex→codex exec --dangerously-bypass-approvals-and-sandbox "<task>"with the model key passed throughExecOptions.envand the turn streamed viaonOutput→git -C repo diff.Verification
Ran
node verify.mjslocally against the live API:Exit code 0. Proves the Tenki-facing half with no model key, asserting real values rather than truthiness:
repo/package.jsonreally isyocto-queuenpm i -g @openai/codexexits 0 (~7s)codex --versionmatchescodex-cli \d+\.\d+\.\d+codex exec --helpstill lists--dangerously-bypass-approvals-and-sandboxand-C, --cd— npm installs whatever is latest at run time, so the flagsrun.mjsdepends on are checked rather than assumedNot exercised: the agent turn needs an
OPENAI_API_KEY, which this environment does not have, socodex execwas not run to completion. Everything around it was measured live inside a sandbox — the CLI installs, starts, parses these exact flags as usertenki, and gets as far as401 Unauthorizedfromwss://api.openai.com/v1/responses, which is precisely where a missing key should stop it.The Codex-specific gotcha
Codex ships its own sandbox. Under the default
--sandbox workspace-writeit looks for bubblewrap and warnscould not find bubblewrap on PATH ... Codex will use the bundled bubblewrap in the meantime, then nests its isolation inside the microVM's. With--dangerously-bypass-approvals-and-sandboxit reportssandbox: danger-full-accessand skips the layer. Both modes measured live; the example bypasses and says why in Notes.Also measured, so the README does not claim otherwise:
codex execruns fine outside a Git repo, so--skip-git-repo-checkis not needed — the checkout is there to give the agent something to change, not to satisfy the CLI.Scope
Adds one row to Developer tools, next to the Claude Code row. Touches nothing else outside
examples/codex-sandbox/.Stacked on
examples/claude-agent-sdk(#21), which is itself on #20, since all three add a row to the root README table. GitHub will retarget this as the stack merges. Review order: #20 → #21 → this.Note on the OpenAI Agents SDK
The other half of the original ask is already shipped:
examples/openai-agents-sdk/gives an Agents SDK agent arun_pythontool backed bysandbox.exec, withverify.mjsdriving the tool throughtool.invoke(new RunContext(), ...)and no model key — the same shape as #21. Rather than duplicate it, nothing was added for it here.Generated by Claude Code