AZ-401: Diagnosing Pipeline Failures Duration and Flaky Tests
Diagnose pipeline health by separating four questions: which operation failed, where a job waited, which executing tasks consumed time, and whether repeated test outcomes suggest an intermittent problem. Use Azure Pipelines reports to locate candidate failures and duration hotspots, then follow the evidence into individual runs and published test instances. Choose the next intervention from that narrower evidence and verify it against a comparable population. A faster successful run does not establish fewer failures, shorter queues or repaired flaky tests.
This troubleshooting method applies to existing continuous integration (CI) evidence. Azure Pipelines reports and Test Analytics are Azure Pipelines capabilities; they are not a GitHub-native analytics interface. GitHub Actions runner routing and job dependencies provide a separate diagnostic context. No pipeline, runner or test is executed by this article, and the examples below describe proposed investigations rather than measured results.
Establish a trustworthy diagnostic population
Begin with a named pipeline, branch, investigation period and symptom. Preserve the relevant run identifiers, source revision, pipeline definition revision, job identity and test-result references in an access-controlled investigation record. Record attempts separately when a run or job was retried. Keep enough original failure detail to explain the symptom without copying credentials or sensitive payloads into a ticket.
The Azure pipeline Analytics tab exposes pass-rate and duration summaries; select a card for the corresponding report. The reports use pipeline runs, default to a 14-day view, and support date-range and branch filters. Record the actual filters before comparing two screenshots. A branch change or a different observation window can change the apparent trend without any repair.
Treat the following worksheet as a proposed investigation record, not as additional fields promised by the product interface:
| Evidence to record | Diagnostic purpose |
|---|---|
| Pipeline, branch, date range and definition revision | Identifies the population and configuration being compared |
| Run and attempt identifiers, outcome and source revision | Keeps original failures distinguishable from later retries |
| Job, task or test identity and relevant log/result reference | Connects an aggregate signal to a specific operation |
| Observed waiting interval and execution interval, with their boundaries | Prevents a capacity wait from being mistaken for slow task execution |
| Pool/image or runner labels/groups and relevant environment differences | Tests whether routing or environment explains the pattern |
| Proposed change, owner, validation window and restoration condition | Makes the intervention bounded and reviewable |
Check lineage before interpreting an empty or improved chart. Test Analytics draws from published test results accumulated for a build or release pipeline. Tests that never executed, results that were not published, and evidence outside the selected period cannot establish a pass. If expected results are missing, first verify the existing execution and publication path described in AZ-401: Tests Published Results and Enforced Quality Gates. Do not troubleshoot a reporting gap by silently counting missing tests as successful.
Select the next check from the symptom
The pass-rate report identifies top failing tasks and points to their failed runs. The duration report describes how long the pipeline typically takes to complete successfully and highlights tasks by duration. The Test failures report identifies failing tests. These views answer different questions; inspect their underlying evidence before selecting a fix.
| Observed symptom | Next evidence to inspect | Premature conclusion to avoid |
|---|---|---|
| More runs fail | Top failing task, its failed runs and first relevant error | Every red run is a test assertion failure |
| Successful runs take longer | Duration trend, task-duration contribution and comparable run timelines | The report measures every failed or canceled attempt |
| A job waits before executing | Dependency state, eligible agent/runner availability and capacity constraints | A faster compiler will remove a scheduling wait |
| One test fails repeatedly | Test history, individual instances and failure context | Frequency alone proves nondeterminism |
| A retry passes | Original failure, retry inputs and environment differences | The retry repaired the cause |
| The chart improves while expected evidence disappears | Published-result coverage and selected population | Less visible failure means better reliability |
Prioritize by both recurrence and consequence. A frequent short setup failure and a rare failure blocking a critical delivery path warrant different responses. Record the chosen priority and supporting run references. The chart identifies where to investigate; it does not assign business impact or authorize production changes.
Trace a pipeline failure to its first actionable cause
Open a top failing task's failed runs and inspect a representative original attempt. Locate the first relevant error within the affected job, then distinguish it from downstream messages caused by the failure. For example, a missing test-result file can follow an earlier test-process startup failure. Fixing only the publication message would leave the earlier defect unresolved.
Read the job graph alongside the log. Azure Pipelines organizes execution into stages, jobs and steps; an agent executes a job, while a step can be a task or script. A failure label at pipeline level is therefore too broad to establish whether the problem arose in scheduling, setup, compilation, a test process or a deployment operation. Keep the proposed change at the smallest boundary supported by the evidence.
For GitHub Actions, inspect the existing workflow definition separately. A job's needs dependencies normally require upstream success; an upstream failure or skip can propagate a skip unless a suitable condition permits continuation. A job that did not become eligible to run is different from an eligible job waiting for a runner. Review the actual dependency and condition before changing runner capacity or weakening a failure rule.
Compare a small set of affected and unaffected attempts with the same diagnostic question. Look for a meaningful difference such as source revision, task input, operating system, dependency availability or runtime identity. Similar error text across unrelated environments is a lead, not sufficient proof of one common cause. Stop and seek the relevant owner when the next step would alter shared infrastructure, access or deployment behavior.
Separate waiting from execution duration
Keep queue or scheduling evidence separate from the successful-run duration report. Inspect available per-run and job timing details, recording when each measured interval begins and ends. Distinguish waiting for an upstream job, waiting for eligible execution capacity and time after execution actually starts. Do not manufacture a queue-time value by subtracting an aggregate task-duration sum from a pipeline total.
Parallel tasks or jobs can overlap. Adding their durations can therefore exceed elapsed time, while optimizing a task outside the longest dependency path might leave completion time unchanged. Use the graph from AZ-401: YAML Triggers Job Dependencies and Parallel Execution to identify what delayed the downstream work. Preserve the original graph when comparing a proposed change; changing both graph shape and execution environment makes attribution harder.
Check Azure agent capacity and matching
An Azure agent runs one job at a time. Organization parallel-job capacity also limits concurrent execution; queued work can remain even when additional machines exist. For self-hosted agents, demands must match capabilities. For Microsoft-hosted agents, choose a suitable image rather than assuming a self-hosted capability configuration applies unchanged.
Inspect the job's requested pool, agent availability and matching requirements before proposing more capacity. In Agent pools, select the relevant pool, agent and Capabilities tab to inspect an existing self-hosted agent. Do not add a capability merely to satisfy a demand when the underlying tool is absent. Routing metadata is not evidence that a compiler, credential or network dependency works.
Self-hosted machines can preserve state, whereas Microsoft-hosted jobs receive fresh virtual machines. If a failure follows only one self-hosted machine, investigate its environment and persistent state under the owner's maintenance process. Avoid deleting a shared workspace as an exploratory shortcut. Record what evidence would distinguish a machine-specific condition from a source defect.
Check GitHub runner eligibility separately
GitHub routes self-hosted jobs using the requested labels and groups. An eligible online idle runner is required for assignment; a job can remain queued when no matching runner is available. Inspect the actual runs-on requirements and group access, not just the total number of registered machines. Machines also need adequate resources and connectivity; container actions and service containers on self-hosted runners require Linux and Docker.
A workflow matrix defines work to schedule. Its parallelism controls and runner availability constrain execution, so expanding a matrix is not proof of more effective capacity. Review these conditions without presenting Azure report cards as GitHub features. Limit any proposed runner change to an authorized pool or group, with an owner and a clear restoration condition.
Investigate intermittent tests without declaring a false repair
In Azure Test Analytics, open the top failing tests report from the build summary Analytics page or the release's Analytics entry. The detailed report includes outcome distribution and failing-test information. Group by test file when useful, select an individual test, inspect its outcome history and execution instances, then open failure details for selected instances. This moves the investigation from a recurring name to concrete attempts and context.
A concentration of failures in one period suggests a temporal dependency to investigate. Alternating outcomes suggest possible nondeterministic behavior, but source changes, data changes and environment differences must be considered. Distinguish an intermittent product defect from a defective test or unstable execution environment. The same symptom can require different owners and repairs.
Compare failed and passed instances using the available evidence: revision, relevant inputs, test data assumptions, execution order and environment. Mark unknowns rather than inventing equivalence between attempts. A failure followed by a green retry establishes only that the observed outcomes differ. It does not show that the underlying condition is understood or removed.
Do not improve the chart by suppressing publication, ignoring failures or removing a problematic test without an explicit quality decision. If an owner authorizes temporary isolation, document its scope, risk, expiry and restoration condition separately from repair status. Preserve the original failure evidence and keep the loss of coverage visible to reviewers. A diagnostic workaround and a verified correction should have different completion criteria.
Verify one bounded intervention
Write a falsifiable hypothesis before changing anything. For a proposed agent-routing repair, the hypothesis might be that an unnecessary demand excludes the intended capable pool. For a suspected test-data problem, it might be that shared mutable input produces conflicting outcomes. These are illustrative hypotheses, not findings from an executed investigation.
Use this sequence with the responsible owner:
- Record the original symptom, affected population and evidence references. State what observation would disprove the proposed cause.
- Choose one change supported by that evidence. Capture the previous configuration and agree a narrow restoration path before modifying shared execution settings.
- Validate in an authorized bounded environment. Preserve test coverage, required failure enforcement and credential boundaries; extra concurrent jobs can consume capacity and incur cost.
- Observe a comparable branch, workload and period. Record changes in sample size, runner image, task versions or test selection that prevent a fair comparison.
- Inspect original outcomes as well as retries, successful-run duration, waiting and published-result completeness. Verify that improvement in one dimension did not hide deterioration in another.
- Accept, revise or restore the intervention according to the recorded evidence. If the suspected cause remains unproven, retain that uncertainty and the next discriminating check.
For example, reducing a routing wait would not by itself establish faster task execution, and speeding one task would not establish a lower failure rate. Likewise, a quiet period with fewer test executions cannot establish a reliable flake repair. Choose an observation window appropriate to the recurrence pattern and report the actual evidence limitations instead of promising a universal number of reruns or a guaranteed saving.
The investigation is complete when the owner can connect a specific symptom to supporting run or test evidence, explain the selected intervention, and show what changed under comparable conditions. Keep that reasoning alongside the retained evidence. Broader metric contracts and retention policy remain separate concerns, addressed by the related articles rather than silently redefined during incident diagnosis.
Authoritative Sources
- Pipeline reports — Azure Pipelines — Analytics navigation, filters, failure drill-down and successful-completion duration scope.
- Test Analytics — Azure Pipelines — Published-result lineage, individual test instances and temporal failure patterns.
- Azure Pipelines agents — Parallel-job limits, capabilities, matching and hosted/self-hosted execution conditions.
- Self-hosted runners reference — GitHub Actions — Runner requirements and label/group routing conditions.
- Workflow syntax for GitHub Actions — Job dependencies, runner selection and matrix execution controls.
- Key Azure Pipelines concepts — Stage, job, step and agent boundaries.

