fix: distinguish session lock vs SDK errors in resume handling#417
fix: distinguish session lock vs SDK errors in resume handling#417
Conversation
PR #417 Review: Session lock vs SDK error handlingCI: SummaryThe core approach is correct and a clear improvement: replacing fragile SDK error-string pattern matching ( Consensus Findings (2+ of 5 models)🟢 N1 (3/5) — Code duplication: The PR adds a third lock-checking method ( 🟢 N2 (2/5) — Session-state path hardcoded inline
Non-consensus notes (1 model each, not blocking)
Verification
Verdict✅ Approve — The fix is correct and addresses the root cause. N1/N2 are code quality suggestions for follow-up, not bugs. The approach of checking actual lock files before the SDK call is sound. |
The ResumeSession error handler showed 'Session is locked' for all SDK errors containing 'session file' + 'corrupt', even when no lock files existed. We don't actually know why the SDK failed — guessing 'corrupted' is just as wrong as guessing 'locked'. Changes: - Add pre-resume lock file check using new static FindLiveLockPid() that checks inuse.*.lock files for live copilot-related processes - Clean up stale lock files (dead PIDs) before attempting resume - Remove IsCorruptSessionError — stop guessing at SDK error causes - Pass all SDK errors through FriendlyResumeError with the actual message - Extract reusable FindLiveLockPid from ExternalSessionScanner - Fix misleading doc comment on FindAnyLiveLockPid (claimed no process name check, but code does verify against copilot/node/dotnet/github) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0abfbe3 to
ce828c8
Compare
PR #417 Round 2 Review — Session Lock vs SDK Error FixNo new commits since Round 1 (HEAD CI Status
Previous Findings StatusN1 🟢 (code duplication: Diff-verified: N2 🟢 (hardcoded Consensus 4/5 models agree this is present but low-risk. Root cause clarification: New Findings (Consensus Filter)No new issues reached the 2/5 consensus threshold. Low-severity observations noted by single models only:
Test CoverageThe Summary
The fix itself is correct: replaces fragile string pattern-matching ( Recommended action: ✅ Approve — N1 and N2 are quality/maintainability nits appropriate for a follow-up. No bugs, no regressions, no blocking issues. |
Problem
Resuming a closed Copilot CLI session showed Session is locked even when no lock files existed. The old code pattern-matched SDK error messages for session file + corrupt and then displayed a misleading locked message. We don't actually know why the SDK failed.
Fix
Files Changed
Multi-model review
Reviewed by Claude Sonnet, Claude Opus 4.5, GPT-5.1, and Gemini 3 Pro. Cross-reviewed findings between models.