Start Part 3. Have Codex copy Part 2 into the Part 3 folder, let it grill you on the concurrency rules in two rounds, and use a side chat to ask your own questions while the main run keeps working. By the end you have a written plan and two proposed slices, but no code yet.
GRILL.md updated, a Mermaid diagram and a proposed list of slices. You approve them at the start of guide 14.part-3-business-rules-concurrency in your workshop is still an empty folder (you emptied it in guide 1). Codex fills it in this guide.First check that guide 12's chat has finished its last job (the countdown fix) and is not still working; the ■ Stop button should have turned back into the send arrow. Then, in the sidebar under Projects, hover over workshop and click the pencil icon to start a new chat. New part, new task, new context. The Part 2 chat stays in the sidebar if you ever need to look back at it.
The old chat ends with something like “Done. The countdown runs during bidding, then freezes at ENDED…”. The new chat shows What should we build in workshop? with workshop · Local · master above the message box and the model picker still on 5.6 Sol Medium.
Why this matters: Part 3 is about one hard problem, concurrency. If we started it inside the Part 2 chat, the model would carry 200k tokens of form-building history that have nothing to do with locks and clocks. A clean chat plus the files on disk (AGENTS.md, GRILL.md, the code) is all it needs.
My prompt has three parts, and I want you to notice each one. The first line is housekeeping: copy folder 2 into folder 3 and work only there, so Part 2 stays untouched as a “before” version. The middle paragraph is the actual request, in plain product language: protect bidding against concurrent bids, make sure closed auctions reject bids on the backend (Codex may find this already exists from Part 2, and I say so), and handle stale bids gracefully on the frontend. A stale bid is one typed against a price that changed before you clicked. The last line, “grill me with docs”, turns on the grilling skill you installed in guide 5: instead of building straight away, Codex reads the existing code and docs and interviews you about the decisions. Paste it and press Enter.
copy from folder 2 to folder 3 and work out of folder 3 plz I'd like to add bidding concurrency protection, closed-auction checks to the backend (if they aren't there already, they might be), handling stale bids gracefully on the frontend grill me with docs
A reply similar to: “I'm using the grilling skill to stress-test the feature decisions, and I'll ground the questions in the existing folder 2 code and its local docs.” Then, over a few minutes, Codex:
part-3-business-rules-concurrency, leaving out node_modules (installed packages are re-created by npm install, never copied)auction_part_3, API port 3103, web port 5103 (your ports may differ). Each part gets its own database and ports so Part 2 and Part 3 can run side by side without clashingnpm install and a TypeScript type check to prove the copy still buildsGRILL.md: what Part 2 already enforces and what is missingThe first grilling questions appear after that, so expect a few minutes of “Working…” first.
Grilling plus building Part 3 is one of the bigger runs in the course. Keep an eye on usage at platform.openai.com → Usage if you are watching spend.
While the main chat copies and audits, I have a question I want answered now, and I do not want it mixed into the Part 3 conversation. Click the right-panel button at the top-right of the Codex window (the last icon in the title bar). A menu opens: Review, Terminal, Browser, Files, Side chat. Click Side chat (shortcut ⌥⌘S).
A side chat is a second, temporary conversation about the same project that opens in a panel next to the main chat. It can read your files and answer questions, but nothing you say there enters the main chat's history, and nothing it says changes your code. Use it to understand something, to sanity-check an idea, or to draft a prompt before you send the real thing in the main chat. Side chats disappear when you quit Codex, which is the point: they are scratch paper.
A panel on the right titled Side chat with the note “Side chats are temporary and disappear when you close the app.” It has its own message box. The main chat keeps working on the left; you can watch its progress while you type on the right.
If you do not see Side chat in your Codex version, start a second New chat in the workshop project and ask there. It will not know what the main chat is doing, so mention “part 2/3” and the bidding-war test in your question. The Browser item in this menu is the built-in preview, which is not available with an API key; you do not need it here.
Here is my question. In guide 12 the bidding-war test “passed” while showing duplicate bids. That worries me: a test that passes when the bug is present is not protecting anything. So I want to know whether the test would actually fail if the bug came back after we fix it. Send the first question, read the answer, then send the second.
do the bidding wars tests actually fail when they run? are they checking for concurrency issues?
do we have any concurrency tests?
A reply similar to: “No—the current bidding-war test is a bug-reproduction test, not a protection test.” It passes when duplicate bids are accepted (it asserts duplicateResult.rows.length > 0, meaning “at least one duplicate was found”), so after the fix it must be rewritten to assert the opposite.
Then, to the second question: “So: concurrent bug demonstration—yes; concurrency-safety test—no.”
What it means: we have a reproduction, not a guard. Both are useful, but only a guard keeps the bug from coming back in six months. This answer feeds straight into one of the grilling questions in Step 7.
A trick I use all the time: when I know what I want but not how to say it precisely, I ask Codex to write the prompt. The model knows which words make a request unambiguous for itself. Still in the side chat, send this (the typo in “ithe” is mine; leave it, Codex does not care).
output me a prompt to add some concurrency tests, make ithe prompt short please
A short prompt, similar to mine:
“Add backend concurrency tests for bidding. Send simultaneous bids against the same auction and verify only valid bids are accepted, duplicate amounts cannot both succeed, stale lower bids return 409 with the updated minimum, and bids crossing the closing time are rejected. Replace the existing bidding-war bug assertion with the desired protected behavior.”
Read it as a checklist of what “concurrency-safe bidding” means in testable terms: no duplicates, stale bids get 409 plus the new minimum, bids after close are rejected, and the old bug-proving assertion is flipped.
I do not send this prompt. The grilling round 2 question about protection tests covers the same ground, and I would rather have the decision recorded in GRILL.md than fired off as a one-liner. Side chats are a cheap place to think out loud; not everything you draft there needs to be sent.
Back in the main chat, Codex asks “Round 1 of 2”: about 8–10 numbered questions (the root AGENTS.md caps it at 8–10 per round, 2 rounds maximum). Each looks like ? Q1 – Concurrency invariant: … followed by ➡ I recommend …. Your questions may differ in wording, order and count, so read each one and match it to my answers below by topic, not by number. Three of the questions involve ideas you have not met yet; read the callouts first.
The bid route must decide “has this auction ended?” by comparing the closing time with “now”. Where does “now” come from? Two options. The database clock (PostgreSQL's now()) or the app clock (our Node.js server's time). I choose the app clock, and I want it injected: instead of calling Date.now() directly all over the code, the code receives a small clock object from outside, and in tests we hand it a fake clock that we can set to any moment we like. That is how you test “a bid that arrives one millisecond after closing is rejected” without waiting for a real auction to end. Injection just means “pass the dependency in rather than reaching for it”, and it is the single biggest thing that makes time-based code testable.
Polling means the browser asks the server “anything new?” on a timer, say every two seconds, whether or not anything changed. It is simple and it works, but it is wasteful (most requests return nothing new) and it is never quite live. The alternatives are to refresh only when something happens (after your own bid, or after a conflict error), which is what we choose here, or to have the server push updates to the browser, which is Part 4's topic (WebSockets).
If a user's network hiccups and the browser sends the same “bid $107” request twice, should the server treat it as two bids? An idempotency key solves this: the client attaches a unique id to each request, and the server remembers ids it has already processed and returns the earlier result instead of doing the work again. “Idempotent” means doing it twice has the same effect as doing it once. It is a real production technique, and payments (Part 7) rely on it. For bidding right now it is extra machinery we do not need, because a duplicate $107 bid would simply be rejected as “not higher than $107”. So I say no.
Reply with one numbered line per question. My answers, by topic:
AUCTION_CLOSED, BID_TOO_LOW) → yes. The frontend can switch on a code; it cannot safely parse an English sentence.1. yes 2. in that case, I want us to reject an invalid bid by whether or not the amount is less than the minimum required, and in this particular edge case I do want the $106 bid to win. HOWEVER, if it adds too much complexity right now, skip it. 3. yes, but DATABASE CLOCK????? we're using the app clock baby, and it should be injected in so it can be mocked in tests. 4. yes 5. NO 6. YES!!! 7. YESSSS 8. take the recommend 9. don't do that, keep it simple, too complex
Codex says something like “Your $103 / $106 preference works naturally with serialized validation: $106 is always the final leader…” (because once bids are processed one at a time, $103 is accepted first and then $106 beats it, so no special case is needed), and then posts “Round 2 of 2” starting at Q10.
Shortcuts: “take the recommend” for one question, or a whole-round reply like “1–9 all recommended” (Codex itself suggests this). But if a question does not make sense to you, ask Codex to explain it better instead of saying “don't care”. Every question here is a real design decision that will be in your code for years.
Round 2 has about 8 more questions (Q10–Q17 in my run). They are more detailed than round 1: exact transaction shape, the exact fields in an error response, exact wording on screen. My choices, by topic:
createdAt → yes. If you read the clock before waiting for the lock, a bid could be stamped “before closing” but actually be written after.BEGIN, SELECT … FOR UPDATE, check, insert, COMMIT from guide 11.code, error, currentPriceCents, minimumBidCents, endsAt → yes. The response carries everything the page needs to recover without a second request.endsAt and re-check when the tab becomes visible again → yes. Browsers slow down timers in background tabs, so a re-check on return is needed.10. yes 11. yes 12. yes 13. yes 14. no just gracefully try refreshing again 15. no, just say "you are the highest bidder" 16. yes 17. yes
Codex works for a short while (“Working for 10s… Thinking”), then closes the grilling session and starts writing the plan. Nothing is built yet.
When Codex starts asking very detailed, picky questions (like the exact wording of the success message), you are near the end of what grilling is useful for. That is a good sign: the big decisions are made, and what is left is detail the agent can handle.
Let Codex finish. It writes your round 2 answers into GRILL.md, draws the architecture, and proposes slices. Read all of it, but do not reply yet; you approve the slices at the start of guide 14, after we have looked at what a row lock really does.
The output of a grilling session is a plan: the decisions (in GRILL.md), a diagram of how the pieces connect, and a list of slices, each a thin end-to-end piece of the feature that you can check in the browser. Codex will build one slice, stop, and wait for your review before the next. Two slices for Part 3 is right: the first makes bidding safe under concurrency, the second makes closing authoritative and the page react to it. If Codex proposed four or five tiny slices, or one giant one, I would ask it to regroup them before approving. A good slice is big enough to be worth testing and small enough to review in ten minutes.
A reply similar to: “The decision tree is now complete. I'm closing out the grilling skill by writing Round 2 into GRILL.md, adding the agreed architecture, and decomposing the work into two browser-reviewable vertical slices. I will not start implementation until you confirm those slices.”
Then: “Grilling is complete and documented in GRILL.md. No feature implementation has started.” You get a Mermaid diagram (🌐 React/Vite Web App ↔ ⚡ Fastify API ↔ 🐘 PostgreSQL, plus an Injected App Clock feeding the API) and Proposed slices:
It ends with “Please confirm these two slices.” Leave it there. Open part-3-business-rules-concurrency/GRILL.md in VS Code and check that your answers from Steps 6 and 7 are recorded the way you meant them. If something is wrong, now is the cheapest moment to say so.
If the copy or the grilling went badly wrong, first compare your decisions with the reference project's ~/codex-course/reference/part-3-business-rules-concurrency/GRILL.md; often your run is fine and only worded differently. If you really need to, replace your Part 3 with the finished one from the reference. Note that the reference folder is the end state of the whole part: both slices are already built (the work of guides 14 and 15), so after catching up you would skip ahead to guide 16.
cd ~/codex-course/workshop && rm -rf part-3-business-rules-concurrency && cp -R ../reference/part-3-business-rules-concurrency ./ && git add -A && git commit -m "Catch up: part 3 from reference"
The command deletes your Part 3 folder, copies the reference's Part 3 in its place, and commits the result. Run npm install && npm start inside the new folder before you use it.