← Back to Pull requests

fix(test-optimization): start the attempt timeout when a socket is free #11476

Merged
juan-fernandez merged 3 files (242 lines) on Nov 27, 2026 11:08 UTC
View on GitHub
juan-fernandez juan-fernandez commented on Nov 27, 2026 08:50 UTC
Author

<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<!-- Please make sure your changes are properly tested -->
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

<!--
PR title guidance:

  • Follow Conventional Commits format: type(scope): description.

  • Valid types: feat, fix, docs, style, refactor, perf, test, bench, build, ci, chore, revert.

  • Reserve feat, fix, and perf for shipped production code.

  • A scope is optional, but omitting it does not change how the type is selected. For example,

  • use test: cover retries, not fix: cover retries.
  • A production type is valid for multiple scopes when at least one scope represents shipped code,

  • such as fix(http, tests): handle retries.
  • For non-production changes, use the area as the type:

  • - Tests: test(scope): description
    - Benchmarks: bench(scope): description
    - Documentation: docs(scope): description
    - CI and workflows: ci(scope): description
    - Build tooling: build(scope): description
    - Maintenance: chore(scope): description
  • For example, use docs(api): update setup guide, not fix(docs): update setup guide;

  • use test(http): cover retries, not fix(test): cover retries.
  • Apply the same rule to repository tooling. Examples include docs(agents), chore(codeowners),

  • chore(eslint), chore(scripts), ci(release), ci(workflows), and test(integration-tests).
  • Product scopes such as ci, test-optimization, and ci-visibility may still describe shipped production changes.

  • Add the appropriate semver-patch, semver-minor, or semver-major label.

  • -->

    What does this PR do?


    <!-- A brief description of the change being made with this pull request. -->

    Test Optimization requests sent through an agent with a socket limit wait in the request layer until one of the sockets for their origin is free. Their attempt timeout starts then, not when the attempt is created.

  • Each origin has its own sockets, as in Node.js, so a busy test-cycle intake does not hold back coverage, logs, or API uploads.

  • A finished attempt hands its socket to the oldest waiting request for the same origin. If that request has reached its deadline or is blocked by transport backpressure, the socket goes to the next one.

  • A request still waiting for a socket at the final-flush deadline is reported as ERR_DD_TEST_OPTIMIZATION_BACKPRESSURE_TIMEOUT.
  • Motivation


    <!-- What inspired you to submit this pull request? -->

    The payload agent has 16 sockets, and each attempt has a 15-second timeout. When that timeout also counts the wait for a socket, a payload near the end of a long queue can send its whole body, time out before the intake answers, and be uploaded again by the retry.

    Additional Notes


    <!-- Anything else we should know when reviewing? -->

    Synthetic replay of 187 payloads of about 2 MiB, sent in worker-sized messages to an intake that answers after 8 seconds (Node 24, one trial per row):

    | Arrival rate | Duplicate uploads, master | This PR | Final flush, master | This PR |
    | --- | ---: | ---: | ---: | ---: |
    | 25 MiB/s | 31 | 0 | 48.5 s | 33.6 s |
    | As fast as possible | 15 | 0 | 30.6 s | 16.2 s |

    Dropped payloads are the same on both (123 and 155). #11441 makes this reachable at lower latencies, because its compressed queue holds more payloads.

    request.spec.js covers the socket limit, the timeout start, the handoff past a request that reached its deadline, and the final-flush error. The ci-visibility and exporters specs pass with scripts/mocha-parallel-files.js, and npm run type:check:ci passes.

    🤖 Generated with Claude Code

    Diff: 242 lines (+237 / -5) across 3 files Reviewer: szegedi Review duration: 138m
    All Vouch review confidence checks passed
    Residual risk 0.05 = Change Risk (0.39) × (1 − Review Confidence (0.88)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 242 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.84 · 5 substantive comment(s)
    0.84
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    87%
    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.329
    Real PR Conversation Timeline
    23 items
    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 27, 2026 08:50 UTC
    Bot

    <!-- codex-pull-request-review-summary -->
    <!-- codex-review-state:v1 {"code_review":{"commit_sha":"089e6455992eff49b6b7e3d24075641c5a25f9d9","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":"089e6455992eff49b6b7e3d24075641c5a25f9d9","has_any_findings":null,"has_unresolved_findings":null,"status":"completed"}} -->
    <!-- codex-security-review:v1 {"blockingSeverityThreshold":"P0","headSha":"089e6455992eff49b6b7e3d24075641c5a25f9d9","mergeGateEnabled":false,"pullRequestNumber":11476,"repository":"DataDog/dd-trace-js","status":"completed"} -->
    <details>
    <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary>

    This comment shows the latest Codex review activity on this pull request.

    | Review | Status | Commit | Review trigger |
    | --- | --- | --- | --- |
    | 📝 Code Review | ✅ Completed <relative-time datetime="2026-11-27T09:05:39.894569Z">2026-11-27T09:05:39.894569Z</relative-time> | 089e645 | Manual request |
    | 🔒 Security Review | ✅ Completed <relative-time datetime="2026-11-27T09:08:10.556689Z">2026-11-27T09:08:10.556689Z</relative-time> | 089e645 | Manual request |

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review" or "@codex security review".
  • Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

    </details>

    </details>

    dd-octo-sts[bot] dd-octo-sts[bot] commented on Nov 27, 2026 08:51 UTC
    Bot

    Overall package size

    Self size: 9.62 MB
    Deduped: 10.42 MB
    No deduping: 10.42 MB

    <details><summary>Dependency sizes</summary>
    | name | version | self size | total size |
    |------|---------|-----------|------------|
    | import-in-the-middle | 3.7.0 | 180.06 kB | 580.71 kB |
    | opentracing | 0.14.7 | 194.81 kB | 194.81 kB |
    | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |

    </details>

    <sub>🤖 This report was automatically generated by heaviest-objects-in-the-universe<sub>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Nov 27, 2026 08:53 UTC
    Code Review
    packages/dd-trace/src/ci-visibility/exporters/request.js:1
    @@ -32,6 +32,49 @@ let ownedBackpressureWaiters = 0
     /** @type {Set<BackpressureWaiter>} */
     const backpressureWaiters = new Set()
     
    +/**
    + * Attempts handed to one HTTP agent, and the attempts waiting for one of its sockets.
    + *
    + * @typedef {object} SocketSlots
    + * @property {number} active
    + * @property {number} limit
    + * @property {Set<() => void>} waiting
    + */
    +
    +/** @type {WeakMap<import('node:http').Agent, SocketSlots>} */
    +const agentSocketSlots = new WeakMap()
    +
    +/**
    + * Returns the socket accounting shared by every request sent through an agent with a bounded pool.
    + *
    + * @param {import('node:http').Agent} [agent]
    + * @returns {SocketSlots | undefined}
    + */
    +function getSocketSlots (agent) {
    +  if (!Number.isFinite(agent?.maxSockets)) return
    +  let slots = agentSocketSlots.get(agent)
    +  if (slots === undefined) {
    +    slots = { active: 0, limit: agent.maxSockets, waiting: new Set() }
    +    agentSocketSlots.set(agent, slots)

    <sub><sub>!P2 Badge</sub></sub> Track socket capacity per origin rather than per agent

    In agentless mode, trace, coverage, log, and screenshot uploads share the same protocol-specific agent but use different intake hosts (agentless/index.js). Node's maxSockets applies per origin, whereas this single counter imposes a limit across all origins. Consequently, 16 outstanding trace uploads now block coverage and logs even when their hosts have no occupied sockets; during finalization, those unrelated payloads can expire without being sent. Comparing the parent and this commit with a stub transport confirms that a coverage request following 16 trace requests is newly withheld. Key the accounting by the agent's connection-pool name so requests wait only when their actual socket pool is full.

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on code on Nov 27, 2026 08:53 UTC
    Code Review
    packages/dd-trace/src/ci-visibility/exporters/request.js:1
    @@ -32,6 +32,49 @@ let ownedBackpressureWaiters = 0
     /** @type {Set<BackpressureWaiter>} */
     const backpressureWaiters = new Set()
     
    +/**
    + * Attempts handed to one HTTP agent, and the attempts waiting for one of its sockets.
    + *
    + * @typedef {object} SocketSlots
    + * @property {number} active
    + * @property {number} limit
    + * @property {Set<() => void>} waiting
    + */
    +
    +/** @type {WeakMap<import('node:http').Agent, SocketSlots>} */
    +const agentSocketSlots = new WeakMap()
    +
    +/**
    + * Returns the socket accounting shared by every request sent through an agent with a bounded pool.
    + *
    + * @param {import('node:http').Agent} [agent]
    + * @returns {SocketSlots | undefined}
    + */
    +function getSocketSlots (agent) {
    +  if (!Number.isFinite(agent?.maxSockets)) return
    +  let slots = agentSocketSlots.get(agent)
    +  if (slots === undefined) {
    +    slots = { active: 0, limit: agent.maxSockets, waiting: new Set() }
    +    agentSocketSlots.set(agent, slots)
    +  }
    +  return slots
    +}
    +
    +/**
    + * Hands a finished attempt's socket to the oldest attempt waiting for one.
    + *
    + * @param {SocketSlots} slots
    + */
    +function releaseSocketSlot (slots) {
    +  slots.active--
    +  // A woken request can settle or wait for exporter backpressure instead, leaving the socket to the next one.
    +  while (slots.active < slots.limit && slots.waiting.size > 0) {
    +    const [next] = slots.waiting
    +    slots.waiting.delete(next)
    +    next()

    <sub><sub>!P2 Badge</sub></sub> Drain synchronous socket handoffs without recursive re-entry

    When many requests are waiting and the common transport's buffer has insufficient remaining space for their bodies, transport.writable can still be true, but each attempt synchronously invokes its callback with ERR_DD_REQUEST_BUFFER_FULL (exporters/common/request.js). That callback calls releaseSocketSlot() again, so this synchronous next() recursively dispatches another waiter before the previous attempt can schedule its backpressure retry. A reproduction with 10,000 queued 1 KiB payloads overflowed the stack after roughly 1,160 dispatches, throwing RangeError out of the response callback and leaving requests stranded. Make the drain re-entrancy-safe so synchronous transport failures are processed iteratively rather than adding a stack frame per waiter.

    AGENTS.md reference: AGENTS.md:L104-L106

    Useful? React with 👍 / 👎.

    <!-- codex-code-review-finding:v1 -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 27, 2026 08:53 UTC
    Reviewer

    <!-- codex-review-receipt:v1 -->

    💡 Codex Review

    Here are some automated review suggestions for this pull request.

    Reviewed commit: 33a7cdaa46

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review".
  • If Codex has suggestions, it will comment; otherwise it will react with 👍.

    Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    </details>

    codecov[bot] codecov[bot] commented on Nov 27, 2026 08:57 UTC
    Bot

    Codecov Report


    :white_check_mark: All modified and coverable lines are covered by tests.
    :white_check_mark: Project coverage is 99.16%. Comparing base (0b16c04) to head (089e645).

    <details><summary>Additional details and impacted files</summary>

    @@           Coverage Diff           @@
    ##           master   #11476   +/-   ##
    =======================================
      Coverage   99.16%   99.16%           
    =======================================
      Files        1142     1142           
      Lines      189752   189849   +97     
      Branches       86       86           
    =======================================
    + Hits       188168   188265   +97     
      Misses       1584     1584           
    

    | Flag | Coverage Δ | |
    |---|---|---|
    | ai-guard | 63.86% <100.00%> (-0.02%) | :arrow_down: |
    | apm-capabilities | 55.09% <100.00%> (+0.02%) | :arrow_up: |
    | apm-integrations | 81.92% <100.00%> (-0.01%) | :arrow_down: |
    | appsec | 59.66% <100.00%> (+0.09%) | :arrow_up: |
    | debugger | 70.90% <100.00%> (-0.02%) | :arrow_down: |
    | instrumentation | 59.95% <100.00%> (+0.05%) | :arrow_up: |
    | llmobs | 82.54% <100.00%> (-0.02%) | :arrow_down: |
    | master-coverage | 99.16% <100.00%> (?) | |
    | openfeature | 68.10% <100.00%> (-0.02%) | :arrow_down: |
    | platform | 67.51% <100.00%> (+<0.01%) | :arrow_up: |
    | profiling | 66.55% <100.00%> (-0.02%) | :arrow_down: |
    | serverless | 66.99% <100.00%> (-0.01%) | :arrow_down: |
    | test-optimization | 82.06% <97.05%> (+0.02%) | :arrow_up: |

    Flags with carried forward coverage won't be shown. Click here to find out more.
    </details>

    :umbrella: View full report in Codecov by Harness.
    :loudspeaker: Have feedback on the report? Share it here.
    <details><summary> :rocket: New features to boost your workflow: </summary>

  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

  • </details>

    juan-fernandez juan-fernandez commented on code on Nov 27, 2026 08:59 UTC
    Code Review
    packages/dd-trace/src/ci-visibility/exporters/request.js:1
    @@ -32,6 +32,49 @@ let ownedBackpressureWaiters = 0
     /** @type {Set<BackpressureWaiter>} */
     const backpressureWaiters = new Set()
     
    +/**
    + * Attempts handed to one HTTP agent, and the attempts waiting for one of its sockets.
    + *
    + * @typedef {object} SocketSlots
    + * @property {number} active
    + * @property {number} limit
    + * @property {Set<() => void>} waiting
    + */
    +
    +/** @type {WeakMap<import('node:http').Agent, SocketSlots>} */
    +const agentSocketSlots = new WeakMap()
    +
    +/**
    + * Returns the socket accounting shared by every request sent through an agent with a bounded pool.
    + *
    + * @param {import('node:http').Agent} [agent]
    + * @returns {SocketSlots | undefined}
    + */
    +function getSocketSlots (agent) {
    +  if (!Number.isFinite(agent?.maxSockets)) return
    +  let slots = agentSocketSlots.get(agent)
    +  if (slots === undefined) {
    +    slots = { active: 0, limit: agent.maxSockets, waiting: new Set() }
    +    agentSocketSlots.set(agent, slots)

    Fixed in 089e645599: slots are now keyed by agent and origin, using the endpoint key from retry.js, so a full test-cycle pool no longer holds back coverage, logs or API uploads. Covered by limits each origin to its own agent sockets.

    _🤖 Addressed by Claude Code_

    juan-fernandez juan-fernandez commented on code on Nov 27, 2026 09:00 UTC
    Code Review
    packages/dd-trace/src/ci-visibility/exporters/request.js:1
    @@ -32,6 +32,49 @@ let ownedBackpressureWaiters = 0
     /** @type {Set<BackpressureWaiter>} */
     const backpressureWaiters = new Set()
     
    +/**
    + * Attempts handed to one HTTP agent, and the attempts waiting for one of its sockets.
    + *
    + * @typedef {object} SocketSlots
    + * @property {number} active
    + * @property {number} limit
    + * @property {Set<() => void>} waiting
    + */
    +
    +/** @type {WeakMap<import('node:http').Agent, SocketSlots>} */
    +const agentSocketSlots = new WeakMap()
    +
    +/**
    + * Returns the socket accounting shared by every request sent through an agent with a bounded pool.
    + *
    + * @param {import('node:http').Agent} [agent]
    + * @returns {SocketSlots | undefined}
    + */
    +function getSocketSlots (agent) {
    +  if (!Number.isFinite(agent?.maxSockets)) return
    +  let slots = agentSocketSlots.get(agent)
    +  if (slots === undefined) {
    +    slots = { active: 0, limit: agent.maxSockets, waiting: new Set() }
    +    agentSocketSlots.set(agent, slots)
    +  }
    +  return slots
    +}
    +
    +/**
    + * Hands a finished attempt's socket to the oldest attempt waiting for one.
    + *
    + * @param {SocketSlots} slots
    + */
    +function releaseSocketSlot (slots) {
    +  slots.active--
    +  // A woken request can settle or wait for exporter backpressure instead, leaving the socket to the next one.
    +  while (slots.active < slots.limit && slots.waiting.size > 0) {
    +    const [next] = slots.waiting
    +    slots.waiting.delete(next)
    +    next()

    Fixed in 089e645599: a release during the handoff now only frees the socket, and the running loop hands it on, so synchronous transport failures are processed iteratively. Covered by hands a free socket on without recursion when woken attempts fail synchronously, which queues 10,001 requests and overflowed the stack before this change.

    _🤖 Addressed by Claude Code_

    datadog-official[bot] datadog-official[bot] commented on code on Nov 27, 2026 09:00 UTC
    Code Review
    packages/dd-trace/src/ci-visibility/exporters/request.js:1
    @@ -32,6 +32,49 @@ let ownedBackpressureWaiters = 0
     /** @type {Set<BackpressureWaiter>} */
     const backpressureWaiters = new Set()
     
    +/**
    + * Attempts handed to one HTTP agent, and the attempts waiting for one of its sockets.
    + *
    + * @typedef {object} SocketSlots
    + * @property {number} active
    + * @property {number} limit
    + * @property {Set<() => void>} waiting
    + */
    +
    +/** @type {WeakMap<import('node:http').Agent, SocketSlots>} */
    +const agentSocketSlots = new WeakMap()
    +
    +/**
    + * Returns the socket accounting shared by every request sent through an agent with a bounded pool.
    + *
    + * @param {import('node:http').Agent} [agent]
    + * @returns {SocketSlots | undefined}
    + */
    +function getSocketSlots (agent) {
    +  if (!Number.isFinite(agent?.maxSockets)) return
    +  let slots = agentSocketSlots.get(agent)
    +  if (slots === undefined) {
    +    slots = { active: 0, limit: agent.maxSockets, waiting: new Set() }
    +    agentSocketSlots.set(agent, slots)
    +  }
    +  return slots
    +}
    +
    +/**
    + * Hands a finished attempt's socket to the oldest attempt waiting for one.
    + *
    + * @param {SocketSlots} slots
    + */
    +function releaseSocketSlot (slots) {
    +  slots.active--
    +  // A woken request can settle or wait for exporter backpressure instead, leaving the socket to the next one.
    +  while (slots.active < slots.limit && slots.waiting.size > 0) {
    +    const [next] = slots.waiting
    +    slots.waiting.delete(next)
    +    next()
    +  }
    +}

    <!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
    <!-- datadog-autotest-inline:v1:prod -->
    <!-- datadog-autotest-delivery:v1:prod:3b59038e2e2969efee79c4143641b3e2ab0fd3f0334596fdb411232bd9cb0153:inline-0 -->

    <sub><sub>!P1</sub></sub> Prevent recursive socket handoff under transport backpressure

    <!-- autotest-finding-meta prod_data_type=none finding_id=8fddc098-5405-40b4-9851-7bd32bd015dc prod_effect=static -->
    When the common transport has some buffer capacity but insufficient room for the next payload, writable remains true and its callback synchronously returns ERR_DD_REQUEST_BUFFER_FULL. That callback releases another slot, recursively entering this drain. A focused harness with 16 slots and 3,000 waiting 1-KiB requests reproduced a stack overflow before the successful request completed. Make the drain non-reentrant so transport backpressure cannot crash the test process; the suggested guard drained the same queue successfully.

     * @param {SocketSlots & { draining?: boolean }} slots
     */
    function releaseSocketSlot (slots) {
      slots.active--
      if (slots.draining) return
      slots.draining = true
      try {
        // A woken request can settle or wait for exporter backpressure instead, leaving the socket to the next one.
        while (slots.active < slots.limit && slots.waiting.size > 0) {
          const [next] = slots.waiting
          slots.waiting.delete(next)
          next()
        }
      } finally {
        slots.draining = false
      }
    }
    

    <!-- datadog-autotest-feedback-legend:v1 -->
    React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
    <details><summary>What each reaction means</summary>

  • 👍 Useful: correct, and you're fixing it or will.

  • 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.

  • 😕 Unclear: you can't tell what it means or why it matters.

  • 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.

  • </details>

    <sub>🤖 Bits Code Review</sub> <sub>· <a href="https://app.datadoghq.com/code/ffee78fa-1073-41cd-a31b-27e9536ec856?referrer=autotest-pr-comment">Open Bits AI session</a></sub>

    datadog-official[bot] datadog-official[bot] commented on code on Nov 27, 2026 09:00 UTC
    Code Review
    packages/dd-trace/src/ci-visibility/exporters/request.js:1
    @@ -32,6 +32,49 @@ let ownedBackpressureWaiters = 0
     /** @type {Set<BackpressureWaiter>} */
     const backpressureWaiters = new Set()
     
    +/**
    + * Attempts handed to one HTTP agent, and the attempts waiting for one of its sockets.
    + *
    + * @typedef {object} SocketSlots
    + * @property {number} active
    + * @property {number} limit
    + * @property {Set<() => void>} waiting
    + */
    +
    +/** @type {WeakMap<import('node:http').Agent, SocketSlots>} */
    +const agentSocketSlots = new WeakMap()
    +
    +/**
    + * Returns the socket accounting shared by every request sent through an agent with a bounded pool.
    + *
    + * @param {import('node:http').Agent} [agent]
    + * @returns {SocketSlots | undefined}
    + */
    +function getSocketSlots (agent) {
    +  if (!Number.isFinite(agent?.maxSockets)) return
    +  let slots = agentSocketSlots.get(agent)

    <!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
    <!-- datadog-autotest-inline:v1:prod -->
    <!-- datadog-autotest-delivery:v1:prod:3b59038e2e2969efee79c4143641b3e2ab0fd3f0334596fdb411232bd9cb0153:inline-1 -->

    <sub><sub>!P2</sub></sub> Track socket slots separately for each destination pool

    <!-- autotest-finding-meta prod_data_type=none finding_id=c3ca5686-8fa1-447f-93cb-a0e9e723ed1d prod_effect=static -->
    In agentless mode, trace and coverage writers share one HTTPS agent across different intake hosts. Node applies maxSockets separately to each origin, but this counter imposes 16 slots across the entire agent. The reviewer's base/head harness confirmed that 16 outstanding trace requests now block coverage despite its destination having no occupied sockets. A slow trace intake can therefore make healthy coverage uploads miss final-flush deadlines. Key the accounting by the agent's destination pool; this requires changes to both pool lookup and request-option handling.

    <!-- datadog-autotest-feedback-legend:v1 -->
    React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
    <details><summary>What each reaction means</summary>

  • 👍 Useful: correct, and you're fixing it or will.

  • 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.

  • 😕 Unclear: you can't tell what it means or why it matters.

  • 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.

  • </details>

    <sub>🤖 Bits Code Review</sub> <sub>· <a href="https://app.datadoghq.com/code/ffee78fa-1073-41cd-a31b-27e9536ec856?referrer=autotest-pr-comment">Open Bits AI session</a></sub>

    datadog-official[bot] datadog-official[bot] commented on Nov 27, 2026 09:00 UTC
    Reviewer

    <img src="https://img.shields.io/badge/BITS%20CODE%20REVIEW-FAIL-CC0000?labelColor=632CA6&style=for-the-badge&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBkPSJNNjMuNTUsNzQuMzJhNTUuMiw1NS4yLDAsMCwxLTEwLTguMzJjLS4zMS0uMjMtLjI2LTEuMjUtLjI2LTEuMjVBNTUuODEsNTUuODEsMCwwLDAsNjguOTQsNzMuMWExMi43NCwxMi43NCwwLDAsMCw5LjgxLS44MywyNSwyNSwwLDAsMCw3LjUzLTYuNjRsLjM0LjU5YTE0LjkzLDE0LjkzLDAsMCwxLTEuMjksMy4wNiw4LDgsMCwwLDAsMi4yNC44MWw2LS45M2ExOC4xMiwxOC4xMiwwLDAsMCwyLTE0LjMxYy0uOTMtMy01Ljc5LTkuMS02LjE0LTkuNDMtMS4yMi0xLjE3LjIxLTUuNy0yLjIxLTEwLjY1Qzg0LjY1LDI5LjU0LDc4LDI0LjA5LDc1LjA5LDIxLjcyYy44NS42Miw2LjEsMi43NCw4LjU1LDUuNjkuMjMtLjMuMzItMS44OS41My0yLjI5LTIuMS0yLjc2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jQ3LDM0LjU0LDgyLjQ0LDM0LjM0LDgzLjg1LDM1Wm0tNC42LDIxLjYzYy43Mi0uNTcsNC0xLjYyLDcuMDktMiwxLjYtLjE5LDMuODgtLjI5LDQuMzcsMCwxLC41MywxLDIuMTguMzEsMy43Mi0xLDIuMjItMi4zMyw0LjY3LTMuODgsNC44Ny0yLjUyLjM0LTQuOTEtMS03LjYzLTMuMDZBMi4yMywyLjIzLDAsMCwxLDc5LjI1LDU2LjYyWk01NS4zNCwzOS43NWM0LTIuNzMsOS4xNi0xLjY1LDguMy0uODMtMS42NSwxLjU2LjU0LDEuMS43OCw0YTUsNSwwLDAsMS0xLjEyLDRBMjUuNDksMjUuNDksMCwwLDAsNTguNyw0OGEyNiwyNiwwLDAsMC0yLjg1LDEuMTMsNy4zMiw3LjMyLDAsMCwxLS43My0uNTVBNS41Myw1LjUzLDAsMCwxLDU1LjM0LDM5Ljc1Wm02MC4xMSwyNy44Mi0zMi41MSw1LjlhMTYsMTYsMCwwLDEtMy43NSwzLjMzLDExLjc1LDExLjc1LDAsMCwxLTkuMjkuODUsMjAsMjAsMCwwLDEtMy43MS0xLjE5bC03Ljk1LDEuMSw0LjgzLDQwLjIsNTUuNy0xMFpNNjUuODgsMTEzLjkybC0uNDYtNC4zNyw5LjA5LTEzLjg4LDEwLjMzLDMsOC44OC0xNC44NCwxMC42NSw3LDguMS0xNywyLjg3LDMwLjkxWiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg%3D%3D" alt="Bits Code Review: FAIL" height="36"/>

    Socket handoff can recurse through synchronous buffer-full callbacks until the test process overflows its stack. The agent-wide counter also makes independent intake hosts contend for one shared socket limit.

    <sub>Open Bits AI session</sub>

    <sub>🤖 Bits Code Review · Commit 33a7cda</sub>

    <!-- autotest-meta model=gpt-6.1-sol engine=codex reasoning_effort=high verdict=FAIL ddrs_bucket=unknown session_id=ffee78fa-1073-41cd-a31b-27e9536ec856 -->

    <!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
    <!-- datadog-autotest:v1:prod -->
    <!-- datadog-autotest-delivery:v1:prod:3b59038e2e2969efee79c4143641b3e2ab0fd3f0334596fdb411232bd9cb0153:bundle -->

    juan-fernandez juan-fernandez commented on code on Nov 27, 2026 09:02 UTC
    Code Review
    packages/dd-trace/src/ci-visibility/exporters/request.js:1
    @@ -32,6 +32,49 @@ let ownedBackpressureWaiters = 0
     /** @type {Set<BackpressureWaiter>} */
     const backpressureWaiters = new Set()
     
    +/**
    + * Attempts handed to one HTTP agent, and the attempts waiting for one of its sockets.
    + *
    + * @typedef {object} SocketSlots
    + * @property {number} active
    + * @property {number} limit
    + * @property {Set<() => void>} waiting
    + */
    +
    +/** @type {WeakMap<import('node:http').Agent, SocketSlots>} */
    +const agentSocketSlots = new WeakMap()
    +
    +/**
    + * Returns the socket accounting shared by every request sent through an agent with a bounded pool.
    + *
    + * @param {import('node:http').Agent} [agent]
    + * @returns {SocketSlots | undefined}
    + */
    +function getSocketSlots (agent) {
    +  if (!Number.isFinite(agent?.maxSockets)) return
    +  let slots = agentSocketSlots.get(agent)
    +  if (slots === undefined) {
    +    slots = { active: 0, limit: agent.maxSockets, waiting: new Set() }
    +    agentSocketSlots.set(agent, slots)
    +  }
    +  return slots
    +}
    +
    +/**
    + * Hands a finished attempt's socket to the oldest attempt waiting for one.
    + *
    + * @param {SocketSlots} slots
    + */
    +function releaseSocketSlot (slots) {
    +  slots.active--
    +  // A woken request can settle or wait for exporter backpressure instead, leaving the socket to the next one.
    +  while (slots.active < slots.limit && slots.waiting.size > 0) {
    +    const [next] = slots.waiting
    +    slots.waiting.delete(next)
    +    next()
    +  }
    +}

    Already fixed in 089e645599, after the reviewed commit: releaseSocketSlot sets a draining flag (reset in finally), so a release inside the handoff only frees the socket and the running loop hands it on. Covered by hands a free socket on without recursion when woken attempts fail synchronously (10,001 waiting requests).

    _🤖 Addressed by Claude Code_

    juan-fernandez juan-fernandez commented on code on Nov 27, 2026 09:02 UTC
    Code Review
    packages/dd-trace/src/ci-visibility/exporters/request.js:1
    @@ -32,6 +32,49 @@ let ownedBackpressureWaiters = 0
     /** @type {Set<BackpressureWaiter>} */
     const backpressureWaiters = new Set()
     
    +/**
    + * Attempts handed to one HTTP agent, and the attempts waiting for one of its sockets.
    + *
    + * @typedef {object} SocketSlots
    + * @property {number} active
    + * @property {number} limit
    + * @property {Set<() => void>} waiting
    + */
    +
    +/** @type {WeakMap<import('node:http').Agent, SocketSlots>} */
    +const agentSocketSlots = new WeakMap()
    +
    +/**
    + * Returns the socket accounting shared by every request sent through an agent with a bounded pool.
    + *
    + * @param {import('node:http').Agent} [agent]
    + * @returns {SocketSlots | undefined}
    + */
    +function getSocketSlots (agent) {
    +  if (!Number.isFinite(agent?.maxSockets)) return
    +  let slots = agentSocketSlots.get(agent)

    Already fixed in 089e645599, after the reviewed commit: slots are keyed by agent and origin, using the endpoint key from retry.js, so 16 outstanding test-cycle requests no longer block coverage. Covered by limits each origin to its own agent sockets.

    _🤖 Addressed by Claude Code_

    juan-fernandez juan-fernandez commented on Nov 27, 2026 09:04 UTC
    Author

    /datadog autotest review
    @codex review

    datadog-official[bot] datadog-official[bot] commented on Nov 27, 2026 09:04 UTC
    Reviewer

    <img src="https://img.shields.io/badge/BITS%20CODE%20REVIEW-PASS-1a7f37?labelColor=632CA6&style=for-the-badge&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBkPSJNNjMuNTUsNzQuMzJhNTUuMiw1NS4yLDAsMCwxLTEwLTguMzJjLS4zMS0uMjMtLjI2LTEuMjUtLjI2LTEuMjVBNTUuODEsNTUuODEsMCwwLDAsNjguOTQsNzMuMWExMi43NCwxMi43NCwwLDAsMCw5LjgxLS44MywyNSwyNSwwLDAsMCw3LjUzLTYuNjRsLjM0LjU5YTE0LjkzLDE0LjkzLDAsMCwxLTEuMjksMy4wN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PASS" height="36"/>

    <details>
    <summary>More details</summary>

    Attempt timeouts now start when a destination’s socket slot becomes available, while final-flush deadlines still bound queued requests. The update fixes both earlier issues—recursive handoff causing stack overflow and contention between independent intake hosts—and leaves no reportable findings in static review.

    </details>
    Was this helpful? React 👍 or 👎

    <sub>Open Bits AI session</sub>

    <sub>🤖 Bits Code Review · Commit 089e645</sub>

    <!-- autotest-meta model=gpt-6.1-sol engine=codex reasoning_effort=high verdict=PASS ddrs_bucket=unknown session_id=ffee78fa-1073-41cd-a31b-27e9536ec856 -->

    <!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
    <!-- datadog-autotest:v1:prod -->
    <!-- datadog-autotest-delivery:v1:prod:f52d87423caa37d977e3136eb5e8ed630801afdc33bf08c04b844605ae438f5a:bundle -->

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 27, 2026 09:05 UTC
    Bot

    <!-- codex-review-receipt:v1 -->

    Codex Review: Didn't find any major issues. Keep it up!

    Reviewed commit: 089e645599

    <details> <summary>ℹ️ About Codex in GitHub</summary>
    <br/>

    Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review

  • Mark a draft as ready

  • Comment "@codex review".
  • If Codex has suggestions, it will comment; otherwise it will react with 👍.

    Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

    </details>

    datadog-official[bot] datadog-official[bot] commented on Nov 27, 2026 09:06 UTC
    Bot

    <a target='_blank' href='https://app.datadoghq.com/ci/pipeline-executions?query=ci_level%3Ajob+%40git.commit.sha%3A089e6455992eff49b6b7e3d24075641c5a25f9d9&referrer=pr-comment&start=1795768177000'><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/pipelines-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/pipelines-ok-light.svg" alt="Pipelines" align="center" /></picture></a> &nbsp;<a target='_blank' href='https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest+%40git.commit.sha%3A61de1dabe14d866bd601f0c663e43822014f62cd&referrer=pr-comment&start=1795768177000'><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/tests-ok.svg"/><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/badges_header/tests-ok-light.svg" alt="Tests" align="center" /></picture></a>

    <details><summary><b>🎉 All green!</b></summary>

    🧪 All tests passed
    ❄️ No new flaky tests detected
    </details>

    🔄 Datadog retried 1 test - 1 passed on retry <a href="https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest+%40git.commit.sha%3A61de1dabe14d866bd601f0c663e43822014f62cd+%40test.is_retry%3Atrue+AND+%28%40test.retry_reason%3Aauto_test_retry+OR+%28-%40test.retry_reason%3A%2A+AND+-%40test.is_new%3Atrue%29%29&referrer=pr-comment" title="View in Datadog"><img src="https://static.datadoghq.com/static/images/pr_comments/software_delivery/datadog_icon.svg" alt="View in Datadog" align="center" /></a>

    🎯 Code Coverage (<a target='_blank' href='https://app.datadoghq.com/ci/code-coverage/github.com%2Fdatadog%2Fdd-trace-js/pull-requests/11476'>details</a>)<br>• <strong><span title="Percentage of modified executable lines covered by tests in this PR">Patch Coverage</span></strong>: 100.00%<br>• <strong><span title="Percentage of all executable lines covered by tests in the entire codebase">Overall Coverage</span></strong>: 98.57% <span title="Change in overall coverage compared to the base branch">(-0.03%)</span><br>

    <sub>
    This comment will be updated automatically if new data arrives. <br />
    🔗 Commit SHA: 089e645 | <a href="https://docs.datadoghq.com/integrations/guide/source-code-integration/#pr-comments">Docs</a> | <a href="https://app.datadoghq.com/ci/pull-request/Z2l0aHViLmNvbS9kYXRhZG9nL2RkLXRyYWNlLWpzLzExNDc2?referrer=pr-comment">View more details</a> | Give us <a href="https://dd.enterprise.slack.com/archives/C07E3U2QRMM">feedback</a>!
    </sub>

    chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] commented on Nov 27, 2026 09:08 UTC
    Bot

    <!-- codex-review-receipt:v1 -->

    🛡️ Codex Security Review · _Automatically triggered_

    Security review completed. No security issues were found in this pull request.

    Reviewed commit: 089e645599

    View security finding report

    _Only the user who started this review can view the report in Codex._

    <details> <summary>ℹ️ About Codex security reviews in GitHub</summary>
    <br/>

    This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"

  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
  • Once complete, Codex will leave suggestions, or a comment if no findings are found.

    </details>

    datadog-official[bot] datadog-official[bot] commented on Nov 27, 2026 09:09 UTC
    Reviewer

    <img src="https://img.shields.io/badge/BITS%20CODE%20REVIEW-PASS-1a7f37?labelColor=632CA6&style=for-the-badge&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBkPSJNNjMuNTUsNzQuMzJhNTUuMiw1NS4yLDAsMCwxLTEwLTguMzJjLS4zMS0uMjMtLjI2LTEuMjUtLjI2LTEuMjVBNTUuODEsNTUuODEsMCwwLDAsNjguOTQsNzMuMWExMi43NCwxMi43NCwwLDAsMCw5LjgxLS44MywyNSwyNSwwLDAsMCw3LjUzLTYuNjRsLjM0LjU5YTE0LjkzLDE0LjkzLDAsMCwxLTEuMjksMy4wNiw4LDgsMCwwLDAsMi4yNC44MWw2LS45M2ExOC4xMiwxOC4xMiwwLDAsMCwyLTE0LjMxYy0uOTMtMy01Ljc5LTkuMS02LjE0LTkuNDMtMS4yMi0xLjE3LjIxLTUuNy0yLjIxLTEwLjY1Qzg0LjY1LDI5LjU0LDc4LDI0LjA5LDc1LjA5LDIxLjcyYy44NS42Miw2LjEsMi43NCw4LjU1LDUuNjkuMjMtLjMuMzItMS44OS41My0yLjI5LTIuMS0yLjc2LTIuMjYtNy42Ni0yLjI2LTlBMTQuODcsMTQuODcsMCwwLDAsODAuNjksMTFhOC4x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Mi0uNTcsNC0xLjYyLDcuMDktMiwxLjYtLjE5LDMuODgtLjI5LDQuMzcsMCwxLC41MywxLDIuMTguMzEsMy43Mi0xLDIuMjItMi4zMyw0LjY3LTMuODgsNC44Ny0yLjUyLjM0LTQuOTEtMS03LjYzLTMuMDZBMi4yMywyLjIzLDAsMCwxLDc5LjI1LDU2LjYyWk01NS4zNCwzOS43NWM0LTIuNzMsOS4xNi0xLjY1LDguMy0uODMtMS42NSwxLjU2LjU0LDEuMS43OCw0YTUsNSwwLDAsMS0xLjEyLDRBMjUuNDksMjUuNDksMCwwLDAsNTguNyw0OGEyNiwyNiwwLDAsMC0yLjg1LDEuMTMsNy4zMiw3LjMyLDAsMCwxLS43My0uNTVBNS41Myw1LjUzLDAsMCwxLDU1LjM0LDM5Ljc1Wm02MC4xMSwyNy44Mi0zMi41MSw1LjlhMTYsMTYsMCwwLDEtMy43NSwzLjMzLDExLjc1LDExLjc1LDAsMCwxLTkuMjkuODUsMjAsMjAsMCwwLDEtMy43MS0xLjE5bC03Ljk1LDEuMSw0LjgzLDQwLjIsNTUuNy0xMFpNNjUuODgsMTEzLjkybC0uNDYtNC4zNyw5LjA5LTEzLjg4LDEwLjMzLDMsOC44OC0xNC44NCwxMC42NSw3LDguMS0xNywyLjg3LDMwLjkxWiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg%3D%3D" alt="Bits Code Review: PASS" height="36"/>

    <details>
    <summary>More details</summary>

    Socket accounting is scoped per agent and origin, and iterative handoff preserves queue progress when waiting attempts fail synchronously. Full-suite verification remains unavailable because dependencies are absent.

    </details>
    Was this helpful? React 👍 or 👎

    <sub>Open Bits AI session</sub>

    <sub>🤖 Bits Code Review · Commit 089e645</sub>

    <!-- autotest-meta model=gpt-6.1-sol engine=codex reasoning_effort=high verdict=PASS ddrs_bucket=unknown session_id=0cb279d4-26ba-4834-969b-0345696ab418 -->

    <!-- datadog-code-review reviewer-id=bad90057-5c12-4101-ad47-d91c9dff0f90 -->
    <!-- datadog-autotest:v1:prod -->
    <!-- datadog-autotest-delivery:v1:prod:97c1c7b23280cd0d0e8674283c3bb6a1393cbeea296e1b7403f6c6d4ec5f7e13:bundle -->

    pr-commenter[bot] pr-commenter[bot] commented on Nov 27, 2026 09:13 UTC
    Bot

    Benchmarks

    Benchmark execution time: 2026-11-27 09:13:21

    Comparing candidate commit 089e6455992eff49b6b7e3d24075641c5a25f9d9 in PR branch juan-fernandez/test-optimization-socket-slots with baseline commit 0b16c0414adcd14c65b8e23c1049f8a06e3a7823 in branch master.

    📊 Benchmarking dashboard

    Found 0 performance improvements and 0 performance regressions! Performance is the same for 2479 metrics, 8 unstable metrics.

    <details>
    <summary><h3>Explanation</h3></summary>

    This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

    🟩 = significantly better candidate vs. baseline
    🟥 = significantly worse candidate vs. baseline

    We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

    If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

    Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

    <details>
    <summary><h4>More details about the CI and significant changes</h4></summary>

    You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

    CIs of the difference of means are often centered around 0%, because often changes are not that big:

    ---------------------------------(------|---^--------)-------------------------------->
                                  -0.6%    0%  0.3%     +1.2%
                                     |          |        |
             lower bound of the CI --'          |        |
    sample mean (center of the CI) -------------'        |
             upper bound of the CI ----------------------'
    

    As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

    For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

    ----------------------------------------|---------|---(---------^---------)---------->
                                           0%        1%  1.3%      2.2%      3.1%
                                                      |   |         |         |
           significant impact threshold --------------'   |         |         |
                          lower bound of CI --------------'         |         |
           sample mean (center of the CI) --------------------------'         |
                          upper bound of CI ----------------------------------'
    

    </details>

    </details>

    <details>
    <summary><h3>Unstable benchmarks</h3></summary>

    These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

    scenario:appsec-appsec-enabled-20

  • unstable max_rss_usage [-80.137MB; +30.164MB] or [-34.724%; +13.070%]
  • scenario:appsec-iast-no-vulnerability-iast-enabled-default-config-24

  • unstable max_rss_usage [-50.707MB; +72.994MB] or [-15.143%; +21.798%]
  • scenario:appsec-iast-with-vulnerability-iast-enabled-default-config-20

  • unstable max_rss_usage [-40.764MB; +30.033MB] or [-11.429%; +8.421%]
  • scenario:appsec-iast-with-vulnerability-iast-enabled-default-config-26

  • unstable max_rss_usage [-27.229MB; +21.552MB] or [-9.001%; +7.124%]
  • scenario:encoders-0.4-immediate-flush-24

  • unstable max_rss_usage [-6.771MB; +2.487MB] or [-8.072%; +2.965%]
  • scenario:openfeature-initialization-configuration-20

  • unstable max_rss_usage [-7.364MB; +3.228MB] or [-9.288%; +4.071%]
  • scenario:openfeature-initialization-error-20

  • unstable max_rss_usage [-4745.124KB; +4773.124KB] or [-6.154%; +6.190%]
  • scenario:openfeature-scale-full-26

  • unstable max_rss_usage [-38.202MB; +18.882MB] or [-17.557%; +8.678%]
  • </details>

    szegedi szegedi approved these changes on Nov 27, 2026 10:20 UTC
    Approved Reviewer

    Approved these changes.

    anmarchenko anmarchenko approved these changes on Nov 27, 2026 11:07 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    juan-fernandez juan-fernandez
    Labels
    risk: low confidence: 87.8% 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: 38.8% (MEDIUM) · Higher = larger blast radius
    38.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: 87.8% · Lower = rushed or shallow review
    87.8%
    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: 4.8% · Safe to merge
    4.8%