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
{{ message }}
Repository navigation
[Medium] deleteSession can race in-flight background post-processing #13
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 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 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.
I’d like to work on this. My proposed narrow fix is to track recorder post-processing by session ID and refuse deletion with a clear message while that session is still processing. I’d add a deterministic regression that holds a fake post-process task open, verifies the session is protected, then verifies deletion becomes available after it resolves; cancellation semantics would remain out of scope.
I see that #62 targets release/0.5.0 and touches both electron/ipc.ts and electron/recorder/controller.ts, and that 0.5.0 may be released shortly. Would you prefer that I base this on release/0.5.0 now, wait for #62/release to land, or target the next release branch?
I’d like to work on this. My proposed narrow fix is to track recorder post-processing by session ID and refuse deletion with a clear message while that session is still processing. I’d add a deterministic regression that holds a fake post-process task open, verifies the session is protected, then verifies deletion becomes available after it resolves; cancellation semantics would remain out of scope.
I see that #62 targets release/0.5.0 and touches both electron/ipc.ts and electron/recorder/controller.ts, and that 0.5.0 may be released shortly. Would you prefer that I base this on release/0.5.0 now, wait for #62/release to land, or target the next release branch?
I’d like to work on this. My proposed narrow fix is to track recorder post-processing by session ID and refuse deletion with a clear message while that session is still processing. I’d add a deterministic regression that holds a fake post-process task open, verifies the session is protected, then verifies deletion becomes available after it resolves; cancellation semantics would remain out of scope.
I see that #62 targets release/0.5.0 and touches both electron/ipc.ts and electron/recorder/controller.ts, and that 0.5.0 may be released shortly. Would you prefer that I base this on release/0.5.0 now, wait for #62/release to land, or target the next release branch?
We'll probably be merging 0.5.0 today or tomorrow so your PR can target 0.6.0 when we have one. Will ping you here.
Thanks adilei — and congratulations on the 0.5.0 release. Sounds good. I’ll wait for release/0.6.0 and your ping before starting, then keep the PR scoped to the per-session post-processing guard and deterministic regression described above.
Activity
newbpydev commentedon Aug 11, 2026
I’d like to work on this. My proposed narrow fix is to track recorder post-processing by session ID and refuse deletion with a clear message while that session is still processing. I’d add a deterministic regression that holds a fake post-process task open, verifies the session is protected, then verifies deletion becomes available after it resolves; cancellation semantics would remain out of scope.
I see that #62 targets release/0.5.0 and touches both electron/ipc.ts and electron/recorder/controller.ts, and that 0.5.0 may be released shortly. Would you prefer that I base this on release/0.5.0 now, wait for #62/release to land, or target the next release branch?
adilei commentedon Aug 12, 2026
Thanks Juan Gomez (@newbpydev) !
We'll probably be merging 0.5.0 today or tomorrow so your PR can target 0.6.0 when we have one. Will ping you here.
newbpydev commentedon Aug 12, 2026
Thanks adilei — and congratulations on the 0.5.0 release. Sounds good. I’ll wait for release/0.6.0 and your ping before starting, then keep the PR scoped to the per-session post-processing guard and deterministic regression described above.