CodeVetter · Repo Unpack · Testing signals
openai/codex
Rust tests use `cargo nextest` through `just test -p <crate>`, not raw `cargo test`. Core favors integration tests in `codex-rs/core/tests` (and `core/suite`) built on `core_test_support::responses`, which mounts SSE fixtures with `wiremock` and drives a `TestCodex`. The TUI uses `insta` snapshot tests. App-server tests speak the public JSON-RPC API via `TestAppServer`. CI is Bazel-first (`blocking-ci.yml`, `bazel.yml`) plus `cargo-deny`, codespell, and CLA checks. Python tooling under `scripts/` has its own pytest setup. Large areas — real OS sandbox integration, live provider calls, and Seatbelt-under-Seatbelt — are intentionally skipped when `CODEX_SANDBOX` or `CODEX_SANDBOX_NETWORK_DISABLED` is set.
- Core integration tests construct a mock HTTPS Responses server. The canonical pattern is `responses::mount_sse_once` + `ev_response_created` / `ev_function_call` / `ev_completed`, then `codex.submit(Op::UserTurn)` and assertions on `ResponseMock::single_request()`.
- `TestCodexBuilder::build_with_auto_env()` is the default constructor so tests work when the app-server and exec OS differ. `wait_for_event` is preferred over timeout variants; `mount_sse_once` is preferred over match/sequence helpers.
- TUI tests are snapshot-based with `insta`. UI changes must update snapshots via `just test -p codex-tui`, then `cargo insta pending-snapshots -p codex-tui` and `cargo insta accept -p codex-tui`. Helpers live beside views; `vt100` tests are feature-gated (`vt100-tests`).
- New test modules must be sibling files included with `#[cfg(test)] #[path = "..._tests.rs"] mod tests;`, not inline modules. Assertions should use `pretty_assertions::assert_eq` on whole objects. Tests must not mutate process environment.
- Sandbox and network tests early-exit when `CODEX_SANDBOX=seatbelt` or `CODEX_SANDBOX_NETWORK_DISABLED=1`. Agents running under the Codex sandbox are expected to skip those tests rather than weaken the checks. The env-var names are centralized and must not be edited casually.
- CI blocking path is `.github/workflows/blocking-ci.yml`: `cargo fmt -- --check`, a package-manager pin check, `cargo shear` (which builds with `bazel build //...`), and the reusable Bazel test workflow. `cargo-deny.yml` audits licenses and advisories.
- Python under `scripts/` is a separate uv project (`codex-scripts`, requires Python >= 3.12). It is used for release and maintenance scripts, not the agent loop. `python-runtime-build.yml` and `python-runtime-release.yml` build the standalone Python runtime shipped for some Codex features.
- Exec and login have crate-local tests (`codex-rs/exec`, `codex-rs/login`). SDK TypeScript tests live next to `sdk/typescript` and mock the stdio JSON-RPC transport rather than spawning a real model. There is no single cross-language end-to-end suite in CI that hits the live OpenAI API.
- Coverage gaps called out by repo policy: agent behavior changes must add a `core/suite` integration test; unit tests of statically defined tables are discouraged; negative tests for deleted logic are discouraged. UI without an insta snapshot is considered incomplete.