← Back to Pull requests

fix(epp): read every gRPC frame in a vllmgrpc response chunk #4189

Open
unknown opened this pull request with 243 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 11, 2026 17:09 UTC
Author

What type of PR is this?
/kind bug

What this PR does / why we need it:

The vllmgrpc response parser decoded only the first length-prefixed gRPC frame of each response body chunk and ignored the rest. The handler's completeGRPCFrames already hands the parser whole frames and carries a split frame to the next chunk, but one chunk can still hold several frames. When a GenerateComplete shares a chunk with the preceding GenerateStreamChunk, its usage was dropped and the request was recorded with no token counts.

ParseResponse now walks every frame with grpcframe.ForEachPayload, the same iterator the sglanggrpc parser uses. Per-frame decoding (GenerateResponse, falling back to EmbedResponse) is unchanged and moved into parseResponsePayload. When several frames carry usage, the last one wins, matching the vertexai parser. A frame that cannot be decoded is reported in the returned error, and the usage of the other frames in the chunk is still returned. The single-frame toGenerateResponse and toEmbedResponse helpers are removed since they have no other callers.

The empty end-of-stream body handling from #3652 is unchanged.

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

Test plan:

  • A chunk holding a usage-less stream chunk followed by a GenerateComplete reports the complete frame's usage (fails on main with no usage).

  • When several frames carry usage, the last one is reported (fails on main, which reports the first).

  • Usage parsed before a truncated trailing frame, or around an unrecognized frame, is kept and the error is returned.

  • go test ./pkg/epp/framework/plugins/requesthandling/... ./pkg/epp/handlers/... passes; golangci-lint run on the package reports 0 issues.
  • Release note _(write NONE if no user-facing change)_:
    ``release-note
    Fixed the vLLM gRPC response parser dropping token usage when several gRPC frames arrive in one response body chunk.
    ``

    Diff: 243 lines (+182 / -61) across 3 files Reviewer: ahg-g Review duration: 3700m
    All Vouch review confidence checks passed
    Residual risk 0.23 = Change Risk (0.44) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.44 · 243 lines diff across 3 files
    0.44
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.329
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #4189"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.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: 43.8% (MEDIUM) · Higher = larger blast radius
    43.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: 46.7% · Lower = rushed or shallow review
    46.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: 23.4% · Safe to merge
    23.4%