Summary
The bridge fails to resume a session when the session file contains a corrupted JSON line. The CLI handles the same file gracefully (presumably skipping or repairing the bad line), but the SDK's session.resume treats it as fatal.
Steps to Reproduce
- Have a long-running session that accumulates a large session file (~20k+ lines)
- Session file gets corrupted (likely from a truncated write -- e.g., bridge restart mid-write)
- Bridge restarts and attempts to resume the session
/resume <session-id> also fails with the same error
Expected Behavior
Session resumes successfully (as the CLI does), either by:
- Skipping/repairing the corrupted line
- Truncating the session history to the last valid checkpoint
- Gracefully degrading with a warning rather than refusing to load
Actual Behavior
Resume fails with:
Request session.resume failed with message: Session file is corrupted
(line 20712: SyntaxError: Unterminated string in JSON at position 8287 (line 1 column 8288))
The bridge auto-resume path handles this by creating a new session (expected fallback), but /resume surfaces the error to the user with no recovery option.
Component
session-manager / SDK (@github/copilot-sdk)
Version
0689632
Platform
macOS (Darwin), Node.js v25.6.1, SDK 0.3.0, CLI 1.0.36
Additional Context
- Session ID:
4357b1a4-56c5-4340-b3dd-4f236b3647a4
- The CLI (
copilot binary) can load the same session file successfully
- Root cause is likely the SDK doing strict JSON parsing line-by-line vs the CLI having error recovery
- This may be an upstream SDK issue rather than something fixable in bridge code
- Potential bridge-side mitigation: detect corruption on
/resume and offer to truncate the session file to the last valid line
Reported By
Agent (automated)
Summary
The bridge fails to resume a session when the session file contains a corrupted JSON line. The CLI handles the same file gracefully (presumably skipping or repairing the bad line), but the SDK's
session.resumetreats it as fatal.Steps to Reproduce
/resume <session-id>also fails with the same errorExpected Behavior
Session resumes successfully (as the CLI does), either by:
Actual Behavior
Resume fails with:
The bridge auto-resume path handles this by creating a new session (expected fallback), but
/resumesurfaces the error to the user with no recovery option.Component
session-manager / SDK (
@github/copilot-sdk)Version
0689632
Platform
macOS (Darwin), Node.js v25.6.1, SDK 0.3.0, CLI 1.0.36
Additional Context
4357b1a4-56c5-4340-b3dd-4f236b3647a4copilotbinary) can load the same session file successfully/resumeand offer to truncate the session file to the last valid lineReported By
Agent (automated)