← Back to Pull requests

feat(core): trace deliberate cancels as cancelled run status #12188

Open
unknown opened this pull request with 197 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 10, 2026 16:19 UTC
Author

LangChainTracer now sends an explicit run status (cancelled / interrupted) for deliberate stops, so a user-cancelled run is no longer traced as a plain error.

abort reason / error                          run status sent
--------------------------------------------  ---------------
ExpectedCancellation (new marker)          -> cancelled
GraphInterrupt, NodeInterrupt,
ParentCommand, GraphDelegate (by name)     -> interrupted
unmarked AbortError, timeout, GraphDrained,
any other error                            -> error (no status sent)

  • New ExpectedCancellation error in @langchain/core/errors. Abort a run with it (controller.abort(new ExpectedCancellation())) to mark the stop as deliberate.

  • The tracer derives status from the same error that sets run.error, and finds the marker on an error's cause chain. A later plain error clears an earlier cancelled, so the two never disagree.

  • LangGraph errors are matched by name, so @langchain/core takes no LangGraph dependency.
  • Compatibility


    status is only sent once the installed langsmith client forwards it on run patches; older langsmith versions ignore it, so behavior is unchanged until then. No change to the langsmith peer range yet; the minimum version will be recorded once that release is out.

    Related: langgraphjs#3329.

    Release note


    LangChainTracer traces runs aborted with ExpectedCancellation as cancelled, and LangGraph interrupts as interrupted.

    _This PR was written with an AI coding agent._

    Diff: 197 lines (+147 / -50) across 2 files Reviewer: mangeshraut712 Review duration: 10031m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 197 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.316
    Real PR Conversation Timeline
    1 comments
    "Review active on #12188"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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.1% (MEDIUM) · Higher = larger blast radius
    36.1%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 19.2% · Safe to merge
    19.2%