Codex Stalls on a Merge Conflict or Resolves It the Wrong Way
Codex hits conflict markers and either stops, picks the wrong side, or hand-edits the markers into the file. Pre-rebase setup.sh and explicit AGENTS.md rules fix it.
Codex ignores structure, can`t finish patches, duplicates files, misreads builds, unsafe assumptions, shallow review, generic tests, patch conflicts, style drift, broad audits.
Codex is a sandboxed cloud agent — great for running tasks independently without burning local session, but it`s also the easiest place to ship "functionally correct, structurally wrong" code: wrong directories, v2 file duplicates, tests that ignore conventions, 50-bullet audits no one can act on. This hub breaks down real Codex failure modes: one symptom per article, with `AGENTS.md` patterns and verification steps. For developers who actually integrate Codex into their workflow, not just demo it.
Codex hits conflict markers and either stops, picks the wrong side, or hand-edits the markers into the file. Pre-rebase setup.sh and explicit AGENTS.md rules fix it.
Codex edits package.json but never ran npm install, so package-lock.json diverges. How to enforce lockfile updates via setup.sh, CI, and AGENTS.md.
Codex defines a fresh User or ApiResponse type when an identical one lives elsewhere. How to make the agent search first via AGENTS.md, indexes, and ts-morph.
Codex ran git commit --amend or interactive rebase from an old README, rewriting shared history. How to lock the agent to forward-only commits.
Codex emits a one-line PR body with no detail. How to force a structured description with before/after, why, and test plan via templates and AGENTS.md.
Codex reports green tests but the failing cases were filtered out, marked .skip, or bailed early. How to force honest test reporting before merge.
Codex hits a context or token cap mid-task and stops with a partial diff. How to scope tasks smaller, split across PRs, or move to a larger-context model.
Codex outputs API patterns deprecated years ago because its training data is dated. How to lock it to modern APIs via AGENTS.md, ESLint deprecation rules, and reference docs.
Codex ran git commit on whatever branch was checked out — sometimes main, sometimes a leftover branch from the previous task. How to force a clean per-task branch.
Codex's PR is green in CI — every test passes — but the app crashes in staging. Why agent fixes that target the test surface miss the runtime, and how to close the gap.
Codex writes a file, Prettier reformats it on save, and now the diff is huge. Fix by running Prettier inside the agent loop and aligning agent style hints to your .prettierrc.
On 500k+ line codebases Codex loses track halfway. Fix by scoping the working set, using directory summaries, and forcing the agent to read AGENTS.md before scanning.
Codex silently skips PNGs, PDFs, sqlite DBs, compiled artifacts. The fix is allowlisting text extensions, hashing binaries instead of reading, and giving Codex a binary-aware tool.
Codex re-reads the same file 8 times and re-greps the same query 5 times. Fix by pre-feeding context, requiring a plan first, and capping reads via tool restrictions.
Codex halts halfway through a multi-step task with no visible failure — usually a context window, sandbox timeout, or stop-condition issue. Diagnose by checking the last tool call and turn budget.