Skip to content

Windows: resume crashes after 0.12.7 to 0.12.11 upgrade when managed session changes #3804

Description

@kogangdon

Summary

On Windows, resuming a session created under Gajae-Code 0.12.7 after upgrading to 0.12.11 caused the GJC process to crash with an unhandled rejection.

Environment

  • OS: Windows 11 Pro (win32 10.0.26200, x64)
  • Previous GJC version: 0.12.7
  • Current GJC version: 0.12.11
  • Operation: resume an existing managed session created before the upgrade
  • Session storage: default managed session directory

Observed behavior

The resume operation terminated the process. The crash log recorded:

2026-08-04T01:39:46.746Z pid=34004 [Unhandled Rejection] Error: Managed session changed before migration authority was adopted.
Error: Managed session changed before migration authority was adopted.
    at prepareManagedCandidateForWrite (C:\\Users\\SHIFTUP\\node_modules\\@gajae-code\\coding-agent\\src\\session\\session-manager.ts:9693:14)
    at prepareManagedCandidateForStrictAdoption (C:\\Users\\SHIFTUP\\node_modules\\@gajae-code\\coding-agent\\src\\session\\session-manager.ts:9662:35)
    at handleResumeSession (C:\\Users\\SHIFTUP\\node_modules\\@gajae-code\\coding-agent\\src\\modes\\controllers\\selector-controller.ts:2761:57)
    at async <anonymous> (C:\\Users\\SHIFTUP\\node_modules\\@gajae-code\\coding-agent\\src\\modes\\controllers\\selector-controller.ts:2643:17)
    at processTicksAndRejections (native:7:39)

Expected behavior

If the selected session changes during the read/migration authority check, resume should fail gracefully with a user-visible status/message and leave the current session usable. It should not become an unhandled rejection that crashes GJC.

Analysis

The failure is consistent with a race between the read-only session inspection and managed-candidate preparation. The identity check correctly fails closed, but the rejection from prepareManagedCandidateForStrictAdoption() appears to escape handleResumeSession() because that preparation occurs before the inner switchSession() error handler. The picker callback is void-returning, so the rejection becomes an unhandled rejection.

The affected session was created under 0.12.7 and resumed after the 0.12.11 upgrade; this may involve the managed-session migration path introduced/changed across the upgrade. The issue may be intermittent, but the failure mode is process-fatal when it occurs.

The repeated Codex WebSocket prewarm warnings around the same period were non-fatal and do not appear related.

Suggested regression coverage

  • Arrange a managed session whose identity changes between inspectSessionTailReadOnly() and prepareManagedCandidateForStrictAdoption().
  • Assert resume reports a recoverable error/status instead of producing an unhandled rejection.
  • Assert the active session remains usable after the failed resume.
  • Add coverage for resuming a pre-0.12.11 session after upgrade on Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions