Repository navigation
fix(process): report no remaining time after a provider deadline fires - #2720
Merged
Merged
Conversation
Node timers can fire while performance.now() is still a fraction of a millisecond short of the monotonic deadline. ProviderStartupDeadline then reported interruption "timeout" and an aborted signal while remainingMs() returned ceil(0.x) = 1, so polling loops guarded by remainingMs() > 0 (Hopper and Ghidra startup) could run past an elapsed deadline, and the real-timer test "aborts a bounded wait when its real monotonic deadline expires" failed intermittently in CI (expected 1 to be 0). Once the deadline's own timer has classified a timeout, report zero remaining time. A deterministic regression test fires the timer with the monotonic clock 0.4 ms short of the deadline. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
|
11 of 12 tasks
…-expired-remaining
This was referenced Oct 13, 2026
…-expired-remaining
…-expired-remaining
10 of 11 tasks
This was referenced Oct 13, 2026
This was referenced Oct 13, 2026
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.
Problem
src/process/ProviderDeadline.test.ts > aborts a bounded wait when its real monotonic deadline expiresfails intermittently in CI. I saw it on two separate runs of #2683 and #2690 today:Root cause
This is an inconsistency in
ProviderStartupDeadline, not in the test. Node timers run on libuv's millisecond loop clock and can fire whileperformance.now()is still a fraction of a millisecond short of#deadlineAt. The timer callback then setsinterruption = "timeout"and aborts the signal, butremainingMs()computesMath.ceil(deadlineAt - performance.now())=ceil(0.4)= 1. Consumers see an expired, aborted deadline that still reports time left. For example,while (deadline.remainingMs() > 0)polling inHopperClientandGhidraSocketConnectioncan keep going past the deadline.Fix
remainingMs()returns 0 once the deadline's own timer has classified a timeout. Behaviour before the deadline fires, and after caller cancellation, is unchanged.Validation
setTimeout, withperformance.now()mocked 0.4 ms short of the deadline when the timer fires. It fails on main (remainingMs()is 1) and passes with the fix.ProviderDeadline.test.tspassed 6 of 6 repeated local runs.npm run test:focusedon the 4 test files usingProviderStartupDeadline(Hopper/Ghidra/native module consumers): 91 passed.npm run check:fastpasses.🤖 Generated with Claude Code