How to Automate Pull Requests With Codex MAX
Codex MAX can run in CI to open reviewable pull requests automatically. Here is the agent config, guardrails, and the failure modes to watch.
Codex MAX is OpenAI’s long-horizon coding agent, released in 2026 as an upgrade to Codex. It targets tasks that run for hours rather than minutes — migrating a framework, clearing a backlog of failing tests, or reviewing a large pull request — and it is available both in the cloud and as a CLI.
It is OpenAI’s agentic coding product, distinct from plain ChatGPT. “MAX” refers to sustained sessions: the agent keeps a plan across many tool calls, runs the test suite, and revises. It competes directly with Anthropic’s Claude Code and Google’s Gemini CLI, and it plugs into GitHub so reviews can happen on pull requests without a human prompt.
Long sessions are the differentiator. Most agents lose coherence after a dozen tool calls; this one can hold a plan across a lunch break. That matters for migrations where step 40 depends on a decision made in step 3.
The trade-off is cost and supervision. Hour-long sessions burn tokens fast, and while the sandbox is safe, a flailing agent can still produce a large confusing diff. Budget for review time, and give it clear acceptance criteria — “tests pass” beats “improve the code”.
Engineering teams with legacy code, large test suites or repetitive maintenance work get the most out of it. Solo hobbyist projects rarely justify the price. If your repo is small and your tasks are one-file edits, a cheaper assistant will do the same job.