fix(reload): wait for dependent replica retirement before advancing rollout #6096
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6096"
general
weight: 0.35
Jackmeson1
Rolling reload can fail the next replica's capacity check while the preceding replica's old engine still holds GPU memory. Replacement returns after route cutover, while retirement continues asynchronously, allowing the next replica to check capacity before those allocations are released.
The reload documentation describes updating replicas one at a time and retrying partial rollouts.
Wait for a committed replica’s previous generation only before a later replacement that depends on its allocations. Dependence means overlapping GPU indices on the same Worker, or a shared actor process. The worker’s automatic and explicit allocation records supply the actual GPU indices; launch-time
gpu_idx=Noneis not treated as a device. Independent Workers and disjoint known GPU sets proceed while old requests finish. An independent replica can also advance before a later replica that shares the earlier GPU.When placement cannot be determined, bound each retirement wait at 300 seconds. This separate bound does not reuse
drain_timeout. Expiry returns a retryable partial error: committed replicas stay ready, later replicas are skipped, and old requests and cleanup continue. Known shared allocations still wait for retirement without a deadline. Cleanup failure also stops advancement without undoing committed replicas. Cancellation shields retirement cleanup.Recheck for failed replicas after each retirement wait and immediately before starting the next replacement. If a committed replica rolls back during the wait, stop the remaining waits and skip untouched replicas. Successful replicas retain their new settings, the failed replica reports its rollback, and the rollout returns an error with
partial=truewhen some replicas remain successfully updated.Before the first cutover, preflight verifies retirement-wait support on every original actor whose retirement a later replacement may need. The capability probe and wait both check the original address and UID, so forwarding by an older retained actor cannot establish support. Missing, incompatible or forwarded support fails preflight with a restart message before any replica changes.
GPU memory accounting is unchanged. Reapplying unchanged non-hot settings still replaces the engine. Parser-only updates, single-replica reloads and final-replica retirement retain their existing behavior. Retained-weight replacement remains limited to vLLM and SGLang; their shared and separate weight-cache capacity paths are covered. Transformers, llama.cpp, MLX, TRT-LLM and non-LLM engines do not enter this path under the existing retained-weight eligibility check. P/D and replicas sharded across Workers remain unsupported by this integration.
Regression coverage holds an old request open while both independent replicas complete, with explicit and automatic assignment and different Workers. It also checks a nonadjacent dependent replica, bounded unknown placement without cancelling cleanup, identity-checked capability probes, and older-actor rejection before any replica changes. A three-replica rollback regression asserts
ready / error / skippedand verifies that the final replica's replacement is never called. Existing tests retain shared-GPU completion, cleanup failure, cancellation, actor streams and vLLM/SGLang capacity coverage.Validation of the current change:
ready / error / readyand passed with this change on Windows Python 3.10.20 and 3.14.6.test_replica_reload.pypassed 55 tests andtest_model_reload.pypassed 46.test_model_generation.pypassed 52 tests with one existing POSIX PATH-separator assertion failure, also reproduced on 9ae1eb87.Earlier validation:
pip install -e ".[doc]"): all ten modified catalogs passedmsgfmt --check --check-format;python doc/build_i18n.py --allcompiled every locale; the changed page built with Sphinx in English and in all nine maintained locales, and the new paragraph renders in English and Simplified Chinese. No build warning points at the new paragraph.The GPU evidence below predates these follow-ups and validates the original shared-GPU retirement fix.
Real-model GPU validation used one RTX PRO 6000 Blackwell with 96 GB, Python 3.12.15, vLLM 0.33.0, PyTorch 2.14.0+cu130 and xoscar 0.12.4. Two retained-weight Qwen3-0.6B replicas shared GPU 0, with max_model_len=4096 and initial max_num_seqs=32. Each attempt submitted {"model_config":{"max_num_seqs":64}}, including repeated unchanged submissions. VLLM_USE_FLASHINFER_SAMPLER=0 was set.
The same environment ran base, the patch for 239508e7, and base again. Imported source-file hashes matched the corresponding production modules.
| Run | gpu_memory_utilization | Reload results | Successful short requests | Failed short requests |
| --- | --- | --- | --- | --- |
| Base #1 | 0.3 | Three partial failures | 1179 | 0 |
| Fixed revision | 0.3 | Three ready | 1915 | 0 |
| Fixed control | 0.2 | Two ready | 1319 | 0 |
| Base #2 | 0.3 | Three partial failures | 1151 | 0 |
| Base control | 0.2 | Two ready | 1249 | 0 |
Both base runs failed the second replica's capacity check while the preceding engine was retiring: 7.58–9.25 GiB was free against a 27.88 GiB requirement. Memory became sufficient after retirement.
With the fix, the second replica started 3.88–4.56 seconds after the first replica's completion marker, following the preceding engine-manager shutdown. GPU memory and PID samples showed the old allocations being released. Both replicas acquired new engine PIDs on every attempt.
The initial per-attempt streams finished before cutover. A supplementary fixed run kept streams running continuously through two more successful reloads at 0.3. It recorded 1328 successful short requests and 116 streams with no recorded HTTP or transport errors; four stream intervals overlapped replica-completion timestamps. Stream records do not identify the serving generation or explicitly validate terminal SSE markers. The actor regression separately verifies that an old stream retains its generation until completion.
Every recorded whole-model termination returned GPU memory to the pre-launch baseline of 0 MiB.
Timing evidence combines replica status timestamps, shutdown logs and GPU memory/PID samples; there is no dedicated capacity-entry timestamp. SGLang and separate-weight-cache replacement were covered by CPU tests, not GPU runs.
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