Code RoomTimeout cancellation cleanup leak
HardPrep Room Coding #4148

Timeout cancellation cleanup leak

Vibe & agenticConcurrencySenior~20 min

An AI wrote this Python asyncio function that runs a task with a timeout and cleans up a temp resource. It uses asyncio.wait_for. Review the cancellation/cleanup behavior.

The author thinks cleanup is guaranteed. What subtle bug can leave the system in a bad state?

Implement
finalize_jobs(event_lines: list[str], shield_cleanup: bool) → list[str]
Examples
in[["acquire|j1","cleanup_done|j1","release|j1"],true]out["released:j1"]
in[["acquire|j1","cancel|j1","release|j1","cleanup_done|j1"],true]out["released:j1"]
in[["acquire|j1","cancel|j1","release|j1","cleanup_done|j1"],false]out["unsafe_release:j1"]
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 20 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.