Codex issues sequential commands in parallel, causing races
What version of Codex CLI is running?
0.111.0
What subscription do you have?
ChatGPT Pro
Which model were you using?
gpt-5.4 xhigh
What platform is your computer?
Linux 6.18.7-76061807-generic x86_64 x86_64
What terminal emulator and version are you using (if applicable)?
kitty
What issue are you seeing?
Codex will issue commands that are inherently sequential, such as git add followed by git commit but will issue them in parallel, which causes a race condition. Codex is able to recover of course, but is not temporally aware that commands take time to execute.
This appears to happen whenever commands can 'normally' be run one after the other but for which a beat of time is expected in normal human interaction which normally resolves the race.
Observed:
› Commit the change
• I’m checking the worktree first so I only commit the planning accessor fix and its regression test, then I’ll create a focused commit with those
two files.
• Ran git diff -- <file paths removed>
└ diff --git <file paths removed>
index <sha><sha> 100644
… +121 lines
#
# -----------------------------------------------------------------------------
• Ran git status --short
└ M <file path removed>
M <file path removed>
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• The worktree is clean apart from the two intended files. I’m staging just those and creating a single commit for the <other issue>
• Ran git add <file path removed>
└ (no output)
• Ran git commit -m "<message removed>"
└ On branch <branch removed>
Your branch is up to date with '<branch removed>'
… +6 lines
no changes added to commit (use "git add" and/or "git commit -a")
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• The first commit attempt raced the stage step, so Git saw unstaged changes. I’m restaging and committing sequentially now.
What steps can reproduce the bug?
Ask codex to commit an unstaged change in a git repository.
What is the expected behavior?
Sequential operations should have time between the completion of a step and the start of the next step, not between the time of the start of a step and the start of the next step.
Additional information
_No response_