← Back to Pull requests

fix(deduplicate): do not deduplicate requests with a body #6240

Closed
unknown closed this pull request without merging on Nov 21, 2026 07:19 UTC
View on GitHub
unknown unknown commented on Nov 21, 2026 06:48 UTC
Author

This relates to...

N/A

Rationale

The deduplicate interceptor builds its key from the origin, method, path and headers, but not the request body. undici allows a body on GET, and search APIs such as Elasticsearch's _search rely on it, so two concurrent requests to the same URL with different bodies were merged. Only the first body reached the server, and the second caller got the first caller's response:

const client = new Client(origin).compose(interceptors.deduplicate())
await Promise.all([
  client.request({ method: 'GET', path: '/_search', body: '{"tenant":"alice"}' }),
  client.request({ method: 'GET', path: '/_search', body: '{"tenant":"bob"}' })
])
// before: server hits 1, bob receives "results for {"tenant":"alice"}"
// after:  server hits 2, each caller receives its own results

In a service that shares one dispatcher across users, one user can receive another user's results. A body can be a stream and can't be compared cheaply, so requests that carry a body now skip deduplication and are sent as usual.

Changes

Features

N/A

Bug Fixes

  • interceptors.deduplicate() no longer merges requests that carry a body

  • Documented this in Interceptors.md

  • Added a regression test in test/interceptors/deduplicate.js. It fails on main (1 origin hit instead of 2) and passes with the fix
  • Breaking Changes and Deprecations

    N/A

    Status

  • I have read and agreed to the [Developer's Certificate of Origin][cert]

  • Tested

  • Benchmarked (optional)

  • Documented

  • Review ready

  • In review

  • Merge ready
  • [cert]: https://github.com/nodejs/undici/blob/main/CONTRIBUTING.md#developers-certificate-of-origin

    Diff: 218 lines (+163 / -55) across 2 files Reviewer: mcollina Review duration: 31m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 218 lines diff across 2 files
    0.37
    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.322
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6240"
    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: 36.7% (MEDIUM) · Higher = larger blast radius
    36.7%
    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: 14.5% · Safe to merge
    14.5%
    Repository