Skip to content

fix(runtime-host): isolate staged external Session recovery failures #5401

Closed

Description

@wutongyuonce

Problem

External Session startup recovery can prevent the entire Runtime Host from reaching ready when one staged import fails twice.

ExternalSessionCoordinator.recover() processes every Session with transcriptLedgerVersion === 0 by awaiting #prepareStagedSession(). If Ledger preparation fails, #prepareStagedSession() tries to discard the staged Session. When that discard also fails, the second error escapes the loop and aborts Runtime Host domain startup. One damaged staged import can therefore make every unrelated Session and Host operation unavailable.

This was identified while reviewing #5308: #5308 (review)

Invariant and authority

ExternalSessionCoordinator owns staged-import recovery. Failure to recover or discard one staged Session must not prevent recovery of other staged Sessions or prevent the Runtime Host from becoming ready.

The failure must remain observable; isolation must not silently publish the staged Session or count it as an imported copy.

Acceptance criteria

  • Recovery isolates failures per staged Session.
  • A prepare failure followed by a discard failure does not abort recovery of later staged Sessions.
  • The Runtime Host can still complete startup after the isolated failure.
  • The failed Session remains unpublished (transcriptLedgerVersion === 0) unless it was successfully prepared, and it is not included in imported-copy counts.
  • An owner-level ExternalSessionCoordinator regression covers the double-failure case and proves that a later staged Session is still recovered.
  • No client recovery state or protocol field is added; the fix stays at the coordinator recovery authority.

Relevant code

  • packages/runtime-host/src/server/external-session-coordinator.ts
  • packages/runtime-host/src/__tests__/external-session-coordinator.test.ts

Activity

  1. wutongyuonce commented on Sep 16, 2026

    @wutongyuonce
    ContributorAuthor

    take

  2. added
    bug
    on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions