Severity
Medium — race between deletion and background work; can corrupt/partially write into a deleted session dir.
Location
electron/ipc.ts:196 (deleteSession handler) validates sessionId and refuses deletion only while the session is actively recording (lines 198–199) — it does not account for post-processing.
electron/recorder/controller.ts:517 (schedulePostProcess) runs describer/frame work after stop() returns, in the background.
Mechanism
Right after Stop, post-processing (analysis, frame extraction) is still running for the session. Nothing prevents the user from deleting that same session in the same window, so background tasks can write frames/analysis into a directory that deleteSession is concurrently removing.
Impact
Orphaned/partial files, write-after-delete errors, or a resurrected half-session directory.
Suggested fix
Track in-flight post-processing per session id; have deleteSession cancel (or await) it before removing the directory — or refuse deletion with a clear message while post-processing is active (mirroring the active-recording guard).
Regression test to add (npm test)
Unit test: start a fake post-process task for a session, call deleteSession while it's pending, and assert the delete either cancels/awaits it and that no write lands after the directory is removed. Deterministic; not an evals/ concern.
Severity
Medium — race between deletion and background work; can corrupt/partially write into a deleted session dir.
Location
electron/ipc.ts:196(deleteSessionhandler) validatessessionIdand refuses deletion only while the session is actively recording (lines 198–199) — it does not account for post-processing.electron/recorder/controller.ts:517(schedulePostProcess) runs describer/frame work afterstop()returns, in the background.Mechanism
Right after Stop, post-processing (analysis, frame extraction) is still running for the session. Nothing prevents the user from deleting that same session in the same window, so background tasks can write frames/analysis into a directory that
deleteSessionis concurrently removing.Impact
Orphaned/partial files, write-after-delete errors, or a resurrected half-session directory.
Suggested fix
Track in-flight post-processing per session id; have
deleteSessioncancel (or await) it before removing the directory — or refuse deletion with a clear message while post-processing is active (mirroring the active-recording guard).Regression test to add (
npm test)Unit test: start a fake post-process task for a session, call
deleteSessionwhile it's pending, and assert the delete either cancels/awaits it and that no write lands after the directory is removed. Deterministic; not anevals/concern.