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
Several smaller robustness gaps can leave recordings or the session registry in a bad state. None of them is common, but each is silent when it happens.
The event log ignores overwrite. With events: true, start_recording writes <base>.events.jsonl and appends to <base>.events.raw without checking the existing-file protection that applies to output (Enhancement: tools silently overwrite an existing output path #37).
src/tools/startRecording.ts:176 (eventPaths(output)); the writeFileSync in src/utils/events.ts:314.
A recycled server pid keeps a crashed record "recording" forever.isForeignLiveRecording trusts isAlive(serverPid), which also returns true on EPERM, so a crashed server's pid that has been reused by any other process makes the record look foreign and live. pruneRecords never prunes active records, so list_sessions shows a phantom recording indefinitely.
src/utils/sessions.ts:94-114, :407.
Stale-lock takeover race. Two waiters can both judge the lock stale. A unlinks it and takes it, then B unlinks A's fresh lock and takes it too, so both run the read-merge-write at once and one update is lost.
src/utils/sessions.ts:240-246.
sleepSync (Atomics.wait) also blocks the event loop for up to about 3 s.
find_text runs a user regex on the main thread.new RegExp(query, "gi") with matchAll (src/utils/ocr.ts:142). A catastrophic pattern such as (a+)+$ freezes the whole server, including stop_recording and the shutdown handlers. Local trust model, so this is hardening rather than a vulnerability.
Suggested approach
Run the event sibling paths through the same overwrite check as output.
Record the owner's process image and start time, and check both instead of the pid alone.
Take over a stale lock by renaming it to a unique name and re-checking, and shorten the synchronous waits.
Cap the query length and run the match with a time budget (or in a worker).
One more registry race for this issue. SessionStore.update (src/utils/sessions.ts:357-363) builds { ...cur, ...patch } from this instance's in-memory snapshot, and the dirty overlay (:321-323) then replaces the copy on disk. So if instance A's recording ends at max_duration and A writes endReason and the events summary, a later stop_recording from instance B, whose snapshot still says "recording", erases those fields. Fix: inside the lock, apply the patch to the record as it currently is on disk.
Activity
TMHSDigital commentedon Oct 25, 2026
One more registry race for this issue.
SessionStore.update(src/utils/sessions.ts:357-363) builds{ ...cur, ...patch }from this instance's in-memory snapshot, and the dirty overlay (:321-323) then replaces the copy on disk. So if instance A's recording ends atmax_durationand A writesendReasonand the events summary, a laterstop_recordingfrom instance B, whose snapshot still says "recording", erases those fields. Fix: inside the lock, apply the patch to the record as it currently is on disk.test(sessions): poll processInfo in the recycled-pid test (#330)