← Back to Pull requests

Record request labels in the mock model server client #1111

Closed
unknown closed this pull request without merging on Nov 29, 2026 17:06 UTC
View on GitHub
unknown unknown commented on Nov 20, 2026 22:03 UTC
Author

Part of #524

Old behavior. The OpenAI-compatible clients copy a request's labels onto the recorded metric (#523). The mock client builds its own InferenceInfo and leaves labels empty, so a server.type: mock run reports every request without labels. A timed-out mock request also records a coroutine repr as its request_data, because the timeout path does not await to_request_body.

New behavior. The mock client records the request's labels on the success, timeout and stage-teardown-cancelled metrics, the same outcomes the real clients label. A timed-out request records its request body.

Changes:

  • MockModelServerClient._recorded_info builds the InferenceInfo for a recorded metric and attaches data.labels; the three recording sites use it.

  • The timeout path awaits data.to_request_body.
  • Testing:

  • A labelled request records its labels when it succeeds, when it times out, and when it is cancelled at stage teardown.

  • A timed-out request records its request body. Fails without the await.

  • A request with no labels records empty labels.

  • e2e: OTel replay of the two sample chains with server.type: mock and attribute_to_label_map; all 6 per-request entries carry the mapped label and the fallback for a missing attribute.

  • ruff format --check, ruff check, mypy --strict, type-escape check.

  • pdm run test:e2e (full), pdm run check:cov, pdm run check:mutation.
  • Diff: 180 lines (+135 / -45) across 2 files Reviewer: rishabhsinha17 Review duration: 12663m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.41) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.41 · 180 lines diff across 2 files
    0.41
    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.311
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #1111"
    general weight: 0.35
    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: 40.6% (MEDIUM) · Higher = larger blast radius
    40.6%
    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: 16% · Safe to merge
    16%