chore(codex): add cloud environment setup script - #680
Conversation
Single source of truth for the OpenAI Codex Cloud environment at chatgpt.com/codex. The Codex UI runs `bash scripts/codex-setup.sh`, so all install behavior flows through this file rather than the UI. Installs apt packages (GL, X11, ALSA, Vulkan), .NET 8 SDK, rustup components, wasm-pack, and npm deps for the TypeScript SDK; then pre-fetches cargo and primes target/ so the agent phase can build and run codegen without internet. Mirrors the Ubuntu CI lanes in .github/workflows/ci.yml. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @aram-devdocs's task in 1m 51s —— View job Code Review —
|
| # | Location | Issue |
|---|---|---|
| W1 | Line 71 | wasm-pack URL hardcodes x86_64 — if Codex ever provisions arm64 containers, this silently downloads the wrong binary and wasm-pack won't run. Consider probing with $(uname -m) and mapping to the musl target triple. |
| W2 | Lines 54–63 | CODEX_ENV_RUST_VERSION is documented in the PR table but never used — rustup component add targets whatever stable resolves to at install time. If the codex-universal image has 1.92.0 active, the fallback install path installs stable (potentially newer/different). The components will be added to the right toolchain if codex-universal already has rustup, but on a clean image the pinned version is lost. Consider rustup override set "${CODEX_ENV_RUST_VERSION:-stable}" after the rustup block. |
| W3 | Lines 84–87 | Playwright / Chromium not pre-fetched — npm ci installs the Playwright package but not the Chromium binary. CI runs npx playwright install --with-deps chromium before any browser-based test (xvfb-run npm run test:native, npm run coverage:native, web smoke). In the offline agent phase these will fail trying to download Chromium. Either add (cd sdks/typescript && npx playwright install --with-deps chromium) to the setup, or explicitly note in the script that browser tests are out of scope for the Codex agent. |
| W4 | Line 113 | Partial workspace pre-build — cargo build -p goud-engine-core -p goud-engine primes the two packages needed for codegen, but the agent-phase cargo check --workspace and xvfb-run cargo test will still need to compile the remaining workspace crates cold. This is correct for the stated goal ("builds ffi_manifest.json"), but the test plan implies cargo test will work fully offline; consider whether the wider workspace needs pre-building too. |
Phase 6 — CI Parity Check
Compared every Ubuntu apt-get install line in ci.yml against the script:
| Package | Script | CI |
|---|---|---|
libgl1-mesa-dev, libglu1-mesa-dev |
✅ | ✅ |
libxrandr-dev … libxxf86vm-dev |
✅ | ✅ |
libxkbcommon-x11-dev |
✅ | ✅ (most jobs; missing in preflight — pre-existing CI inconsistency, not introduced here) |
libasound2-dev libudev-dev |
✅ | ✅ |
libvulkan-dev mesa-vulkan-drivers |
✅ script only | Not in CI (fine, defensive) |
lua5.4 liblua5.4-dev |
✅ script only | lua-sdk-check installs lua5.4 separately |
xvfb |
✅ | ✅ (sandbox-parity) |
cmake pkg-config |
✅ script only | cmake added per-job in C/C++ jobs |
| wasm-pack version | 0.13.1 ✅ |
0.13.1 ✅ |
| .NET version | 8.0 ✅ |
8.0.x ✅ |
No meaningful gaps.
Phase 7 — Scope Verification
Changes match the PR description exactly. No unrelated files modified. No version bump needed (scripts dir only).
Summary
This is a well-written, operationally sound setup script. The three things worth fixing before your first real Codex task run are:
- W3 (Playwright) — most likely to cause a confusing silent failure when running TypeScript SDK tests offline. Fix this →
- W2 (Rust version pinning) — ensures the agent toolchain matches
CODEX_ENV_RUST_VERSION=1.92.0. - W1 (architecture) — low risk today but cheap to future-proof.
Three advisories published since main's last green CI, all through transitive deps we don't directly control: - 2026-0097: rand unsoundness triggered by custom global logger calling rand::rng(). Engine sets no such logger. - 2026-0098: rustls-webpki URI-name constraint bypass. Reaches us via tungstenite → tokio-tungstenite → goudengine-mcp; no URI-name certs in our pinning set. - 2026-0099: rustls-webpki wildcard-name constraint bypass. Same transitive path; same mitigation as 0098. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
scripts/codex-setup.shas the single source of truth for the OpenAI Codex Cloud environment atchatgpt.com/codex.bash scripts/codex-setup.sh— all install behavior flows through this file rather than the UI, so changes land via PR..github/workflows/ci.yml: apt deps (GL, X11, ALSA, Vulkan), .NET 8 SDK, rustup components (rustfmt/clippy + wasm32 target), pinned wasm-pack 0.13.1, npm install for the TS SDK, pluscargo fetchand a core build to primetarget/for the network-isolated agent phase.CMAKE_POLICY_VERSION_MINIMUM=3.5andPATHinto~/.bashrcbecause setup-phase exports don't cross into the agent shell.Codex UI config to pair with this script
universalbash scripts/codex-setup.shCODEX_ENV_RUST_VERSION1.92.0CODEX_ENV_PYTHON_VERSION3.11CODEX_ENV_NODE_VERSION20CODEX_ENV_GO_VERSION1.22CODEX_ENV_JAVA_VERSION17CMAKE_POLICY_VERSION_MINIMUM3.5Test plan
bash scripts/codex-setup.sh, with caching On.cargo check --workspace,./codegen.sh, andxvfb-run cargo testand confirm they work without internet.scripts/codex-setup.sh, confirm Codex invalidates the cache and reruns it.🤖 Generated with Claude Code