← Back to Pull requests

fix(test-optimization): keep Failed Test Replay working after a probe fails to set or remove #11323

Closed
unknown closed this pull request without merging on Nov 23, 2026 17:44 UTC
View on GitHub
unknown unknown commented on Nov 19, 2026 06:32 UTC
Author

What does this PR do?

When Failed Test Replay fails to set or remove a probe, the Test Optimization Dynamic Instrumentation worker thread crashes. Setting fails, for example, when no loaded script matches the probe's file. The worker's message listeners are async without a catch, so the failure becomes an unhandled rejection, which ends the worker. No later probe in the test session is then set, so Failed Test Replay stops capturing snapshots, and each retried test waits out the 2-second limit for its probe.

This PR makes the worker acknowledge a failed probe operation along with its error, instead of rejecting. The main thread logs the error and settles the operation as it does for one that succeeded, and the worker keeps handling probes.

A failed Debugger.setBreakpoint call is now acknowledged the same way. The worker used to catch it and only log it itself, so the probe was acknowledged as set and the failure never reached telemetry.

The errors are logged on the main thread because the worker's own logs don't reach telemetry. Until now, these failures only reached telemetry after the crash, as Test Visibility - Dynamic Instrumentation worker error. They now appear as Test Optimization - Dynamic Instrumentation failed to set probe or ... failed to remove probe.

Motivation

We found this while checking whether the worker's Unknown probe id errors could use the SafeError from #11290. On master, the crash is reachable in practice: when Debugger.setBreakpoint fails, the worker logs the failure and still acknowledges the probe, so removing that probe later throws Unknown probe id.

Additional Notes

  • Message format: both channels now acknowledge with { probeId, error } instead of a bare probe ID.

  • Not changed here: the worker's Debugger.paused handler can also reject, for example when capturing a snapshot fails. Catching that needs a guaranteed Debugger.resume, or the test process could stay paused, and a new message type for the main thread's breakpoint-hit handler. It's a separate change.

  • Possible follow-up: a probe that failed to set still gets a removal request, so it now logs a second error, Unknown probe id. The main thread could skip removing probes whose set failed.
  • Tested locally:

  • dynamic-instrumentation.spec.js: 11 passing. Against master's production code, the new end-to-end test fails because the worker exits, and the new unit tests time out waiting for an acknowledgement. Restoring the worker's old Debugger.setBreakpoint catch makes the worker test fail.

  • The Test Optimization unit specs with test:trace:core's per-file runner: 810 passing.

  • The Failed Test Replay integration tests for Mocha (11 passing) and Jest (7 passing), run before the Debugger.setBreakpoint change, which only affects the failure path.

  • npm run lint, npm run type:check:ci and npm run lint:editorconfig.
  • Reviewed with sol-loop: 2 rounds with gpt-6.2-sol. Sol verdict: approved

    Created with Claude Opus 5.5 in Claude Code via T3 Code.

    Diff: 381 lines (+285 / -96) across 4 files Reviewer: BridgeAR Review duration: 6432m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 381 lines diff across 4 files
    0.43
    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.356
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #11323"
    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: 43.0% (MEDIUM) · Higher = larger blast radius
    43.0%
    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: 17.0% · Safe to merge
    17.0%