DaddyNote

UK, Irish and EU money and travel rules, worked through step by step, with the date each figure was checked.

AI how-to notes · 2026-09-17 · last run 2026-09-17 · 한국어 원문

Reviewing code with Codex CLI before you commit — codex review --uncommitted on Windows

One line summary

codex review --uncommitted bundles up everything you haven't committed yet — staged or not — plus untracked new files, and reviews the lot. Run against a temp repository with two deliberately planted bugs, all three of its findings matched real test failures. That said, codex could not run the tests itself, and --uncommitted cannot be combined with a review instruction.

Who this is for

Test environment

ItemValue
OSWindows 11 Home (10.0.26200)
ShellsGit Bash, PowerShell 7.6.6
codexcodex-cli 0.153.4
Model (as shown in the run banner)gpt-6-astra
Python for the testsPython 3.12.10
RepositoryA git repository in a temp folder (one commit)

All three review attempts had < /dev/null attached so stdin ended immediately. Related note: codex exec hangs waiting on stdin.

The options in the help text

From codex review --help, the options that choose what gets reviewed:

Usage: codex review [OPTIONS] [PROMPT]

      --uncommitted
          Review staged, unstaged, and untracked changes

      --base <BRANCH>
          Review changes against the given base branch

      --commit <SHA>
          Review the changes introduced by a commit

      --title <TITLE>
          Optional commit title to display in the review summary

The command table in the official docs says the same thing. --uncommitted: "Review staged, unstaged, and untracked changes." (learn.chatgpt.com/docs/developer-commands?surface=cli, checked 2026-09-17)

codex review --help has no -o and no --json. Both live on codex exec review --help, so that's what we used to get the result into a file (section 3).

1. Setting up a repo with bugs in it

We committed a correct stats.py, then introduced two bugs as uncommitted changes. In clamp, the upper bound hi was wrongly changed to lo, and the newly added median doesn't handle even-length input. The test file test_stats.py was left as an untracked new file.

37d0534 add stats
 M stats.py
?? test_stats.py
--- git diff ---
 def clamp(x, lo, hi):
-    return max(lo, min(x, hi))
+    return max(lo, min(x, lo))
+
+
+def median(nums):
+    s = sorted(nums)
+    mid = len(s) // 2
+    return s[mid]

We ran the tests before the review. The tests also encode a requirement that an empty list raises ValueError.

PASS average([1, 2, 3]) == 2
PASS average([]) == 0.0
FAIL clamp(5, 0, 10) == 5
PASS clamp(-1, 0, 10) == 0
FAIL clamp(99, 0, 10) == 10
PASS median([3, 1, 2]) == 2
FAIL median([4, 1, 3, 2]) == 2.5
FAIL median([]) raises ValueError -> IndexError
4 failed

2. Running codex review --uncommitted

cd review
codex review --uncommitted < /dev/null; echo "codex exit=$?"

The whole command, including the git status checks either side of it, took 57.8 seconds and exited 0. The review body went to standard output; the run banner and the commands codex executed went to standard error. The banner printed these values, none of which we specified.

model: gpt-6-astra
approval: never
sandbox: read-only
user
current changes

The review on standard output is a one-paragraph summary plus three prioritized findings (the line explanations are trimmed).

The patch breaks clamp and fails the stated median expectations for even-length and empty inputs. Test execution was unavailable because Python was not installed on PATH; these failures are evident from inspection.

Full review comments:

- [P1] Restore the upper bound in clamp — C:/Users/User/AppData/Local/Temp/longtail_A2/review/stats.py:8-8
- [P2] Average the middle values for even-length inputs — C:/Users/User/AppData/Local/Temp/longtail_A2/review/stats.py:13-14
- [P2] Raise ValueError for an empty median input — C:/Users/User/AppData/Local/Temp/longtail_A2/review/stats.py:12-14

After the review, git status was identical to before ( M stats.py, ?? test_stats.py). No files were modified.

Checking the findings against real results

We verified the numbers inside the findings separately in Python.

clamp(5, 0, 10) = 0
clamp(99, 0, 10) = 0
clamp(-1, 0, 10) = 0
median([4, 1, 3, 2]) = 3
median([]) -> IndexError list index out of range
FindingWhat codex claimedActual runMatching test failure
P1 clamp upper boundclamp(5, 0, 10) and clamp(99, 0, 10) both return 0both 0matches 2 FAILs
P2 even-length medianmedian([4, 1, 3, 2]) returns 33matches 1 FAIL
P2 empty median inputraises IndexError, while the test wants ValueErrorIndexErrormatches 1 FAIL

All four test failures were covered by the three findings, and there were no findings unrelated to a failure. The claim in the P1 explanation — that for ordinary numeric input clamp always returns lo — held up too: all three inputs returned 0.

Applying the findings to a copy (restoring hi in clamp; raising ValueError for empty input and averaging the two middle values for even-length input in median) and re-running the tests gave 0 failed and exit code 0.

codex could not run the tests

The review summary says "Python was not installed on PATH". Standard error shows codex ran python -B test_stats.py through PowerShell and got a CommandNotFoundException. The explanatory part of the error was garbled Korean text we could not read.

    + CategoryInfo          : ObjectNotFound: (python:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

When we looked for it ourselves on the same PC with pwsh -NoProfile, we got C:\Users\User\AppData\Local\Programs\Python\Python312\python.exe. Only the environment codex runs commands in failed to find python. A comparison of the PowerShell environment across sandbox modes is written up separately in Codex sandbox read-only vs workspace-write. So this review was a judgment made by reading the code, and the summary said as much: "evident from inspection".

3. Getting the result into a file — codex exec review

codex exec review --uncommitted --ephemeral -o ../review_out.md < /dev/null; echo "codex exit=$?"

55.7 seconds, exit code 0. review_out.md was 1327 bytes, and the three problems found and their priorities (one P1, two P2) matched section 2. The two P2 titles were worded differently (Average the two middle values for even-length inputs, Reject empty median inputs with ValueError). The explanatory sentences differed slightly too, and the file paths were printed with backslashes, as C:\Users\...\stats.py:8-8. The same review also appeared once more on standard output. codex's python -B test_stats.py again failed with the same CommandNotFoundException.

Results

RoundCommandExit codeTimeResult
1codex review --uncommitted057.8s (including the checks either side)3 findings, all matching test failures
2codex review --uncommitted "Focus only on clamp."20.7sargument conflict error
3codex exec review --uncommitted --ephemeral -o ../review_out.md055.7s1327-byte file, 3 findings

What failed

Round 2 attached a review instruction to --uncommitted and was rejected outright.

error: the argument '--uncommitted' cannot be used with '[PROMPT]'

Usage: codex review --uncommitted [PROMPT]

The Usage line in the help text shows [PROMPT], but in 0.153.4 you cannot pass --uncommitted and an instruction at the same time. Narrowing the scope with something like "only look at clamp" is not possible in that combination.

codex failing to run the tests is also a limit of this experiment. We did not establish why python wasn't found in that environment.

What we did not test

Related notes