← Back to Pull requests

feat(node,protocol): add opt-in commissioning cancellation #5022

Closed
unknown closed this pull request without merging on Nov 24, 2026 15:59 UTC
View on GitHub
unknown unknown commented on Nov 19, 2026 04:05 UTC
Author

Type of change

<!-- Check exactly one. -->

  • 🐛 Fix — corrects a defect or wrong behavior

  • ✨ Feature — adds new functionality or capability
  • Description

    Add commissioningAbort, one signal that cancels discovery, PASE, commissioning reads, writes and
    commands, the checks between steps and the operational CASE connection. It is forwarded through
    ClientNode.commission and both deprecated MatterController routes, including a known address.

    This is one of two alternatives for #5020, and it is backward compatible. The existing abort
    option still cancels candidate selection and PASE only, so a PASE winner keeps the rule from #4747
    ("After the win, the winner's operation is not interrupted"). No caller migration is needed. The
    alternative that extends abort itself is #5021.

    Boundaries:

  • CommissioningComplete cannot be canceled once sent, so a cancel while the device commits cannot

  • discard a successful response. A lost response remains ambiguous.
  • The fail-safe still expires after a cancel, including a cancel before the first ArmFailSafe

  • response.
  • A cancel or the PASE timeout stops waiting for a transport open, even if the transport ignores

  • the cancel. A channel that opens later is closed in the background.
  • The operation settles after pending PASE attempts and their cleanup finish. When no address

  • wins, CommissioningConnection now waits for a late PASE session's initiateForceClose()
    before rejecting.
  • Discovery.settled now resolves when first read after discovery finished.
  • Limitations

  • An aborted command may already have acted on the device.

  • Custom callbacks and custom steps must cooperate with cancellation and settle.

  • Noble can reject an aborted open before its native disconnect finishes. React Native does not

  • reserve a peripheral while an open is pending. This change does not alter either backend.

    Backing evidence

  • Related issue: #5020

  • This fix/change is backed by a complete log file — attached here or in the linked issue (not just a few quoted lines).
  • Complete logs of simulated tests:

  • P7b-focused-before-esm.log: the new commissioning tests against unchanged production code,

  • 15 of 30 failed.
  • P7b-focused-after-esm.log, P7b-focused-after-cjs.log: the same tests plus the existing

  • discovery tests with this change, 57 passed in each module format.

    npm test is unchecked: the protocol suite fails the same four ExchangeManager exchange-ID
    allocation timeouts as unchanged upstream; the full node and matter.js suites and all other
    protocol tests pass.

    Checklist

  • I understand the code I am submitting and can explain how it works (AI policy)

  • Tests added or updated to cover the change

  • npm test passes

  • npm run format-verify and npm run lint pass

  • CHANGELOG updated (if applicable)
  • Diff: 365 lines (+273 / -92) across 4 files Reviewer: cwedgwood Review duration: 7913m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.43) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 365 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%
    56%
    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.353
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5022"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.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: 42.7% (MEDIUM) · Higher = larger blast radius
    42.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: 56.8% · Lower = rushed or shallow review
    56.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: 18.5% · Safe to merge
    18.5%