fix(runtime-host): keep one candidate in flight - #3512
Merged
jackwener merged 1 commit intoAug 22, 2026
Conversation
Generated-by: Codex
liugddx
marked this pull request as ready for review
August 22, 2026 15:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prevents one Runtime Host election from spawning another Candidate while its current Candidate process is still alive.
#3454 classified the intermittent Windows startup failure in #3279: one packaged automatic-update startup made 69 distinct Candidate launches while observing
not_registered73 times, then connected once and timed out with the Host stillrecovering. Repeated process creation under load works against election convergence rather than helping it.This PR makes Candidate process settlement explicit for both detached and owned launchers, and keeps a per-election in-flight gate closed until that exact process exits. A spawn rejection still permits a later attempt because no process exists. A process whose exit cannot be observed remains fail-closed for that election.
Refs #3279. This PR should land before #3454; the diagnostic PR can then rebase without combining behavior and evidence changes.
Boundary
Mechanism
Both
launchDetachedRuntimeHostCandidateandlaunchOwnedRuntimeHostCandidatenow return the same child-boundexitedpromise.connectOrSpawnRuntimeHostWithDependenciesmarks a Candidate in flight only afterspawnedresolves and clears the gate only whenexitedfulfills. A rejected spawn never sets the gate; a missing or rejected exit signal leaves it closed.Release Windows checknow owns changes to the two Candidate-election source files so this behavior cannot merge on Node-only evidence.Verification
L1/L2 on exact head
814d95f663c74fb6bd804de5eed3ae37d2eae482:npm run buildpassednpm run typecheckpassed across all workspacesnpm run lint: 2,551 files, 0 errorsnpm run format:check: 1,590 files, 0 changesgit diff --checkpassedReal local fresh-root evidence:
The real owned-successor test uses a 15-second election budget and 25-second test timeout only to tolerate execution-composition startup under local load. Production remains at 45 seconds.
Local limitations:
check:releasewas attempted; three unrelated Windows-local failures were in existing standalone Bash/temp-directory cleanup paths (twoEBUSY), outside this diffL3 gate
Fresh exact-head core and packaged Windows evidence is green. The PR is ready for review.
AI use
Select exactly one:
Tool(s) and scope: Codex implemented the per-election gate and process-settlement contract, added focused Node/Electron/owned-process regression evidence, ran local validation, and used independent review agents for the author gate. The commit includes a
Generated-by: Codextrailer.Checklist
Does this PR entail a change in behavior?