Code RoomMissing timeout on downstream call
HardPrep Room Coding #4428

Missing timeout on downstream call

Vibe & agenticDistributed systemsSenior–Staff~18 min

An AI agent wrote this API-Gateway Lambda (TypeScript) that calls a flaky downstream service. When the downstream slows down, the Lambda bill spikes and clients get 504s. The HTTP call itself works. What's missing and why does it cost money?

Implement
billed_ms_per_request(downstream_ms: list[int], call_timeout_ms: int, function_timeout_ms: int, fallback_ms: int) → list[int]
Examples
in[[120,8000,45],2000,30000,50]out[120,2050,45]
in[[50000],60000,30000,50]out[30000]
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.

0:00 of about 18 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.