Code Room
Vibe codingMediumvc-g178
Subject Ai code reviewLevel Mid–Senior~16 minCommon in Concurrency interviewsIndustries Software development

Question

An AI agent wrote this Node.js webhook handler that charges a customer and then logs the event. It says the try/catch makes it robust. Review it.

typescript
async function handleWebhook(req: Request, res: Response) {  const { customerId, amount } = req.body;  try {    chargeCustomer(customerId, amount);        // returns a Promise    await db.insert('charges', { customerId, amount, status: 'ok' });    res.status(200).json({ ok: true });  } catch (err) {    await db.insert('charges', { customerId, amount, status: 'failed' });    res.status(500).json({ ok: false });  }}

What breaks, and what symptom shows up in prod?

What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.