fix(core): release request IDs when their tracked tasks finish #6092
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.48) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 548 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.377
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #6092"
general
weight: 0.35
Jackmeson1
What happens
A completed task can remain in
CancelMixin._running_taskswhile anotherobject, such as a rejected retry's exception traceback, retains it. Reusing
the ID then keeps raising an error after the tracked request or abort block
has finished.
The regression tests retain completed tasks explicitly. Any extra delay in
a live server depends on object lifetimes and garbage collection; there is
no fixed extension to the abort-block duration.
| Tracked task | Before | After |
| --- | --- | --- |
| Pending request task | Duplicate rejected | Duplicate rejected |
| Running abort-block task | Retry rejected | Retry rejected |
| Retained completed request task | Duplicate rejected | Admission allowed |
| Retained completed abort-block task | Retry rejected | Admission allowed |
The existing contract in
doc/source/user_guide/client_api.rstis:Cause
CancelMixin._add_running_task
treats every survivingWeakValueDictionaryentry as active, even when its task is done.
Change
Check Task.done()
before rejecting admission. The existing assignmentreplaces a completed entry with the current task.
Pending tasks still reserve their IDs, including tasks processing
cancellation. Abort blocks still reject admission while their tasks are
running. This brings admission into line with the documented contract.
Tests
The new regression is parametrized over a completed ordinary request and
an expired abort block. Both cases retain the completed task and verify
that registration replaces it with the current task. The neighboring test
continues to reject active duplicates and unexpired abort blocks under
native and shared scheduling.
Recorded contributor validation compares fa9cd800
with base4bd087a9.Linux validation on Ubuntu 24.04.5 LTS:
| Run | Result |
| --- | --- |
| xinference/core/tests/test_request_priority.py
, Python 3.12.3, Transformers 5.22.2 as recorded in the environment header | 55 passed || Same module, Python 3.12.3, Transformers 4.57.6 | 55 passed |
| Same module, Python 3.10.22 | 55 passed |
| Four consumer modules below, Python 3.12.3 | 137 passed |
Restoring production files from 4bd087a9
while retaining the new testsproduces the expected failing run, with exit status 1.
Windows contributor runs on Python 3.10.20 and 3.14.6, using Transformers
5.17.0 and xoscar 0.11.2, give 2 failed and 53 passed on the base, then
55 passed with the fix on each version. The two base failures are
Duplicate request id: reusable-id
and
The request has been aborted: reusable-id. These are supplemental runs;their xoscar version is below the project's declared minimum.
The following adjacent modules were also run on both Windows versions:
Each initial run gives 436 passed, 5 failed and 3 setup errors. The three
setup-error cases pass when rerun with a writable pytest temporary
directory. All five remaining failures reproduce on 4bd087a9
: one Unix
websocketsPATH-separator expectation and four cases requiring the absent
package.Linux pre-commit checks pass, including Black 25.1.0, Ruff 0.15.22,
isort 5.12.0, mypy 1.15.0 and codespell 2.2.2. The checked scope includes
the changed files and xinference/types.py
. Test-platform coverage and
git diff --check` also pass.AI disclosure: this was prepared with AI assistance (Claude Opus 5.5 and Claude Sonnet 5.5).
🤖 Generated with Claude Code
https://claude.ai/code/session_01JfvcPZyKcKQUG9fQGYfRMw