Finish the four-window Bidding War test and watch the race condition happen on your own screen. Along the way, practise steering Codex mid-run: stop it, queue messages, and send it a screenshot instead of a paragraph.
http://localhost:5102).Before the windows start flying around, look at what Codex has actually written. You have three ways: the Review panel in Codex (click the “N files changed” line under Codex's message to open a diff of every file), VS Code's Source Control view (Ctrl+Shift+G), or the Terminal command below, which lists changed files one per line.
cd ~/codex-course/workshop && git status --short
Open tests/bidding-war.spec.ts in VS Code and skim it even if you cannot follow every line. You will recognise the story from your prompt: create a seller, post an auction that ends in 20 seconds, open three bidder windows, fire bids. A test file reads like a script of what a user does, and that is exactly how I want you to read it.
Four changed files in part-2-create-auction-and-bid, similar to:
package.json: a new test:bidding-war script (so npm run test:bidding-war works) and Playwright added as a dev dependency, meaning a package needed for development and testing, not for running the app in production.package-lock.json: npm's exact record of which package versions were installed. It changes automatically whenever a dependency is added.playwright.config.ts: new. Playwright's settings: which browser to launch, headed or headless, timeouts, where the app is running.tests/bidding-war.spec.ts: new. The test itself. Inside, the seller is Avery and the bidders are Maya, Theo and Priya, four of the ten seeded users from guide 9.Codex may also add extras you did not ask for, like an on-screen “current bidder” label or a countdown timer in each window. I got those too. They come from the “make it a fun visual” line in the prompt, and they turn out to be useful for reading the race.
While Codex works, macOS may pop up permission dialogs. This is normal. Codex runs small scripts to bring the test windows to the front and arrange them, and it takes screenshots to check that the layout looks right. macOS treats both as sensitive, so it asks you once per app. Allow them:
The dialogs go away and Codex carries on with its to-do list. On first use you may need to approve several of these in a row (one for each browser, one for screen recording). After that macOS remembers your answer.
Move other apps out of the way. In my run, a presentation app was covering the browser windows, so Codex's screenshot showed that app instead of the browsers and the layout check failed. Codex sees your screen exactly as you do; if something is in front, it is in front for Codex too.
In my run Codex got stuck: the browser was blocked by a permission and the windows were covered. Rather than wait for it to flail, I pressed the Stop button (the round ■ at the right end of the message box, where the send arrow normally is). Then I sent a new message telling it what had changed and, while I was at it, told it to use Edge. Do the same if your Codex is stuck on a blocked browser or a covered window. If it is working fine, you can still send the Edge message so your setup matches the rest of the course.
presentation is gone, chrome is allowed, but go ahead and use edge
chrome is allowed, go ahead and use chrome
Notice the shape of the message: first what changed in the world (“presentation is gone, chrome is allowed”), then the new instruction. After a Stop, Codex has no idea why you stopped it, so tell it.
A reply similar to: “Perfect—I'll switch the demonstration to Microsoft Edge. I'm also correcting the harness timeout…” Then a working line like “Modifying project for Edge channel launch”. In the finished test, playwright.config.ts uses channel: 'msedge' (Playwright's name for “launch the Edge that is installed on this Mac”) and the npm script runs with --project=edge.
Stop + new message throws away the rest of Codex's current plan; it keeps the chat history but abandons whatever it was in the middle of. Use it when Codex is clearly going the wrong way. For small nudges, the next step shows two gentler options.
While Codex is working, type something in the message box and press Enter. It is not sent right away. It sits in a strip above the box as a queued message. Each queued message has three controls:
If you leave a queued message alone, it goes out automatically when Codex finishes its current turn. Try it with a throwaway word, then delete it. I did exactly this as a demo.
thing
A little later, when I saw the windows stacked on top of each other instead of tiled, I queued this one for real:
the windows arent tiled lol
“Open in side chat” starts a second, separate conversation about the same project, next to the main one, without interrupting the work in progress. Use it for questions that should not become part of the main task's history: “explain what this trigger does”, “what does channel: 'msedge' mean?”, “is there a simpler way to tile windows?”. The main chat keeps building; the side chat answers you; and the main chat's context stays clean. Think of it as asking a colleague a question at the next desk without stopping the person who is typing.
The message sits in a strip above the input with Steer, a trash icon and ⋯. Delete the thing message with the trash icon. About a minute after I queued “the windows arent tiled lol”, Codex started tiling the windows on its own, so I deleted that one too before it was sent. Queued messages are cheap to write and free to cancel.
Three levels of intervention: Queue = “do this next”. Steer = “change course now, but keep going”. Stop = “halt, I'll give new instructions”. Pick the lightest one that does the job.
Let Codex run the test. It runs BIDDING_WAR_HOLD_MS=3600000 npm run test:bidding-war (guide 11 explained that environment variable: hold the windows open for up to an hour afterwards so you can inspect them). Keep your hands off the mouse while the windows appear; clicking into a window during the run can steal focus from the test.
Four browser windows open on the Part 2 app (in my run the URL was localhost:5102/items/bidding-war-gpu-…, a fresh auction the test created), each with a coloured label in the corner: SELLER · AVERY, BIDDER 1 · MAYA, BIDDER 2 · THEO, BIDDER 3 · PRIYA, plus a countdown like T-12.5s. At first they may be stacked on top of each other, not tiled; we fix that in Step 6. The bidders bid at the same moment; labels show things like “RACE: duplicate $102 bids accepted”.
Codex reports something like: the corrected run found the concurrency defect, $102 accepted twice and $107 accepted three times. That is the race condition from guide 11, happening live: three bidders read the same current price, all passed the check, all got inserted.
Codex may say Edge “collapsed” the separate profiles into one process and switch to one Edge process with four separate contexts. A context is Playwright's isolated browser session, with its own cookies and storage, so four contexts still behave as four different users. That is Codex fixing its own harness; let it.
Screenshots and reruns cost tokens. Every screenshot Codex takes is an image sent to the model, and images are expensive compared with text. That is why in the next step I send my own screenshot with a one-line description instead of asking Codex to look again.
If the 2×2 grid is partly off-screen or the windows overlap, show Codex rather than describe it. First find your screen's logical size, the “looks like” resolution that macOS actually lays windows out in (it is smaller than the pixel count on a Retina display):
system_profiler SPDisplaysDataType | grep -i "looks like"
system_profiler SPDisplaysDataType prints everything macOS knows about your displays; | grep -i "looks like" keeps only the line containing that phrase (-i ignores upper/lower case). It prints something like UI Looks like: 1512 x 982 @ 120.00Hz. Those two numbers are your screen size for the prompt.
Now take the screenshot with Cmd+Ctrl+Shift+4 and drag a rectangle over the browser windows. Adding Ctrl copies the picture to the clipboard instead of saving a file. Click the Codex message box and press Cmd+V; a thumbnail appears. (Plain Cmd+Shift+4 saves a file on the Desktop instead; you can drag that file into the message box.) Then paste the prompt below, replace 1440x900 with your numbers, and send.
the screen we're working on is 1440x900, the tiles are slightly askew, see picture
A thumbnail of your picture above the message, then a reply similar to: “Yep—the harness used 1728×1080 logical bounds, so on this 1440×900 display the right column and bottom row extend past the usable screen. I'll retile to exact 720-pixel columns and 437-pixel rows beneath the macOS menu bar…” Codex makes the tiling display-aware, adds screen width and height overrides (environment variables you can set yourself; see the Stuck box), and reruns the test. This time: four windows in a neat 2×2 grid.
Codex models are multimodal: they read images as well as text. A screenshot you take yourself is quicker, cheaper and more precise than three sentences describing which window overlaps which. Use pictures whenever the problem is visual.
One small polish. The label timer in each window kept counting up after the auction ended (for example +109.2s), which is distracting when you are trying to read the result. Ask Codex to freeze it. This is the kind of short, conversational follow-up you send while the previous work is still fresh in the chat.
looks good, can you stop the timer when it ends and just put ended, and not show the seconds countdown
A reply similar to: “Yep—I'll keep the live T–s countdown while bidding is open, then freeze it permanently at ENDED once the deadline passes. No post-close +109.2s count-up.” Codex edits tests/bidding-war.spec.ts and launches the final run in the 2×2 grid. Four windows again, a 20-second auction, bids flying.
When the auction ends, click the seller's window (Avery) and scroll down to Bid history. This is the moment the whole exercise was for. Read the list slowly.
Every window's label reads ENDED. The seller's label says “BUG REPRODUCED — duplicate valid-looking bids”. In Bid history you see two (or more) bids for the same amount at the same time; in my run, Maya and Priya both at $107. Codex's message says something like: “Done. The countdown runs during bidding, then freezes at ENDED…”
What it means: in a correct auction, two bids can never share the same amount, because the second one should have been rejected as “not at least $1 higher”. Two bids at $107 prove that both requests read the same old price before either wrote. You now have a repeatable test that shows the concurrency bug on demand. Part 3 fixes it, and this same test will tell us whether the fix works.
The windows stay open for up to an hour (BIDDING_WAR_HOLD_MS=3600000). Close them yourself when you are done looking (Cmd+Q in Edge closes all four).
You do not strictly need a commit here; the next required one is at the end of Part 3, in guide 15. But a commit now means that when you review Part 3's changes later, the diff shows only the fix and not the test harness mixed in. I recommend it.
cd ~/codex-course/workshop && git add -A && git commit -m "Part 2: bidding war test reproduces the race"
A line like [master 1a2b3c4] Part 2: bidding war test reproduces the race with about 4 files changed (your branch may be called main instead of master; both are fine). The message is deliberately descriptive: six months from now, “reproduces the race” tells you exactly what this commit was for.
If your test will not run, or looks very different from what this guide describes, take the finished Part 2 from the reference project. The reference folder is the end state of the whole part: all Part 2 slices plus this finished bidding-war test. Then run the test yourself in two Terminal windows: one keeps the app running, the other runs the test against it. The reference test needs Microsoft Edge. Set BIDDING_WAR_SCREEN_WIDTH and BIDDING_WAR_SCREEN_HEIGHT to your “looks like” numbers from Step 6 if your screen is not 1440×900.
cd ~/codex-course/workshop && rm -rf part-2-create-auction-and-bid && cp -R ../reference/part-2-create-auction-and-bid ./ && git add -A && git commit -m "Catch up: part 2 from reference"
cd ~/codex-course/workshop/part-2-create-auction-and-bid && npm install && npm start
cd ~/codex-course/workshop/part-2-create-auction-and-bid && BIDDING_WAR_SCREEN_WIDTH=1440 BIDDING_WAR_SCREEN_HEIGHT=900 BIDDING_WAR_HOLD_MS=600000 npm run test:bidding-war
In the third command, the three NAME=value pairs before npm are environment variables passed only to that one command: the screen size for tiling, and a 600,000 ms (10 minute) hold so the windows stay open while you look. Change the two screen numbers to yours.