Code Room
Vibe codingHardvc-g053
Subject Ai code reviewLevel Senior–Staff~16 minCommon in Code quality & review interviewsIndustries Software development

Question

An agent refactored this Python retry helper 'for clarity.' The tests pass and the diff looks tidier. You didn't write the original and the change is subtle. What behavior changed, and how would you have caught it without staring at the diff?

python
def call_with_retry(fn, attempts=3, base=0.5):    last_exc = None    for i in range(attempts):        try:            return fn()        except (TimeoutError, ConnectionError) as e:            last_exc = e            time.sleep(base * 2 ** i)    raise last_exc

The original had caught only `TimeoutError`; the refactor 'tidied' the except to also include `ConnectionError`.

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.