Code Room
Vibe codingMediumvc-g141
Subject Ai code reviewLevel Mid–Senior~16 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

An agent wrote this Python retry helper for flaky HTTP calls and it looks clean and reasonable. Two things are wrong — one is a hallucinated/misused API, the other is a logic bug that defeats the purpose of the retry. Identify both, explain what each does at runtime, and give the fix.

python
import requests, time def get_with_retry(url, retries=3, backoff=0.5):    for attempt in range(retries):        try:            resp = requests.get(url, timeout=5)            resp.raise_for_error()        # raise on 4xx/5xx            return resp.json()        except requests.HTTPError:            time.sleep(backoff * attempt)  # exponential backoff            continue    return None
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.