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
Session registry: lock gives up and writes unlocked after 2 s (flaky test), and reads never refresh from disk #235
Under load, the cross-process lock deliberately drops mutual exclusion and records are lost. The test suite already catches this intermittently. Separately, every instance only sees its own writes, so list_sessions/get_session/read_events/resources are stale for recordings made by another instance, and a stale copy can overwrite newer fields.
Evidence
src/utils/sessions.ts:163: LOCK_WAIT_MS = 2_000; :207-218 then logs "Session registry lock … is busy; writing without it." and proceeds.
src/__tests__/sessions.test.ts:246 (cross-process) failed after 2363 ms in one of three full npm test runs and passed in isolation, so CI will flake.
SessionStore.get()/list() (sessions.ts:347-355) read only the in-memory map, which is refreshed only when this instance writes. A stale "recording" record stopped in instance B overwrites A's endReason and events summary.
Never write unlocked: wait longer with backoff, then fail the write with a clear error (or queue and retry). Break stale locks only by verified dead pid + age.
Re-read the registry (under the lock, or after an mtime check) in get()/list(), and merge field by field on update instead of replacing whole records.
Give the cross-process test realistic timing slack.
Done when
50 consecutive runs of the cross-process test pass. A test shows instance A sees a session started by instance B without writing first.
Activity