fix(xavier): preserve SGLang shared-prefix batches #6128
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 409 lines diff across 5 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.360
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6128"
general
weight: 0.35
Jackmeson1
SGLang's Xavier HiCache adapter starts a new key chain for each backup callback. If the preceding 128 pages have left history, the next 12 pages can still reach storage even though a read from the start restores nothing.
Carry
extra_info.prefix_keysinto the shared-prefix write chain and suffixstartacross callbacks, as well as across the adapter's internal RPC batches. With the preceding prefix missing, the History writer drops the 12-page suffix; with it present, all 140 pages round-trip from the start. The Bytes actor also rejects a continuation before changing cache contents or recency when any preceding page is absent.Size RPC batches using the configured byte budget and advertised store/queue capacity, retaining the 128-page ceiling and a 32 MiB transfer target with a one-page minimum. Consume the suffix's result flags, stop shared reads or writes at the first miss, rejection, or RPC failure, and pad unattempted results to the requested length.
For shared reads through the Bytes actor, fetch the bounded batches without changing recency, then refresh exactly the returned contiguous prefix once in tail-to-head order. With 16 MiB pages and room for three pages, reading A/B/C and inserting D now leaves A/B/D for both single and split reads. A split read that stops at a miss refreshes only the pages returned before it. Bytes actors that do not advertise deferred refresh retain the existing per-batch read behavior.
The History actor and proxy keep their existing read behavior and directory refresh rules. Native Torch reads and writes retain independent page access. TP, quantized and DeepSeek-V4.1 multi-pool storage is unchanged. The vLLM, MLX and TRT-LLM adapter code is unchanged; their continuations receive the same missing-prefix rejection when using Bytes storage. History directory ordering, real LMCache/Mooncake eviction, and staging behavior are tracked in #6135.
Regression coverage includes separate backup callbacks with a missing or present preceding prefix, split Bytes actor reads and eviction, a split read stopping at a miss, rejected heads, rejection after an accepted batch, native random access, byte budgets, and a 300-page round trip through a 100-page history queue. The History write tests use real Xavier History actors and proxy with an in-memory LMCache stand-in and deterministic queue draining. The Bytes write and read tests use a real Bytes actor. The missing-prefix Bytes write regression checks the rejected flags, unchanged cache contents, statistics and eviction order, and a resident-prefix control. These tests do not exercise real SGLang inference, native LMCache/Mooncake, or GPU P/D.
VALIDATION: On Ubuntu 24.04.5 LTS at
ec62f035(base5ff1356d),xinference/model/llm/sglang/tests/test_xavier.pypasses 65/65 on Python 3.12.3 with Transformers 5.23.0, on Python 3.12.3 with the Transformers 4.57.6 CI pin, and on Python 3.10.22. The consumer suite on Python 3.12 passes with 408 passed and 84 skipped. Pre-commit passes on the checked files. The fail-before run fails as expected at the suffix-residency assertion with production files reverted to5ff1356dand the candidate tests retained.AI disclosure: this was prepared with AI assistance (Claude Opus 5.5 and Claude Sonnet 5.5).