← Back to Pull requests

fix(kvevents): keep the cache salt after later MM items in the many:1 realign #4138

Closed
unknown closed this pull request without merging on Nov 11, 2026 20:07 UTC
View on GitHub
unknown unknown commented on Nov 10, 2026 11:02 UTC
Author

What type of PR is this?
/kind bug

What this PR does / why we need it:

vLLM v0.19 appends cache_salt to block 0's extra keys after that block's (identifier, offset) MM tuples. When the router's blockSizeTokens is bigger than the engine's block size, realignExtraFeatures merged engine blocks in engine order, so an MM item starting after engine block 0 landed after the salt ([salt img]), while the request side puts the salt after all of router block 0's items ([img salt]). Block 0's key differed, and every later key chains off it, so the whole salted multimodal prompt missed.

This PR keeps the salt apart from the MM hashes:

  • BlockExtraFeatures gets a CacheSalt field. The block hash takes it after MMHashes, so the hash input, and every existing key, stays the same.

  • ParseRawExtraKeys stores a bare string as CacheSalt when any entry of the event is a tuple. The layout is decided per event: with the item starting in engine block 1, engine block 0 holds only the salt.

  • The many:1 realign carries CacheSalt to the canonical block holding its engine block, so it no longer sits between MM items.

  • The request side (setCacheSalt, renamed from foldCacheSalt) sets CacheSalt instead of appending to MMHashes.
  • Events whose MM items are bare identifiers (vLLM v0.18.x and earlier) and salted events with no MM tuples (including SGLang's) can't tell the salt apart, so it stays in MMHashes as before. The 1:many branch is unchanged and still copies the salt to every sub-block; that is #3788.

    Tests:

  • TestBlockStoredEvent_SaltedMMExtraKeysMatchRequestKeys feeds salted v0.19 events (engine block 16, router block 64) and looks up the request keys: no items, an image in engine block 0, an image starting in engine block 1 (fails on main), and the latter with a LoRA adapter.

  • TestParseRawExtraKeys_CacheSalt covers the parse cases, including LoRA name + item + salt in block 0 and a salted event with no tuples.

  • TestMMFeatures_CacheSaltHashesAfterMMHashes checks that CacheSalt hashes the same as the salt appended to MMHashes.

  • A TestRealignExtraFeatures case for the many:1 merge with the salt alone in engine block 0.
  • @Thisish3, could you run this through the differential harness from #3811?

    Which issue(s) this PR fixes:
    Fixes #3787

    Release note _(write NONE if no user-facing change)_:
    ``release-note
    Fixed salted multimodal prompts missing the precise prefix cache when the router's block size is larger than vLLM's and an image starts after the first engine block.
    ``

    Diff: 320 lines (+240 / -80) across 4 files Reviewer: ahg-g Review duration: 1985m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 320 lines diff across 4 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.345
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #4138"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 46.9% (MEDIUM) · Higher = larger blast radius
    46.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.5% · Safe to merge
    18.5%