← Back to Pull requests

Report cancelled and timed-out Dispatcher batches and jobs #25505

Closed
unknown closed this pull request without merging on Oct 07, 2026 09:03 UTC
View on GitHub
unknown unknown commented on Oct 05, 2026 12:54 UTC
Author

What does this PR do?

Reports cancelled and timed-out Dispatcher batches and jobs as their own outcomes. GitHub reports a job stopped by timeout-minutes as cancelled, so the Dispatcher tells the two apart itself.

  • Timeouts: a completed job that ran (a runner was assigned, runner_name), concluded cancelled and lasted at least the test jobs' 120-minute limit timed out. It fails the job, its batch and the run, and counts as timed_out in metrics. TEST_JOB_TIMEOUT_MINUTES is tested against both jobs in test-batch.yml. A shorter cancelled job is a genuine cancellation (Status.CANCELLED). Cancelled jobs that ran now get a job.duration sample, so timed-out jobs show up in duration charts.

  • Dense outcome counters (ResultMetric in execution_metrics.py), identical for batches and jobs: passed, failed, skipped, cancelled, inconclusive, timed_out. Each batch or job emits all six, exactly one of them 1.

  • One owner for outcome counters: the gatherer. It counts each planned job once, at the first progress update showing it finished, or at gathering for jobs never observed finished (from their artifacts). A finished job keeps its outcome whatever happens to its batch later. The runner keeps job.duration and the completion log.

  • Batch outcome: a genuinely cancelled batch is cancelled; otherwise a job failure outranks a timeout, which outranks the workflow's own conclusion.

  • Dispatcher cancellation: at shutdown the Dispatcher hands the dispatched batches to TaskTestGatherer.report_unfinished. On a cancellation, every batch and job without an outcome is counted cancelled, instead of jobs.incomplete. Other shutdowns keep jobs.incomplete, excluding jobs whose outcome was already counted. Once stopping, the bus no longer delivers progress updates, so a job that finished in the last poll before a cancellation is counted cancelled.

  • Run outcome and PR comment share DispatcherProgress.has_failure: a failed batch, or a failed job in a batch that was not cancelled. A cancelled batch without failures makes the run cancelled. Cancelled batches and jobs render as 🚫. The CLI aborts a cancelled run with "Dispatcher tests were cancelled." (same exit code).
  • dispatcher.batch.id is no longer a metric tag. Batch IDs are plan positions (batch-00, batch-01, ...) and nothing queries metrics by them. The only metrics that needed the tag were the jobs.queued and jobs.running gauges, to keep concurrent batches from overwriting each other; the runner now emits their per-platform totals across in-flight batches instead.

  • Cleanup: removed state with no production reader or writer: BatchFinished.timed_out (never set by the runner) with the gatherer branches and ProgressError.TIMED_OUT it fed, and the gatherer's _status_by_batch/_results_by_batch registries with WorkflowStatus. Tests that read the registries now assert the published progress or emitted metrics.
  • The commit status that test-batch.yml posts is unchanged: GitHub commit statuses have no cancelled state.

    Motivation

    conclusion_to_status mapped cancelled to FAILURE, but GitHub uses cancelled both for a genuine cancellation and for a job that hit timeout-minutes. Job 110448952220 ran 120.4 minutes and reports conclusion: cancelled; only its annotation says "The job has exceeded the maximum execution time of 2h0m0s". The job payload has nothing else that tells them apart, so this uses the duration.

    The cancellations worth reporting are the Dispatcher's own: once it is cancelled it stops polling, so GitHub never tells it how its batches ended. In the last 7 days, 6,753 of 6,951 incomplete jobs (97%) came from 28 cancelled Dispatcher runs; they are now counted as cancelled.

    Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)

  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.

  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged
  • Diff: 540 lines (+405 / -135) across 6 files Reviewer: HadhemiDD Review duration: 2648m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 540 lines diff across 6 files
    0.48
    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.377
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #25505"
    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: 48.0% (MEDIUM) · Higher = larger blast radius
    48.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: 18.9% · Safe to merge
    18.9%