Codex CLI ships with a context window that OpenAI has deliberately tuned — and on August 17, 2026, OpenAI's Tibo Sottiaux (@thsottiaux), who works on Codex and ChatGPT, posted the exact steps to override it to a full 1,000,000 tokens using GPT-5.6 Sol. The post landed in the same-day AI news cycle under headlines like "OpenAI Engineer Shares Fix for Full 1M Token Window in Codex" — evidence that a config lever most users never touch is one of the most-requested Codex settings there is.
This guide reproduces Tibo's exact config, explains what model_context_window and model_auto_compact_token_limit actually control, and — more importantly — covers when the 1M window is worth the tradeoff and when the smaller default is the better call. If you're already fluent in Claude Code's own context management and auto-compaction, the concept maps directly across tools; this post flags where it doesn't.
Quick reference
| Question | Answer |
|---|---|
| What model supports 1M context? | GPT-5.6 Sol — documented 1,050,000-token context window |
| How do I set it permanently? | Edit ~/.codex/config.toml, add three top-level keys, restart Codex |
| How do I try it once without changing defaults? | Pass -m gpt-5.6-sol -c model_context_window=1000000 -c model_auto_compact_token_limit=900000 as CLI flags |
| Why isn't 1M the default already? | OpenAI tunes the default window for cost and performance — a larger window costs more per request |
| Does compaction still happen at 1M? | Yes — model_auto_compact_token_limit=900000 leaves ~100K tokens of headroom before the ceiling |
| Is this free? | No — more tokens in context means more tokens processed per request |
| Does it actually hit 1M on a subscription plan? | Reportedly not always — some Codex subscription users see an effective ~360K cap regardless of the config value; verify your own session |
What does a context window actually control?
The context window is the budget of tokens — code, tool output, and conversation history — that Codex can hold in a single session before it has to start summarizing (compacting) older material to make room. Every file Codex reads, every shell command's output, every prior turn of the conversation counts against that budget. If you want the fuller mechanics of what a token budget is and how it differs from parameter count, explainx.ai has a complete context window explainer that covers the concept model-agnostically.
In an agentic coding session specifically, the context window fills up faster than it does in a plain chat, because tool output — grep results, test logs, file diffs, build errors — accumulates on top of the conversation itself. That's why long-running Codex sessions hit compaction sooner than a casual back-and-forth would suggest.
Why compaction quality matters for long sessions
When Codex approaches its context limit, it compacts: it summarizes older history into a condensed form to free up token budget. Compaction is necessary — without it, a session simply can't continue once the window fills — but it's lossy. Details get dropped or generalized, and a long-running agent session that compacts repeatedly can lose track of earlier decisions, edge cases it already ruled out, or exact values it read from a file three compactions ago.
This is the practical reason context window size matters beyond raw capacity: a bigger window means fewer compactions over the life of a session, which means less accumulated summarization drift. model_auto_compact_token_limit is the lever that controls exactly when that first compaction kicks in.
Why OpenAI's default is smaller — on purpose
Tibo was explicit about this in the same post: "Have fun, but also know that we tuned the default carefully!" That line is the whole caveat. OpenAI tunes Codex's default context limit for what it considers optimal performance and cost — the smaller default isn't a missing feature, it's a deliberate tradeoff.
Two mechanisms explain why a larger context window isn't free:
- Cost scales with tokens processed. A larger window means more tokens can accumulate in a session, and more tokens sent per request costs more — this is true across every provider, not just OpenAI.
- Inference can slow and attention can dilute. Processing a much larger context takes more compute per turn, and models can have a harder time weighting genuinely relevant content when the window is stuffed with older, less relevant history.
A 1M-token window is a common user request — Tibo's post exists because enough people were asking for it that OpenAI decided to document the override rather than field the same question repeatedly. But "common request" and "correct default for most sessions" are different things, and the closing line makes clear which one OpenAI is optimizing the default for.
The exact config: persistent default
To make the 1M window Codex's default going forward, edit the Codex config file directly.
Step 1. Open ~/.codex/config.toml.
Step 2. Add these three lines at the top level — before any [section] headers in the file:
model = "gpt-5.6-sol"
model_context_window = 1000000
model_auto_compact_token_limit = 900000
Each key does one job:
| Key | What it sets |
|---|---|
model | Selects GPT-5.6 Sol as the active model |
model_context_window | Sets Codex's context budget to 1,000,000 tokens |
model_auto_compact_token_limit | Sets the token count (900,000) at which Codex starts automatic history compaction |
The 900K auto-compact limit against a 1M ceiling leaves roughly 100K tokens of headroom — enough room for Codex to finish its current turn and compact cleanly rather than hitting the hard limit mid-response.
Step 3. Restart the Codex client and start a new session. The setting does not apply retroactively to a session already in progress.
The exact config: one-off CLI flags
If you want to try the 1M window without touching your default config, pass the same three settings as flags for a single invocation:
codex -m gpt-5.6-sol \
-c model_context_window=1000000 \
-c model_auto_compact_token_limit=900000
This is the lower-commitment path — nothing persists once the session ends, so it's a reasonable way to test whether the larger window is actually worth adopting as a default before editing config.toml. For the full list of what else you can configure or invoke inline, see explainx.ai's Codex slash commands reference, which covers /model, /compact, and the rest of Codex CLI's built-in command set.
Does this actually work on a Codex subscription plan?
Here's the wrinkle worth knowing before you build a workflow around this: the config above is the documented, correct way to request a 1,000,000-token context window, but whether Codex actually honors that value in full appears to depend on how you're billed.
Reports surfacing the same day as Tibo's post describe Codex subscription-plan users — ChatGPT Plus, Pro, or Work billing, as opposed to pay-as-you-go API billing — setting model_context_window = 1000000 exactly as documented and still hitting an effective ceiling around 360,000 tokens in practice. The config accepts the value without erroring, but the larger window doesn't appear to get honored past that point on subscription tiers.
That's a meaningfully different number from the 1M ceiling the config implies, and it's the kind of gap that only shows up once a long session actually needs the extra headroom — not at setup time. A few things worth doing before you rely on this:
- Don't assume the config value is authoritative. Setting
model_context_windowtells Codex what to request; it doesn't guarantee the backend enforces that ceiling on every billing tier. - Check your actual effective context during a session. Watch Codex's own context/token usage indicator as a session grows, or deliberately push a session with a large file or long tool output past 360K tokens and see whether compaction kicks in earlier than the 900K limit you configured.
- API/pay-as-you-go billing is the more likely path to the full 1M window, based on these reports — if the larger window is load-bearing for your workflow, that's worth confirming directly rather than assuming subscription billing gets you there.
This doesn't change the correctness of the config steps themselves — they're still the documented, official way to set the values — but it's a real gap between the documented ceiling and what subscription users are reporting in practice. Treat it as an open question rather than a settled bug or a settled feature: it may be a plan-tier limitation OpenAI intends, or a bug that gets fixed in a later Codex CLI build. Either way, verify your own effective window before you plan a long-running session around having the full 1M available.
When is the 1M window actually worth it?
The replies to Tibo's post surfaced the real use case better than the post itself did. SamG (@SamGCoder) proposed a "Codex Work Mode" dropdown with three presets — essentially proposing UI shortcuts for the exact manual config above:
| Preset | Context budget | Compaction timing | Best for |
|---|---|---|---|
| Balanced | ~300K | Early | Normal, everyday coding tasks |
| Large Codebase | ~600K | Moderate | Sessions touching a lot of the repo, more retained tool history |
| Long-Running Investigation | ~1M | Late | Multi-hour debugging, large refactors, heavy accumulated tool output |
That framing maps well onto reality even without OpenAI shipping the dropdown itself:
- Long-running investigations — multi-hour sessions chasing a bug across many files, where losing earlier context to compaction means re-discovering facts you already established.
- Large codebases — sessions that need to hold a wide swath of the repo plus test output simultaneously, rather than context-switching in and out.
- Multi-hour agent sessions with heavy tool output — anything generating large logs, verbose test runs, or extensive
grep/findoutput that would otherwise force early, repeated compaction.
Fab (@pureFabx) took the discussion further, joking about "Sol orchestrating Luna swarms" as the current meta and asking for a "Shepherd toggle" — a half-joking nod to real interest in multi-agent orchestration patterns where a larger context window helps a coordinating model track more sub-agent output at once. If you're exploring that kind of orchestration, explainx.ai's loop engineering guide covers the guardrails that make long-running, low-supervision agent loops safe to leave running.
When the smaller default is the better call
For everyday coding tasks — a focused bug fix, a single-file change, a quick feature — the smaller default is doing its job: it compacts sooner (which is fine, since there's less history worth preserving), keeps per-request cost down, and avoids diluting the model's attention with irrelevant history from earlier in the session. If most of your Codex sessions look like this, the 1M window is pure overhead — you'd be paying for capacity you never fill.
The honest framing here matters: this is a config lever with real cost implications, not a free upgrade. Treat it the way you'd treat any resource ceiling — set it to match the actual shape of the work, not to the maximum available.
The Claude Code parallel
If you're coming from Claude Code, the underlying mechanic will feel familiar: Claude Code also auto-compacts prior messages as a session approaches its context limit, summarizing older turns to keep the conversation going. The tuning knobs differ, and this Codex feature is OpenAI's own — explainx.ai isn't claiming Claude Code implements this exact model_context_window / model_auto_compact_token_limit mechanism — but the tradeoff is the same across harnesses: more retained history costs more and can slow things down, while earlier compaction keeps sessions cheap but loses detail sooner. Anyone comparing the two tools' approaches to context management day to day will find explainx.ai's Codex vs Claude Code comparison useful background, and the agent harness guide breaks down why context and memory management is one of the core jobs any coding agent harness has to solve.
For teams actively fighting token bloat rather than just raising the ceiling, Headroom's context-compression approach — reversible compression of tool output, logs, and file content before it reaches the model — is the complementary lever: instead of paying for a bigger window, shrink what goes into the window in the first place.
What this fits into
This isn't OpenAI's first Codex context or usage change this cycle — GPT-5.6 Sol's rollout has come with several tuning adjustments, including thinking-budget and reset changes Tibo shipped in July, and Codex itself just crossed 15 million users earlier in August. A documented context-window override sits in the same pattern: OpenAI shipping conservative defaults, then publishing the exact levers power users can pull once they understand the tradeoff.
Related reading
- What is a context window? LLM 'working memory' explained
- Codex slash commands: complete CLI reference
- Claude Code commands: complete slash command reference
- Loop engineering: designing coding agent loops that run while you sleep
- Headroom: context compression for AI agents
- Codex vs Claude Code: the developer verdict
- What is an agent harness?
- GPT-5.6 Sol thinking budget: Tibo denies the nerf, adds banked resets
Config keys, model name, and context-window figures in this post are accurate as of August 17, 2026, per Tibo Sottiaux's post. Config syntax and defaults can change in future Codex CLI releases — check codex --help or the official OpenAI Codex documentation if a setting here doesn't match your installed version.
