Recipes / Dev & code
CodexRoutineDev & code

Overnight test coverage PRs with Codex

OpenAI's internal guide lists seven Codex use cases; one engineer points it at low-coverage modules overnight and reviews runnable test PRs in the morning.

Setup time20 min
CostIncluded in plan
RunsNightly
NeedsCodex, GitHub
Last updated2026-10-15
Company guideSource

How OpenAI uses Codex

by OpenAI · 2026-01-14

✓ Opened with WebFetch on 2026-10-15

Read the original ↗
Part 1 · What the source did

OpenAI's internal guide lists seven Codex use cases; one engineer points it at low-coverage modules overnight and reviews runnable test PRs in the morning.

  • Teams use Codex for code understanding, migrations, performance, tests, scaffolding and drive-by fixes.
  • Recommends asking for a plan first, writing prompts like a GitHub issue and keeping AGENTS.md current.
  • Uses the task queue as a backlog and Best-of-N to compare attempts.
“I point Codex at low‑coverage modules overnight and wake up to runnable unit‑test PRs.”— OpenAI, Company guide

Summary written by Agent Cookbook. See the original for the full context.

Part 2 · Our copy-paste version

Adapted by us from what the source described. Fill in the [BRACKETS].

The prompt

Task (one per module): Write unit tests for [MODULE PATH]. Cover edge cases: empty input, max length, null/invalid states and the failure paths you can find. Follow the style of [EXISTING TEST FILE]. Don't change production code; if a test reveals a bug, mark it skipped with a TODO explaining the bug. Run the test suite and include the output in the PR description.
🛡
Approval ruleCodex opens PRs only. A human reviews and merges.

Set it up

  1. List your 5 lowest-coverage modules.
  2. Queue one Codex task per module before you log off.
  3. In the morning, review each PR's tests and output; merge the good ones.

Common failures

⚠
What usually goes wrong
  • Tests that only assert current behavior can lock bugs in. Read the assertions.
  • Missing env setup causes flaky runs. Fix the environment script once.

Variations

  • Ask for property-based tests on pure utilities.
  • Use Best-of-N and keep the strongest test file.

Related recipes