test: keep the fake host timeout referenced during dispatch - #133
Merged
Merged
Conversation
The fake host's per-handler timeout timer was unref'd, so an awaited emit whose handler promise stayed pending had no referenced wakeup and the event loop drained before the timeout could advance the dispatch. node:test then cancelled the remaining tests with 'Promise resolution is still pending but the event loop has already resolved'. Every emit clears the timer before it returns, so referencing it for the dispatch never outlives the emit.
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.
tests/host-compat.test.tsfakes the host's per-handler timeout with a timer it unref'd, so an awaitedemit()whose handler promise stayed pending had no referenced wakeup: on Node 22.19.0 the event loop could drain mid-dispatch and node:test cancelled the rest of the file withwhich is what cancelled
adaptHost: host timeout advances to settle even if an agent_end promise remains pendingandadaptHost: command contexts get getSystemPromptOptions with the active skills.That is the intermittent
Check (Node 22.19.0)failure: the same tree failed themainpush run and thev0.73.0tag run, and passed the pull request run and both reruns.The timer now stays referenced for the dispatch and is cleared before
emit()returns, so it never outlives a dispatch. Tests only — no production code changes.Verified:
npm run check: exit 0, 1186 tests, 0 failedThe
0.73.1version bump is the last commit, as required by the release process.