You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once ProjectCodeGenerator moved its scaffolding filesystem work off the event loop (#1250 / #1251), the off-loop hops introduced await (cancellation) points that did not exist when the writes ran inline. A POST /api/v1/video-to-software request that is cancelled or fails mid-scaffold can now leave a uvai_project_* temporary directory that no caller receives or removes.
asyncio.to_thread cannot interrupt a worker thread once it has started, so a cancellation delivered while a scaffolding hop runs raises CancelledError in the coroutine while the thread keeps writing to disk. generate_project never returns the directory path, so nothing cleans it up.
There are two leak windows:
mkdtemp window — cancellation delivered while tempfile.mkdtemp runs; the directory is created but its path is never assigned into a cleanup scope.
write-plan window — cancellation delivered while _apply_write_plan runs; the scaffold is partially/fully written and abandoned.
Acceptance criteria
A request cancelled or failed at any point after the scaffold directory is created removes that directory before propagating.
Off-loop hops wait for their worker to settle before propagating cancellation, so cleanup never races a live writer.
Regression tests cover both windows (cancel during mkdtemp, cancel during _apply_write_plan, and failure during the write plan).
Problem
Once
ProjectCodeGeneratormoved its scaffolding filesystem work off the event loop (#1250 / #1251), the off-loop hops introducedawait(cancellation) points that did not exist when the writes ran inline. APOST /api/v1/video-to-softwarerequest that is cancelled or fails mid-scaffold can now leave auvai_project_*temporary directory that no caller receives or removes.asyncio.to_threadcannot interrupt a worker thread once it has started, so a cancellation delivered while a scaffolding hop runs raisesCancelledErrorin the coroutine while the thread keeps writing to disk.generate_projectnever returns the directory path, so nothing cleans it up.There are two leak windows:
mkdtempwindow — cancellation delivered whiletempfile.mkdtempruns; the directory is created but its path is never assigned into a cleanup scope._apply_write_planruns; the scaffold is partially/fully written and abandoned.Acceptance criteria
mkdtemp, cancel during_apply_write_plan, and failure during the write plan).Fix
Tracked in PR #1252 on branch
claude/determined-maxwell-9t5kou.