← Back to Pull requests

fix(mock): refuse a prepared control of another wire version #9235

Open
unknown opened this pull request with 523 lines diff across 6 files
View on GitHub
unknown unknown commented on Nov 29, 2026 05:03 UTC
Author

Description

Problem

The engine holds a prepared control and a layout each to the version of the wire: a control of another version draws FAILED_PRECONDITION on either role, before the layout is read; a layout of another version INVALID_ARGUMENT. A mock worker on the SGLang wire compared the two with each other instead:

  • A prefill worker took a control of another version and exported a layout of that version.

  • A decode worker took a control and a layout that agree on another version.

  • A decode worker answered a control of another version with INVALID_ARGUMENT, the code of the layout test.
  • Example: a gateway that stamped another version on the control kept a test over mock workers green where a real worker refuses every such request.

    Solution

    prepared refuses a control whose version is not the wire's with FAILED_PRECONDITION, on either role, behind the decode of the control and ahead of the raw media test, in the order of the engine. The layout test of a decode worker is unchanged and now reads as the engine's: a layout of another version or binding than its control draws INVALID_ARGUMENT.

    What a caller of the mock reads otherwise: the three shapes above now draw FAILED_PRECONDITION. A request the engine takes is still taken.

    Left out as before: the engine tests that a binding is whole ahead of its version, so a control of another version with a binding that is not whole reads FAILED_PRECONDITION here and INVALID_ARGUMENT on the engine; also a binding's contract names, a control's timeout, the request options, the media layout and the bounds on lengths.

    Ready check

  • Architecture: one check in the mock's own reading of the wire (prepared in crates/mock_worker/src/grpc/sglang.rs), beside the ones it already makes; the constant comes from the module the file already takes its wire records from. No gateway or engine code changes; no new public item, flag or dependency.

  • Engines: vLLM, TokenSpeed and TensorRT-LLM are not served by this code. SGLang: the check mirrors generate in crates/engine_servicer/src/sglang/native.rs and validate_manifest in crates/grpc_client/src/sglang_managed.rs, by a read of that code.

  • Cost: none on a request path of the gateway; the mock is a test worker.
  • Changes

  • crates/mock_worker/src/grpc/sglang.rs: prepared refuses a control of another version than the wire's. Tests: the fixture's binding is whole, so each case draws its code from the check it names on the engine too; one new case in the prefill test, two in the decode test; the decode test's case of an aged version now ages the layout, the side its status code belongs to.

  • crates/mock_worker/README.md: the sentence on the prepared request a worker refuses.
  • Test Plan

  • cargo test -p mock-worker: 437 passed, 0 failed.

  • Each new case failed before the check was laid: the prefill worker took the control of another version; the decode worker answered it with INVALID_ARGUMENT and took the pair that agrees on another version.

  • The case of the aged layout fails with the version clause of the layout test taken out; the reverse was taken back.

  • cargo test -p smg --test grpc_pd_tests: 46 passed, 0 failed, the prepared-input test of the gateway among them: the gateway stamps the version the mock now asks for.

  • cargo clippy -p mock-worker --all-targets -- -D warnings, cargo doc -p mock-worker --no-deps with warnings denied and cargo +nightly fmt -p mock-worker -- --check are clean.
  • Release note

    The mock worker on the SGLang wire now refuses a prepared control whose version is not the wire's, on a prefill and on a decode worker, with FAILED_PRECONDITION, as the engine does. Before, a prefill worker took such a control, and a decode worker took it when its layout carried the same version and answered INVALID_ARGUMENT otherwise. A test over mock workers that sends a control of another version now reads the engine's refusal.

    Numbers

    | metric | before | after | setup |
    |---|---|---|---|
    | request shapes of the three above that a mock worker answers with FAILED_PRECONDITION | 0 | 3 | the new cases of the prefill test and of the decode test |

    Diff: 523 lines (+392 / -131) across 6 files Reviewer: claude[bot] Review duration: 8m
    All Vouch review confidence checks passed
    Residual risk 0.32 = Change Risk (0.48) × (1 − Review Confidence (0.34)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 523 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 62% · Reviewer familiarity: 35%
    33%
    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.375
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #9235"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 33.7% 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: 47.8% (MEDIUM) · Higher = larger blast radius
    47.8%
    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: 33.7% · Lower = rushed or shallow review
    33.7%
    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: 31.7% · Safe to merge
    31.7%