-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
After upgrading to 1.0.6, resuming sessions created by earlier versions fails with:
✗ Failed to resume session: Error: Session file is corrupted (line NNN: data.summary: Required)
The file is not actually corrupted. The issue is that 1.0.6 added schema validation requiring data.summary in session.task_complete events, but sessions created by earlier versions (≤1.0.5) wrote these events with "data": {} (no summary field). This makes those sessions unresumable after upgrade.
Note: This bug was identified and investigated by a copilot-cli agent (Claude Opus 4.6 1M) during an interactive session with user @cwedgwood. The analysis and fix verification below were performed by the agent with the user confirming results.
Affected version
GitHub Copilot CLI 1.0.6
Steps to reproduce the behavior
- Have sessions created by copilot-cli ≤1.0.5 that contain sub-agent task completions
- Upgrade to 1.0.6
- Attempt to resume any such session
- Observe error:
Session file is corrupted (line NNN: data.summary: Required)
Scale of impact
Analysis of one user's session store:
- 15 of 84 sessions (18%) are affected
- 80 individual
session.task_completeevents have"data": {}instead of"data": {"summary": "..."} - These sessions are permanently unresumable on 1.0.6 without manual patching
Root cause
In events.jsonl, pre-1.0.6 sessions contain events like:
{"type":"session.task_complete","data":{},"id":"...","timestamp":"...","parentId":"..."}1.0.6 validates this on resume and requires data.summary to be present:
{"type":"session.task_complete","data":{"summary":"..."},"id":"...","timestamp":"...","parentId":"..."}The validation rejects the old format as "corrupted" even though it was written by copilot-cli itself.
Expected behavior
Session resume should be backwards-compatible with sessions created by earlier versions. Either:
- Make
data.summaryoptional in the validation schema (allow missing/empty), or - Run a migration on resume that fills in a default value for missing fields, or
- Skip validation errors for non-critical fields and resume anyway
Workaround (verified)
Adding an empty summary string to the affected events fixes the problem. The following Python script patches all affected sessions. Tested on two sessions that previously failed to resume — both resumed successfully after patching.
import json, glob, os
for path in glob.glob(os.path.expanduser("~/.copilot/session-state/*/events.jsonl")):
lines = []
patched = 0
with open(path) as f:
for line in f:
stripped = line.rstrip("\n")
if not stripped:
lines.append(line)
continue
try:
evt = json.loads(stripped)
if evt.get("type") == "session.task_complete" and "summary" not in evt.get("data", {}):
evt["data"]["summary"] = ""
lines.append(json.dumps(evt, separators=(",", ":")) + "\n")
patched += 1
else:
lines.append(line)
except json.JSONDecodeError:
lines.append(line)
if patched > 0:
with open(path, "w") as f:
f.writelines(lines)
sess = os.path.basename(os.path.dirname(path))
print(f"{sess}: patched {patched} events")Additional context
- OS: Linux x86_64
- Previous version: 1.0.5 (sessions created under this version)
- Related: Failed to resume session: Error: Session file is corrupted #1864 (session corruption from power loss — different root cause but same error message format)