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
| fs.watch callback | O(n) | readAllStatuses() once |
176
+
177
+
**Note:**`get-session-statuses` uses `allSessions.find()` per session without status → O(m×s) where m = sessions without status, s = total sessions in history.jsonl. In practice m ≈ 0 after first startup (scan results are persisted to files), and s is cached with 5s TTL.
178
+
179
+
### File accumulation prevention
180
+
181
+
Two mechanisms prevent status files from growing indefinitely:
182
+
1.**SessionEnd hook** — removes `{sessionId}.json` when session ends normally
183
+
2.**cleanupStaleStatuses()** — runs on each `get-session-statuses` call (startup + window focus), deletes files for sessions no longer in active set (handles crash/SIGKILL cases)
184
+
164
185
### Architecture note: `get-session-statuses` and duplicate detection
165
186
166
187
The `get-session-statuses` IPC handler internally calls `detectActiveSessions()` and `readClaudeSessions(500)` to find sessions without status files for JSONL scanning. This duplicates work the renderer already does.
0 commit comments