OpenAI Cuts Codex Context Window

By Rogier Muller07.21.26
OpenAI Cuts Codex Context Window

OpenAI’s Codex CLI is a coding agent from OpenAI that runs locally in your terminal. The July 2026 pull request developers noticed is the one people summarized as “OpenAI reduces Codex Model Context Size from 372k to 272k.” A bundled model metadata refresh that changes how much context the Codex agent can be told to expect in stable clients. Large context windows help, but they do not replace repo boundaries, compact instructions, and repeatable verification.

Read the metadata, not just the headline

This GitHub trail for Codex CLI matters because it was not a glossy launch note. It was a small change in openai/codex, the public repository for Codex CLI.

As of July 2026, openai/codex is a Rust-heavy, Apache-2.0 project with roughly 100k GitHub stars. The linked change is tied to a backport for the 0.144 release line, refreshing bundled model metadata for stable clients.

Context window metadata is the client-side catalog information that tells a coding agent how much conversation, file content, tool output, and instruction text a model can carry in one working session.

That is why a one-line-looking number change can make engineers pause. If your workflow depends on keeping a giant repo map, test logs, and several rounds of edits alive in one Codex session, 372k to 272k is not cosmetic.

Don't read this as “Codex got worse” or “nothing changed.” The safer reading is narrower: bundled metadata changed, and stable clients should behave as if the advertised ceiling is lower.

Notice what the smaller window actually exposes

The community reaction split in a useful way. Some developers said they had never felt a context limit in Codex because compaction kept long sessions moving. Others said their hardest coding sessions already push past 200k tokens and sometimes approach 350k before one final compact-and-iterate pass.

Both can be true.

A coding agent can feel continuous even when the raw context window is finite. It may summarize older turns, keep only selected files hot, or lean on repo search and tools instead of carrying every byte forward.

But compaction has a cost. A summary can drop the small reason a test was flaky, the migration constraint from an earlier file, or the exact permission boundary you gave the agent thirty minutes ago.

This is the part that matters for Codex workflows. The danger is not that every task now fails at 272k. The danger is that a long session can become less inspectable right when you most need to know what the agent still remembers.

There is also a cost and latency angle. Serving huge windows is expensive, and every extra chunk of context can slow the loop. It is reasonable for a product to choose a smaller window if most real sessions do not need the larger one.

The open question is the edge case. If you were relying on 300k-plus active context to change a large codebase in one sitting, this metadata change is a good excuse to stop doing that silently.

Keep long Codex runs boring

The practical move is not to panic about the number. It is to make the Codex run smaller, better scoped, and easier to replay.

For Codex CLI workflows, treat the context window as a budget you actively spend. Put durable rules in AGENTS.md, keep task prompts short, and ask Codex to read the smallest useful set of files before editing.

A useful AGENTS.md boundary for a repo might look like this:

# AGENTS.md

- Before editing, list the files you inspected and the reason each file matters.
- Prefer targeted patches over broad rewrites.
- Do not paste full test logs into chat. Summarize failures and keep the command output in the terminal.
- For MCP GitHub access, read issues and pull requests by default. Ask before writing comments, labels, branches, or reviews.
- Before finishing, run the narrowest relevant test and report the exact command.

Then make the verification loop explicit:

git status --short
codex
# ask Codex to inspect only the target package and propose a plan
just test -p codex-models-manager
jq empty path/to/model-catalog.json

The commands will differ by repo. The shape should not: inspect, plan, patch, test, summarize.

This is also where the GitHub trail becomes a practical lesson for Codex CLI. GitHub diffs are durable receipts; chat memory is not. When a Codex session grows long, move the important state back into files, issues, tests, or a short handoff note.

For a related example of treating agent internals as something worth inspecting, see Codex Encrypts Sub-Agent Prompts.

Use this before you run the agent

Copy this checklist into a pull request description, issue comment, or local scratch file before a long Codex run.


## Before you run this Codex agent

- [ ] Scope: name the package, feature, or bug being changed.
- [ ] Files: list the 5-15 files Codex should inspect first.
- [ ] Boundaries: point Codex at the nearest AGENTS.md and note any local rule.
- [ ] MCP: mark external systems as read-only unless this task truly needs writes.
- [ ] Logs: keep long logs out of chat; paste only the failing assertion and command.
- [ ] Context reset: start a new session after a major design change or failed broad attempt.
- [ ] Verification: write the exact command that proves the patch works.
- [ ] Handoff: require a final note with files changed, tests run, and remaining risk.

A small handoff receipt is especially useful after compaction:


## Codex handoff receipt

Changed:
- crates/models/src/catalog.rs
- crates/models/tests/catalog_metadata.rs

Verified:
- just test -p codex-models-manager

Still risky:
- Did not test Windows package metadata.
- Did not inspect older alpha release branches.

Don't ask the agent to “continue” forever. Start a fresh session when the task changes shape. Fresh context is often cheaper than heroic compaction.

Further reading

Next move

Start from CLI workflows.