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.

From OpenAI · Company guide · Jan 2026

Setup time20 min
CostIncluded in plan
RunsNightly
NeedsCodex, GitHub
Last updated2026-10-17

What the source did

  • 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.

Copy the prompt

Ours Our version, based on what OpenAI described. Not their wording. Fill in the [BRACKETS].

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 rule

🛡
Codex 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

⚠
  • 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.

Get the 10 best agent setups. Free.

Plus new recipes every week. One email, no spam.

Unsubscribe anytime. Privacy

Related recipes

Read original ↗