Varun Vemulapalli

Day 62 of 100 ยท Phase 8: OpenAI Codex

Setting up Codex and your first task

2 min readBy Varun Vemulapalli

Your first job for an AI coding agent shouldn't be "build me an app."

It should be one failing test, one small fix, and a diff you can read in two minutes.

Video explainer ยท 1:46
Key takeaway

Install Codex, sign in with ChatGPT, commit a checkpoint, and start with one failing test you can verify yourself.

Day 62 visual: Setting up Codex and your first task
The visual from the original post.

The concept

A test is a tiny program that checks your code gives the expected answer. A failing test is a clear, checkable task: Codex can run it, change code, and run it again until it passes. That makes it the perfect first task.

Two setup ideas to know:

  • Sign-in: Codex uses your ChatGPT account ("Sign in with ChatGPT"). An API key also works, billed at API rates, but without the cloud features.
  • Sandbox: a fenced area Codex works inside. In a Git folder the recommended mode, Auto, lets it edit files and run commands in that project folder, and it asks before going outside it or using the internet.

Walkthrough: fixing a grocery-list app

Illustrative setup: a small grocery-list app with 12 tests. One fails:

"adding Milk, then milk, should give 1 item with quantity 2"
Expected 1 item, got 2.

1. Install the CLI (one of these):
npm install -g @openai/codex
brew install --cask codex
2. Save a checkpoint first, so you can undo anything: git add, then git commit (Day 48).
3. In the project folder, run: codex
4. Choose Sign in with ChatGPT and complete the sign-in.
5. Prompt: "Run the tests. One fails. Find the cause, fix it with the smallest change, and run the tests again. Don't edit the test."
6. Codex runs the tests, opens the add-item function and notices it compares names exactly, so "Milk" and "milk" count as different items. It proposes comparing names in lowercase.
7. It reruns the tests: 12 of 12 pass.
8. Type /diff to see every changed line. Read it before you commit.

Notice the last instruction in step 5. "Don't edit the test" stops the agent from "fixing" the problem by changing what counts as correct.

Where you see it at work

  • Banking: a failing check on rounding interest to two decimals.
  • Insurance: a broken date check on policy renewals.
  • Healthcare: a scheduling test failing after a daylight-saving change.
  • Retail: a price test failing after a currency format change.
  • Product owners: "make this failing test pass" is an acceptance criterion an agent can verify.

Try it today (10โ€“15 min)

1. Follow the CLI page to install: https://learn.chatgpt.com/docs/codex/cli
2. Open any small project with tests (or ask Codex to create a tiny one with one deliberately failing test).
3. Commit first, then give the prompt from step 5.
4. Run /diff and /status, and note what Codex was allowed to do.

In one sentence

Install Codex, sign in with ChatGPT, commit a checkpoint, and start with one failing test you can verify yourself.

What small, checkable task would you hand an agent first? ๐Ÿ‘‡