Give Codex a first task you can review completely
Prepare a small Codex repository task with a baseline failure, a bounded change, and acceptance evidence that makes the entire patch reviewable.

A good first Codex task is small enough that you can understand its input, inspect its entire diff, and verify its result. A reproducible bug is often a better starting point than an open-ended rewrite because it provides a concrete condition that should change. The aim is to establish a review process you can trust before increasing task scope.
The Codex CLI documentation, retrieved on September 20, 2026, describes inspecting local repositories, editing files, and running commands. Installed versions and local policies can differ. Record codex --version and inspect the active configuration before assuming that a particular command or permission mode behaves like the current documentation.
Choose a defect with a visible boundary
Imagine a JavaScript utility in a Node application that treats an empty environment variable as a valid port number. The application should use a default when the variable is absent or empty, accept integers in a specified range, and reject malformed values. This is a hypothetical teaching example, not a report about a defect in Minh’s projects.
A task contract can state the inputs and expected outcomes without prescribing the implementation:
| Input | Expected result | Reason |
|---|---|---|
| Variable absent | Default port | No explicit value supplied |
| Empty string | Default port | Empty configuration treated as absent |
8080 | 8080 | Valid explicit integer |
8080abc | Validation error | Trailing text is not accepted |
0 | Validation error | Outside this application’s chosen range |
The chosen range is an application decision. Port zero has legitimate meanings in other contexts, so the task should not claim that rejecting it is a universal networking rule. Precision here prevents the agent from “fixing” the function according to a different contract.
Capture the baseline before delegating
Inspect the working tree and locate the existing test command. If the repository already contains unrelated changes, record them so the agent can avoid overwriting or attributing them to its own work. Run the smallest relevant test or reproduction and save the observed failure.
A prompt can provide that evidence directly:
Fix the port parser so it meets the five cases in the task table.
The current regression is that an empty string becomes zero.
Inspect the existing parser and its callers before changing behavior.
Use the repository's existing test runner and preserve unrelated edits.
Finish with the changed behavior, the files touched, and actual test results.
This asks for a result and the evidence needed to assess it. It does not require the agent to choose a particular helper function or rewrite the surrounding configuration system. If the existing test suite already captures part of the contract, preserve those tests and add only the missing regression coverage.
The baseline and final result should refer to the same defect. A test that passes both before and after the change cannot demonstrate that the repair fixed the empty-string case. It may still be useful regression coverage, but it does not prove this specific claim.
Reproduce the contract in a disposable fixture
Here is an intentionally defective port.mjs. The default is 3000; explicit values must be ASCII decimal integers from 1 through 65535 with no leading zero, sign, whitespace, decimal point or exponent. Only an absent value or exactly empty string selects the default. This sharpens the earlier table so a proposed repair cannot silently choose a different grammar.
export function parsePort(raw) {
return Number(raw ?? "3000");
}
Place the following in port.test.mjs beside it. The expected values come from the contract, not a second copy of a parsing expression. The non-string cases exercise direct callers of the helper; operating-system environment values normally arrive as strings or absence.
import test from "node:test";
import assert from "node:assert/strict";
import { parsePort } from "./port.mjs";
for (const [raw, expected] of [
[undefined, 3000], ["", 3000], ["1", 1],
["8080", 8080], ["65535", 65535]
]) {
test("accept " + String(raw), () => {
assert.equal(parsePort(raw), expected);
});
}
for (const raw of ["0", "65536", "8080abc", "1.5", " 8080",
"+8080", "08080", "8e3", null, true, 8080]) {
test("reject " + String(raw), () => {
assert.throws(() => parsePort(raw), /invalid port/);
});
}
Run node --test port.test.mjs in this disposable directory. In the local Node 22.23.2 execution on September 21, 2026, the baseline passed four tests and failed twelve. In particular, the empty input returned 0 instead of 3000. A nonzero test-runner exit is expected at this stage; it confirms the supplied reproduction is actually red rather than just described as broken.
A manually authored reference repair replaces the original function:
export function parsePort(raw) {
if (raw === undefined || raw === "") return 3000;
if (typeof raw !== "string" || !/^[1-9]\d{0,4}$/.test(raw)) {
throw new Error("invalid port");
}
const value = Number(raw);
if (value > 65535) throw new Error("invalid port");
return value;
}
With the same test file, that reference passed all sixteen tests and the process exited zero. This observation establishes the fixture’s behavior; it is not a claim that Codex generated this patch, completed a timed trial or chose the same implementation. The installed codex --version reported 0.155.1, and its help output was inspected, but no model session was used for this demonstration.
For your actual first Codex run, supply the failing case and repository commands, then compare its proposed patch with the contract rather than requiring the reference code verbatim. Preserve the original test evidence and review any changed expectation. Editing the empty-input expectation to 0 would make one failure disappear by changing the requirement, not repairing the parser.
Simon Willison’s March 11, 2025 essay on using LLMs for code emphasizes the developer’s responsibility to see the resulting system run. His First run the tests guidance, retrieved September 21, 2026, also treats a baseline run as useful repository context. The fixture applies that narrow practice. It does not turn those recommendations into a measured claim about agent reliability, and passing a parser unit suite still says nothing about whether a real server can bind the selected port.
Match access to the work
The Codex approvals and security documentation explains execution controls and approval behavior. For this small local task, identify which files need editing and which commands need running. A permission setting is an execution policy; a sentence in a task prompt is guidance to the agent. They serve different purposes.
If the test command needs to install dependencies, that introduces network access and potentially package lifecycle scripts. Inspect the repository’s normal setup rather than treating every failed command as a reason to broaden permissions. The right environment is the one required to reproduce and validate the task, with its behavior understood.
You do not need to ask the agent for private internal reasoning. Request observable evidence: file references, the executed test command, relevant output, and any remaining uncertainty. Those artifacts are more useful during review than a confident narrative about how carefully it worked.
Review the changed behavior
Start with the parser’s input path. Check whether the implementation handles whitespace, signs, decimal points, and trailing characters according to the stated contract or an explicit extension of it. If the agent changed a shared parser, inspect callers that may have relied on its previous behavior.
Then read the tests. A test should assert the expected value or error, not merely that the function returned something. Avoid a test that reconstructs the implementation using the same parsing expression; it can repeat the same mistake. The table of externally visible cases is a better source for assertions.
Inspect the complete diff for changes beyond the defect. Formatting or dependency updates can make a tiny repair harder to assess. Keep them only when they are necessary for the requested behavior or independently justified. A short summary from the agent is a navigation aid, not a substitute for reading the patch.
Finally, rerun the relevant check in the environment where you intend to accept the change. Record limitations accurately: a unit test can establish the parser behavior, while an application startup check can show that the configuration still loads. Neither automatically proves every deployment configuration is valid. Accept the first task when its full contract is satisfied and its evidence is reproducible, then use that same standard on the next, larger task.