-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Description
Describe the bug
A session with heavy usage (204 premium requests, 34 user messages, 3 segments across resumes) shows as corrupted when attempting to resume. Investigation shows the events.jsonl file is structurally valid:
- All 8,366 lines parse as valid JSON (no
SyntaxError) - File ends cleanly with a newline
- Proper
session.start→session.shutdownstructure session.dbpasses SQLitePRAGMA integrity_checkworkspace.yamlis well-formed
The only anomaly is file size: 18 MB / 8,366 event lines accumulated over 3 session segments (1 start + 2 resumes).
Affected version
- Created with: GitHub Copilot CLI 1.0.9
- Resume attempted with: GitHub Copilot CLI 1.0.10
- Model: Claude Opus 4.6 (1M context)
Session diagnostics
| Metric | Value |
|---|---|
| Session ID | be25adf7-5860-40ac-bfb6-2eb178a0f848 |
| events.jsonl size | 18,427,560 bytes (8,366 lines) |
| Session segments | 3 (start → shutdown → resume → shutdown → resume → shutdown) |
| User messages | 34 |
| Assistant turns | 589 |
| Tool executions | 2,103 |
| Premium requests | 204 total (24 + 6 + 174 across segments) |
| Sub-agents spawned | 38 |
Session segment boundaries
Line 1: session.start ts=2026-03-20T06:02:49
Line 2103: session.shutdown shutdownType=routine premiumRequests=24
Line 2104: session.resume ts=2026-03-20T16:15:42
Line 2393: session.shutdown shutdownType=routine premiumRequests=6
Line 2394: session.resume ts=2026-03-21T04:00:38
Line 8366: session.shutdown shutdownType=routine premiumRequests=174
Workaround applied
Trimmed events.jsonl to only the last segment (lines 2394–8366) with a synthetic session.start replacing the session.resume. Reduced from 18 MB → 14 MB.
Expected behavior
- Sessions with valid
events.jsonlshould not show as corrupted regardless of file size - If there is a size/event-count limit, the CLI should proactively compact or checkpoint the events file (e.g., via
/compact) before it becomes unresumable - Better error messaging — "corrupted" is misleading when the file is structurally valid; a message like "Session too large to resume (18 MB). Try /compact" would help
Possible root causes
- No size/event limit handling: The resume logic may OOM or timeout parsing 18 MB of events
- Version mismatch (1.0.9 → 1.0.10): Schema changes between versions may reject older event formats
- Missing auto-compaction: Long sessions with many sub-agents and tool calls accumulate events without any pruning
Related issues
- Failed to resume session: Error: Session file is corrupted #1864 — Session corrupted after power loss (different root cause: invalid JSON)
- Session file corrupted: raw U+2028/U+2029 in events.jsonl breaks JSON.parse() on /resume #2012 — Unicode U+2028/U+2029 corruption (different root cause: encoding)
- copilot cli in wsl spinning on the cpu with an unresponsive tui #2208 — CPU spinning on large sessions (possibly same underlying issue: large state)
- Usage data is incorrect when sessions are resumed #524 — Usage data incorrect on resume (session resume handling)
Additional context
Environment: Linux DevBox (WSL-like), long-running FunOS firmware development session with extensive tool usage (builds, grep, file edits, sub-agents).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackNo fields configured for issues without a type.