agent-ops-patterns / gallery / OpenAI Codex map / how it decides

How OpenAI Codex decides

The main model picks each next step and plain code carries it out, and a turn can end when the model's reply holds no tool call and nothing else asks for a follow-up, unless a Stop hook you configured sends it on. When the conversation grows too long, local compaction replaces older history with a model's summary, and remote compaction uses an opaque item from the backend.

From openai/codex at source version a5c40924, mapped 2026-11-02. Each answer links the place in the code where that decision is made; the full map has the rest.

How it decides it is done

Limits and memory

Other judgments

Three problems in the code

  1. 1. A long AGENTS.md near the root can crowd out the ones nearer your work

    Codex shares one budget, 32 KiB by default, across a project's AGENTS.md files, reading from the project root down to your working directory. So a long file near the root can use it up. When the budget is used up, later files, nearer your work, are not read; a file larger than what remains is cut. A pull request merged on 2026-11-04, after the commit this card read, adds warnings for files cut or skipped this way; the cut is still there.

    Already tracked upstream (#37956), checked 2026-11-15.

    Where: agents_md.rs:145-180, agents_md.rs:68. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) on 2026-11-08, in three rounds; each sentence it questioned was narrowed, removed or kept with the reason recorded.

  2. 2. An interrupted command's output can be missing from the model's result

    If you interrupt and a running exec_command call is aborted, its result for the model holds the elapsed time and 'aborted by user', with no command output. An open report in Codex's tracker describes output visible on screen but missing from the tool result returned to the model.

    Already tracked upstream (#35735), checked 2026-11-15.

    Where: parallel.rs:481-501, parallel.rs:378-385. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) on 2026-11-08, in three rounds; each sentence it questioned was narrowed, removed or kept with the reason recorded.

  3. 3. A /review reply that cannot be parsed comes back with no structured findings

    Code tries to parse the review model's reply as JSON, whole and then from its first { to its last }. If both fail, the whole reply becomes the overall explanation, with zero findings and an empty correctness verdict. Codex tests this fallback on purpose. An open issue reports a /review that returned "continue?" instead of a review; a comment there names this fallback as a plausible cause, not a confirmed one.

    Already tracked upstream (#24109), checked 2026-11-15.

    Where: review.rs:193-208. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) on 2026-11-08, in three rounds; each sentence it questioned was narrowed, removed or kept with the reason recorded.

See the full map →

This card was taken from the published map of OpenAI Codex at one commit and covers only decisions shown there; it did not look at code outside the Rust agent in codex-rs/, at OpenAI's hosted services, or at the 8 decisions left out of that edition, and no Codex code was run to make it.

Map: edition without a gap list or coverage figure, 158 of 166 cards shown (published 2026-11-02) · taken from the full map · card data: gallery/cards/codex.json. Found something wrong? Use the correction form.