Skip to content

bug(runtime-host): execution imports precede owner election and hide startup failures #5324

Closed

Description

@liugddx

What happened

The Runtime Host candidate statically imports the full execution composition before it attempts owner election, opens Local IPC, or installs its startup error handling. Consequently, a slow execution import leaves the candidate undiscoverable, even when the apparent recovering registration belongs to an earlier process. A candidate that will lose the owner lock still pays for the execution imports, and an import failure escapes the normal candidate startup diagnostics.

The client also discards the underlying errno when registration reads or endpoint connections fail, reporting only connect_failed. Its startup-timeout message suggests large-workspace recovery even when no connection was established.

Expected: perform owner election and publish the listener before loading the execution composition, handle import failures through the normal startup path, and retain bounded phase/errno evidence for failed connections.

How to reproduce

The import-order defect is reproducible independently of an actual slow disk or a large workspace:

  1. Start the production candidate against a fresh temporary root with a Node module load hook replacing server/execution-composition.js.
  2. In the replacement module, read the candidate's registration and connect to its endpoint before throwing a deliberate import error.
  3. With the current eager factory, the registration does not exist: the child exits with code 1 before candidate startup error handling runs. With a lazy factory, the listener is reachable in recovering, and the injected import error is classified and cleaned up through the normal startup path (code 70).
  4. Hold the root's owner lock and launch another candidate. It should exit as a loser without loading the execution module.

Separately, saving a valid registration, closing its Host, and trying to reconnect produces a real missing-endpoint error (ENOENT on the tested system). The current election diagnostic loses that errno.

Environment

  • Reported nightly: 0.2.0-dev.31.20260913, packaged Desktop.
  • Windows 10.0.19042 x64; Electron 43.4.1; packaged Node 24.18.1.
  • Source investigation: e7071a1cc; the affected package sources are unchanged in upstream 2bc8a548e.
  • Source regression validation: Windows 10.0.19042, Node 22.23.1.

Logs, screenshots, or additional context

An actual startup report that prompted this investigation had:

deadlineMs=45000, elapsedMs=45005
candidateLaunches=1, sawEndpointConnected=false
observations: 112 connectFailed, 0 connected, 0 handshakeFailed
lastRegistration: pid=41328, state=recovering
latestCandidate: pid=38604, state=running
candidate 38604 later exited with code 0

A separate fault-injection experiment (stale registration, candidate entry delayed 8 seconds, 5-second election budget) reproduced those key states and the later clean exit. This does not establish the exact slow phase or sole cause of the reported 45-second incident; a stale registration does not prove that its PID is alive. This issue scopes the confirmed import-order and diagnostic defects, rather than all Windows startup timeouts. Related broader investigation: #3279.

Prepared with OpenAI Codex; reproduction and validation were run locally.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions