-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Describe the bug
Title: Session fails to load after crash — trailing null bytes in events.jsonl not handled
Environment:
- Copilot CLI v1.0.10
- WSL2 (Linux
5.15.167.4-microsoft-standard-WSL2) - Ubuntu / x86_64
Description:
After a crash (or abnormal termination), copilot --resume= reports "No session or task matched" even
though the session directory and all files exist on disk.
Root cause:
events.jsonl had 1,728 trailing null bytes (\x00) appended after the last valid JSON line. This is consistent with
buffered I/O where the file was extended but the process terminated before flushing real data. The session loader
fails to parse the file and treats the session as nonexistent.
Reproduction:
- Have an active Copilot CLI session with some conversation history
- Crash or force-kill the Copilot process (e.g., WSL shutdown, OOM, kill -9)
- Attempt copilot --resume=
- Result: "No session or task matched ''"
Workaround:
Manually strip the trailing nulls:
path = '~/.copilot/session-state//events.jsonl'
with open(path, 'rb') as f:
data = f.read()
with open(path, 'wb') as f:
f.write(data.rstrip(b'\x00'))
Suggested fix:
The session loader should be resilient to crash artifacts in events.jsonl:
- Strip trailing null bytes before parsing
- Skip/ignore blank or unparseable trailing lines (the last event may be incomplete)
- Log a warning that the session was recovered from a crash, noting how many events (if any) were lost
The 3,015 valid JSON lines in the file were completely intact — only the unwritten tail was corrupted. Refusing to
load the entire session over this is unnecessarily destructive.
Affected version
GitHub Copilot CLI 1.0.10
Steps to reproduce the behavior
No response
Expected behavior
tolerant of crashes, resumes or detects a problem and offers a better resolution
Additional context
No response