Two local coding agents tested on the same failing JavaScript test with observed patches and timings.
Both Claude Code and OpenAI Codex fixed the same failing JavaScript test with a minimal 1-line patch and passed independent test reruns (2/2 tests passing). Codex finished slightly faster on this fixture (45s vs 52s), while both required paid plans or API billing. Checked .
Codex vs Claude Code at a Glance
Dimension
Claude Code
OpenAI Codex
CLI version tested
Claude Code CLI 2.1.322
Codex CLI 0.171.0
Elapsed time (same fixture)
52 seconds
45 seconds
Independent npm test rerun
2/2 passing (0 test edits)
2/2 passing (0 test edits)
CLI source availability
Source-available npm/CLI distribution
Open-source CLI (Apache-2.0 on GitHub)
Billing & access
Paid Claude plan (Pro/Max/Team) or Anthropic API
Paid ChatGPT plan (Plus/Pro/Business) or OpenAI API
MCP & Skills support
Native MCP servers + .claude/skills SKILL.md
Native MCP servers + .agents/skills SKILL.md
Best everyday fit
Deep terminal refactors, multi-file explanations, Anthropic ecosystem
Fast CLI diffs, open-source harness, cloud + local Codex workflows
The shared brief
Reusable prompt
Fix the failing cart total test in this small repository. Return the final total in integer cents after applying the discount. Preserve the API and the passing behavior. Update the implementation, keep the existing tests intact, and run npm test.
Each tool starts from the same independent checkout (1 passing, 1 failing at baseline). The evaluator reruns npm test outside the agent and inspects the diff.
Observed verification capture
Independent Node.js test runner verification of the baseline fixture (1/2 passing) and the observed 1-line patches produced by Claude Code and OpenAI Codex (both 2/2 passing, zero edits to cart.test.js).
Changed cart.js to round subtotal * (100 - discountPercent) / 100. Independent npm test rerun passed 2/2 tests with zero test-file edits.
Elapsed time
52 seconds (Claude Code CLI 2.1.322)
Access and cost
Paid Claude plan or Anthropic API billing. The first headless attempt hit a sign-in error; the successful run loaded existing local user settings. Per-run token cost was not separately metered.
Changed cart.js to subtract the unrounded discount before rounding the final total. Independent npm test rerun passed 2/2 tests with zero test-file edits.
Elapsed time
45 seconds (Codex CLI 0.171.0)
Access and cost
Paid ChatGPT subscription or OpenAI API billing. Used an existing ChatGPT login. Per-run token cost was not separately metered.
Both Claude Code and OpenAI Codex produced clean, mathematically equivalent 1-line fixes without modifying tests. Because both are reliable on small bug fixes, your choice usually comes down to existing subscription coverage (Claude vs ChatGPT), whether you want Codex's open-source CLI harness, and how each performs on your own multi-file repository.
On our verified two-test JavaScript checkout benchmark, OpenAI Codex CLI (0.171.0) completed the patch and test run in 45 seconds compared to 52 seconds for Claude Code CLI (2.1.322). Latency varies by model tier, prompt size, and API load, so run both on a representative test in your own repository.
Can I use Claude Code or OpenAI Codex for free?
No full free tier is included for either agent. Claude Code requires a paid Claude subscription or Anthropic API credits, while Codex requires an eligible paid ChatGPT subscription or OpenAI API billing (even though the Codex CLI repository itself is open source). For coding agents with free starter tiers, check our Best Free AI Agents guide.
Did either tool modify the test file to make the test pass?
No. We inspected git diff after both runs and confirmed zero modifications to cart.test.js. Both agents edited only cart.js with a single-line rounding fix and passed independent npm test reruns (2/2).
Do both Codex and Claude Code support MCP servers and SKILL.md skills?
Yes. Both CLIs support connecting Model Context Protocol servers such as GitHub MCP, Playwright MCP, and Context7 MCP, and both can load reusable SKILL.md instruction packs.