fix(daemon): keep a discarded rejection from shutting the daemon down - #2532
Merged
Conversation
Size Report
Startup median (7 runs, lower is better):
|
An aborted Apple simulator recording start discarded the transport promise: `void started.then(rollback)` has no rejection handler, and the local transport rejects with the abort reason after its dynamic imports settle. The rejection reached the daemon's only unhandledRejection handler, which exits with code 1 and kills every open session. End the rollback chain in a handler at both abandon sites so a rejected acquisition, or a rollback that itself fails, cannot escape. Sweep the remaining single-handler `void … .then(` sites: a rejected renewal now fences as unconfirmed authority instead of settling as a normal renewal, which would re-arm renewal work with no backoff, and the Limrun drain drops its discarded continuation by deleting from `pending` when the deferred settles.
thymikee
force-pushed
the
fix/discarded-rejection-daemon-2519
branch
from
September 12, 2026 18:11
6557208 to
1326c85
Compare
Member
Author
|
No actionable findings on 1326c85. The renewal rejection path stops admission before finishing the wait, preserving normalized failure handling without a retry loop. The focused race regressions cover the changed behavior. Current checks pass and there are no conflicts. Ready for human review and merge. |
|
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
Closes #2519.
acquireSimulatorProcessabandoned an aborted acquisition withvoid started.then(rollback).localTransport.startawaits two dynamic imports and then rejects with the abort reason, so everyaborted
record startdelivered that rejection to the daemon's onlyunhandledRejectionhandler(
src/daemon/server/daemon-runtime.ts:644), which exits 1 and kills every open session. Both abandonsites now end the rollback chain in a handler, which also covers a rollback that itself fails.
Swept all 24
void … .then(sites rather than adding the proposed regex guard. Three rows changedshape:
delaybranch is aPromise.racemember, andPromise.raceattaches a rejection handler to every member, so the post-settlement abort rejection is already
handled. Verified in Node and by a test that passes at
origin/main. No no-op handler added.workisrenew(...), which cannotreject: every path ends in a return or
stop(). Resolving a rejection as "renewal settled" wouldmake
runre-armpending = renew(...)with no backoff, so a brokenrenewbecomes a renewalspin instead of a daemon exit. A rejection now routes through the closure's own
stopasteardown-required/authority-unconfirmed, which is whatrenew's catch already reports. Nofailing test exists because no reachable rejection does.
settlednow removes itself frompending— instead of adding a dead handler.Adds
packages/provider-limrun/src/request-cancellation.test.ts, which pins the drain'sabort-while-in-flight ownership contract that site 4 edits; those three tests pass before and after,
so they are contract coverage, not a regression test. 5 files.
Two review findings were rejected as unreachable rather than guarded:
child.kill('SIGINT')insiderollbackAcquiredSimulatorProcesscannot throw for a valid signal name (ChildProcess#killreturnsfalsefor a dead child), so the SIGKILL escalation is not reachable through a thrownkill; and arejected
start()cannot have spawned anything, because the local transport spawns synchronouslyafter its last
throwIfAborted.Validation
Tested at
1326c85c71.pnpm check:affected --runpassed (14 checks: format, lint, typecheck,layering, fallow; 1,684 unit tests). Both new abort tests fail at
origin/main, capturingcancel simulator transport startas anunhandledRejection, and pass atHEAD; the grace-race assertions pass both ways, which is the site-2 refutation. The unhandled-
rejection observer now flushes with two
setImmediatehops instead of a 10 ms timer, so it is immuneto fake timers. The transport is injected and no device-facing path changed, so no live run applies.
Coverage and provider integration stay CI-owned.