Problem
An active Claude Code session shows a purple dot (unknown status) instead of the expected green dot (idle) in the Sessions tab. The purple dot persists permanently — refreshing, switching tabs, and re-focusing the window don't fix it.
A separate symptom was also observed: the dot occasionally disappeared entirely (session not detected as active), even though the Claude process was still running. This symptom was not reproduced after adding debug logging, so its cause remains unknown. It may or may not be related to the purple dot issue.
Root cause (confirmed)
scanInitialStatuses() reads the last N lines of session JSONL files via execFile('tail', ['-n', '50', ...]) to infer session status when no status file exists (e.g. CodeV launched while sessions were already running, before hooks could fire).
Node.js execFile has a default maxBuffer of 1 MB. For sessions with large assistant responses, the last 50 lines of the JSONL can far exceed this — observed: 2.1 MB for a session with a long study task. When maxBuffer is exceeded, execFile returns an error, which the code handled by resolving with an empty string:
execFile('tail', ['-n', '50', filePath], { encoding: 'utf-8', timeout: 3000 }, (err, stdout) => {
resolve(err ? '' : stdout); // maxBuffer exceeded → err → empty string → scan skipped
});
This caused the scan to silently skip the session → no status file written → purple dot forever.
Why 50 lines can be so large
JSONL stores one JSON object per line. An assistant entry contains the entire response (thinking blocks, tool results, code output) in a single line — one line can be hundreds of KB. 50 lines spanning several assistant entries easily exceeds 1 MB.
Why this was invisible
The catch {} blocks in the status scan pipeline swallowed all errors silently. No logging existed for scan failures, maxBuffer errors, or empty scan results.
Fix (PR #117)
- Reduced
tail -n 50 to tail -n 15 — the last ~5 lines are always system metadata (stop_hook_summary, turn_duration, last-prompt, permission-mode, bridge_status). Assistant entries are within 15 lines from the end. This reduced output from 2.1 MB to 28 KB.
- Added
maxBuffer: 5 * 1024 * 1024 (5 MB) as a safety net.
- Added
console.error on tail failure so it's no longer silent.
- Added debug logging throughout the session detection and status scan pipeline (
[session-status] and [detect-active] prefixed logs).
- Replaced all
catch {} with catch (err) { console.error(...) } in detection, cleanup, and scan code.
Open question: dot disappearing entirely
During debugging (before adding logs), the dot was observed to disappear entirely (not just purple, but gone — meaning isActive = false). This was intermittent:
| Time |
Dot state |
| Initial report |
Purple |
| After some time |
Gone |
| Later |
Purple again |
After adding debug logs and running in dev mode, detectActiveSessions() returned the session in activeMap every time — the disappearance was not reproduced. Possible explanations:
- A transient error in detection that happened to not recur during the logging session
- React state reset from webpack hot reload in dev mode
- User interaction (typing in search field) triggering a re-render that temporarily cleared state
No action taken on this — logging is now in place to diagnose if it recurs.
Reproduction
The purple dot bug triggers when:
- A Claude Code session has large assistant responses (long study tasks, extensive code generation)
- The session's last 50 JSONL lines exceed 1 MB total
- The session's status file doesn't exist (CodeV launched after the session, or hooks didn't fire)
Network interruption is NOT required — it was coincidental in the original report.
Environment
- CodeV v1.0.73
- Claude Code 2.1.96
- macOS
Problem
An active Claude Code session shows a purple dot (unknown status) instead of the expected green dot (idle) in the Sessions tab. The purple dot persists permanently — refreshing, switching tabs, and re-focusing the window don't fix it.
A separate symptom was also observed: the dot occasionally disappeared entirely (session not detected as active), even though the Claude process was still running. This symptom was not reproduced after adding debug logging, so its cause remains unknown. It may or may not be related to the purple dot issue.
Root cause (confirmed)
scanInitialStatuses()reads the last N lines of session JSONL files viaexecFile('tail', ['-n', '50', ...])to infer session status when no status file exists (e.g. CodeV launched while sessions were already running, before hooks could fire).Node.js
execFilehas a defaultmaxBufferof 1 MB. For sessions with large assistant responses, the last 50 lines of the JSONL can far exceed this — observed: 2.1 MB for a session with a long study task. WhenmaxBufferis exceeded,execFilereturns an error, which the code handled by resolving with an empty string:This caused the scan to silently skip the session → no status file written → purple dot forever.
Why 50 lines can be so large
JSONL stores one JSON object per line. An
assistantentry contains the entire response (thinking blocks, tool results, code output) in a single line — one line can be hundreds of KB. 50 lines spanning several assistant entries easily exceeds 1 MB.Why this was invisible
The
catch {}blocks in the status scan pipeline swallowed all errors silently. No logging existed for scan failures, maxBuffer errors, or empty scan results.Fix (PR #117)
tail -n 50totail -n 15— the last ~5 lines are always system metadata (stop_hook_summary, turn_duration, last-prompt, permission-mode, bridge_status). Assistant entries are within 15 lines from the end. This reduced output from 2.1 MB to 28 KB.maxBuffer: 5 * 1024 * 1024(5 MB) as a safety net.console.erroron tail failure so it's no longer silent.[session-status]and[detect-active]prefixed logs).catch {}withcatch (err) { console.error(...) }in detection, cleanup, and scan code.Open question: dot disappearing entirely
During debugging (before adding logs), the dot was observed to disappear entirely (not just purple, but gone — meaning
isActive = false). This was intermittent:After adding debug logs and running in dev mode,
detectActiveSessions()returned the session inactiveMapevery time — the disappearance was not reproduced. Possible explanations:No action taken on this — logging is now in place to diagnose if it recurs.
Reproduction
The purple dot bug triggers when:
Network interruption is NOT required — it was coincidental in the original report.
Environment