Add Codex example for non-interactive runs#656
Add Codex example for non-interactive runs#656megaconfidence wants to merge 6 commits intocloudflare:mainfrom
Conversation
|
|
/bonk review this PR |
|
Review submitted successfully. Here's a summary of my feedback: Requested changes on PR #656:
|
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
|
New commits pushed -- |
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
|
New commits pushed -- |
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
New commits pushed -- |
|
/bonk what's the difference between this and our our existing codex example? |
|
Here's the breakdown of how this new vs This PR is essentially a 1:1 port of the claude-code example with Codex-specific adaptations. The structure, flow, and even line-for-line patterns are nearly identical:
The meaningful differences are:
vs Completely different use case:
The In short: this PR gives users a simple starting point for running Codex non-interactively, directly mirroring the claude-code example. The codex-app-server is the more sophisticated interactive counterpart. |
There was a problem hiding this comment.
Hi @megaconfidence thanks so much for contributing this example. As it's just a copy of the claude-code example I'm okay with the issues that the Bonk bot raised (but if you'd like to fix them in both places that'd be very welcome).
Have you tried running this code? I'm running into various sandbox errors which means that the example doesn't yet work.
Firstly it's attempting to use bubblewrap to isolate changes that it's making on the host.
warning: Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the vendored bubblewrap in the meantime.
Secondly it doesn't then have the relevant permissions to use bubblewrap. So all shell commands are failing.
/bin/bash -lc 'pwd && rg --files' in /workspace/hashline
exited 1 in 2ms:
bwrap: No permissions to create a new namespace, likely because the kernel does not allow non-privileged user namespaces. On e.g. debian this can be enabled with 'sysctl kernel.unprivileged_userns_clone=1'.
Thirdly if the tool is used outside of a git directory it will error.
Not inside a trusted directory and --skip-git-repo-check was not specified.
For this example to be useful, it needs to work with shell commands. Perhaps disabling bubblewrap is an option because we're in an isolated sandbox.
The other limitations should be documented in the README.
Mirror the claude-code example so users have a comparable starting point for running OpenAI's coding agent in a Cloudflare Sandbox. The worker accepts a repo URL and task description, clones the repo into a sandbox, runs codex exec in non-interactive mode, and returns the agent's logs alongside the resulting git diff.
Two auth routes match the claude-code structure: POST / uses CODEX_API_KEY for pay-per-token API access, while POST /sub seeds ~/.codex/auth.json from a secret produced by codex login on a trusted machine for ChatGPT subscription auth. Both follow the patterns laid out in OpenAI's non-interactive and CI/CD auth guides.