Repository navigation
fix(sse): prevent abandoned submissions from blocking the rate-limit queue - #18526
Merged
diegosouzapw merged 3 commits intoNov 4, 2026
Merged
diegosouzapw merged 3 commits into
diegosouzapw merged 3 commits into
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This was referenced Nov 4, 2026
diegosouzapw
merged commit Nov 4, 2026
bf6faf9
into
cheaper-inference:release/v3.8.53
3 of 37 checks passed
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.
Why
A client abort can leave thousands of jobs in Bottleneck's
RECEIVEDsubmission tail. Waiting for that entire tail before removing an already-queued request makes live traffic wait behind dead work; the abandoned jobs can consume later reservoir tokens and scheduling slots even though their callers have gone away.Change
RECEIVEDsubmission synchronously and settle its submission promise.QUEUEDjob under the registration lock, without waiting for unrelated submissions.Regression coverage
New tests cover a 2,000-submission cancellation storm, QUEUED cleanup behind a blocked submission tail, FIFO after removing head/middle/tail submissions, reservoir/minTime preservation, native/custom abort reasons, and queue-timeout cause preservation. Existing queue-wedge and per-connection limiter tests are included in the focused run.
Verification
node --import tsx/esm --import ./open-sse/utils/setupPolyfill.ts --import ./tests/_setup/isolateDataDir.ts --test --test-force-exit --test-concurrency=2 tests/unit/rate-limit-cancel-received-storm.test.ts tests/unit/rate-limit-cancel-cause-custody.test.ts tests/unit/rate-limit-abandoned-queued-job.test.ts tests/unit/rate-limit-manager-queue-bound.test.ts tests/unit/rate-limit-queue-context.test.ts tests/unit/rate-limit-wedge-recovery.test.ts tests/unit/rate-limit-execution-per-conn.test.ts tests/unit/rate-limit-manager.test.ts.node node_modules/vitest/vitest.mjs run --config vitest.mcp.config.ts --maxWorkers=1 --fileParallelism=false.tsc -p tsconfig.typecheck-core.json, error-helper gate and all enabled commit hooks passed.release/v3.8.53). This PR does not attempt unrelated base repairs.