Skip to content

[Experiment] Add CI Quality Investigator workflow - #55467

Merged
nagilson merged 112 commits into
dotnet:mainfrom
nagilson:nagilson/ci-quality-monitor-live-evaluation
Aug 14, 2026
Merged

nagilson merged 112 commits into
dotnet:mainfrom
nagilson:nagilson/ci-quality-monitor-live-evaluation

Conversation

@nagilson

@nagilson nagilson commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

CI Quality Investigator

Summary

An agentic workflow that investigates CI 'evidence' and files actionable build, test, and infrastructure issues with a root cause analysis.

This completes an 'agentic engineering loop' between the already added triager and assigner.

Stages

Currently Implemented

  • Audit main CI; main is the only branch rerunning flows every time a merge commit occurs; release/* branches only have checks run on the dev's branch, which means the mechanism to auto-trigger the workflow is not as straightforward to author
  • When run manually, audit a specific build ID from a target repo, based on a config file

Detects:

  • Corrupt yml / fails to run
  • Flakey tests
  • Network issues
  • Helix crashes or work item crashes
  • Build errors
  • Job failures outside of build, such as signing, restore, network, and other errors

Future Potential Expansions

  • Audit release/* branch CI problems in addition to main
  • Audit codeflow PRs and consider whether we should also file issues for those or not to simplify domestic cat duty.
  • Audit local dev PR runs for flakey tests on a schedule and file issues for test flakes that indicate impact across several dev branches
  • File known build errors using the KBE Template Automatically
  • Coordinate with binlog analysis / build analysis skill to read binlogs for further RCA evidence

Tests

Tests were executed by invoking the workflow directly and pointing it to specific builds to validate behavior rather than trying to get main to include a specific failure to evaluate.

Some builds are expired but the failure artifacts generated by the analyzer got picked by up, so the failure were saved. Root cause analysis logic remains tested. Due to the short lifetime of CI runs and that many of the build failure were fixed, most of the recent validation re-runs used existing 'evidence' collected by the agent.

To see a new failing scenario in main the workflow found on its own that is still live in CI right now, see 162

Scenario Build Taxonomy Evidence Run Retained evidence (look at prompt.txt) Result
YAML validation (#155) 1521345 pipeline-validation / configuration-error Azure validation 31738316645 source run 30147087520 Pass
Checkout (#156) 1523420 source-checkout / source-unavailable Azure timeline 31738679378 source run 30293483832 Pass
NuGet feed (#157) 1523525 dependency-restore / network-failure Azure timeline and task log 31739079468 source run 30294832494 Pass
Compiler (#158) 1525235 compilation / compiler-error Azure timeline and task log 31739542089 source run 30295583961 Pass
Signing (#159) 1522972 signing / tool-execution-error Azure timeline and task log 31740195069 source run 30296262335 Pass
Multiple tests (#160) 1525292 test-execution / network-failure Helix TRX 31740739225 source run 30299485941 Pass
Hang/watchdog (#161) 1524763 test-execution / timeout Helix console, process exit code, TRX, and dumps 31741256405 source run 30302460317 Pass
Novel publish-copy file lock (#162, closed validation artifact) 1550820 compilation / build-task-error Azure timeline and task log 31753837935 Live Azure/Helix collection Pass

How it Works

[DESIGN.md] and [README.md] elaborate more. But briefly, it uses deterministic web requests that do not require authentication to collect 'evidence' - e.g. logs, pipeline results, trx results, test failures/results, helix work item records, etc. The logic runs whenever there is a failure that is detected in main CI. Evidence per run is recorded as a pipeline artifact that can inform other agents in the next CI investigation workflow and be used to analyze future flakes without needing to spend time re-analyzing what was already analyzed.

The deterministic javascript parses those as 'evidence' to the agent which is then given a prompt to analyze with a RCA. It does not duplicate the existing ci-analysis skill.

The agentic workflow itself then runs with safe_outputs to file the issue, if there is not already such an issue with a similar 'fingerprint' - otherwise we can skip and not waste AI token spend on something we already analyzed. Builds are not re-analyzed because the workflow is currently only triggered off a main CI run, and only looks at that run. To add later stages more work will be needed to reduce waste.

Logic could be simplified with maintenance and handling logic for an AzDo internal token, however, this adds complexity and on-going cost (weekly or daily PAT renewal for the workflow to continue passing + more security needed), and in my belief should be added later.

Expected Impact

  • Reduce engineering time spent discovering and investigating CI failures.
  • Reduce the time required to detect a CI failure.
  • Reduce the time/SLA from failure detection to a proposed fix.
  • Reduce the operational burden, compute cost, and elapsed time consumed by
    broken or repeatedly retried CI.
  • Accelerate development by reducing the time that CI failures block PR merges - a copilot PR can run checks which immediately tells a working engineer who sees the PR whether the fix passed or not (note that this is not a guarantee the fix is correct but provides a better starting point even if the fix is incorrect.)
  • Reduce accumulated build, test, and infrastructure technical debt.

Success Criteria

  1. The workflow does not overwhelm repository contributors with duplicate,
    speculative, or low-quality issues.
  2. Every filed issue includes a reasonable root cause analysis and empirical,
    verifiable build evidence with links to the relevant build, task, test,
    console output, or artifact.
  3. The workflow does not file an issue when no actionable failure exists, when
    the signal is only a downstream cascade, or when an existing issue already
    covers the same mechanism.
  4. Automatic delivery does not spend AI tokens re-analyzing an audit context
    that has already been processed. A retry or trusted priority promotion is
    audited only under the context-qualified rules below.
  5. PR analysis does not spend tokens or file repository-wide findings for failures
    caused only by the PR's own changes.
  6. Every issue filed by production monitoring receives the fixed cookie label and enters the Issue Monster queue automatically. Stable live incidents and technical or infrastructure debt may also receive their corresponding allowlisted labels.
  7. Test flakes are filed only as validated Known Build Errors. A KBE match must
    not hide or permit unrelated failures in the same CI run.
  8. The investigator detects pipeline YAML rejection, including failures that
    occur before any job or timeline record exists.
  9. The investigator detects Helix work-item hangs and crashes and distinguishes
    them from test assertion failures or post-test harness failures.
  10. Added token spend is feasibly under the budget of net savings from the workflow.
  11. The investigator detects named test failures and preserves enough evidence
    to distinguish independent test mechanisms.
  12. Event-driven paths begin investigation when CI completes unsuccessfully,
    without waiting for a maintainer to notice or request an investigation.
  13. The workflow has potential to be broadly applied at an organizational level to scale reduced costs & SLA impact.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 32 out of 34 changed files in this pull request and generated no new comments.

Suppressed comments (11)

.github/ci-quality-monitor/collect-ci-evidence.mjs:84

  • The full dossier is promoted to a job output, but its configured bounds can exceed GitHub Actions' 1 MB-per-job output limit: one Helix item can contribute 20 failures with an 80,000-character KBE diagnostic, and up to 20 items are collected. On a sufficiently noisy failure, needs.collect.outputs.dossier will be truncated/rejected and the investigator will never run. Add a global serialized-size bound or transfer the dossier as an artifact while keeping only small control values in job outputs.
  await appendFile(outputPath, `dossier<<${delimiter}\n${compactDossier}\n${delimiter}\n`);

.github/ci-quality-monitor/issue-deduplication.mjs:33

  • Tracked fingerprints are removed only from build failures. An actionable heartbeat remains in pipelineHealth, so shouldRunAgent() activates the model again on every daily miss even after an issue containing that heartbeat fingerprint has been filed. Filter tracked pipeline-health observations too, otherwise a prolonged outage repeatedly spends tokens contrary to the deduplication policy.
export function suppressTrackedIssueCandidates(dossier, trackedFingerprints) {
  for (const failure of dossier.failures) {
    failure.issueCandidates = (failure.issueCandidates ?? [])
      .filter(candidate => !trackedFingerprints.has(candidate.fingerprint));

.github/ci-quality-monitor/helix/client.mjs:115

  • Returning immediately when any TRX failure exists drops independent work-item evidence. A Helix item can contain a failed assertion and then hang or crash during teardown; in that case the timeout/crash observation is never produced, so a KBE can hide an unrelated mechanism in the same run. Preserve the test observations, then independently emit a work-item observation when the console/exit evidence establishes a distinct post-test failure.
    if (testResults.failures.length > 0) {
      return testResults.failures.map(test => createTestObservation(reference, test, testResults.summary));

.github/ci-quality-monitor/helix/client.mjs:41

  • The TRX outcome is ignored when classifying a named failure. parse-test-results.py deliberately includes Timeout and Aborted results, but an empty or generic timeout message reaches this call and is labeled test-assertion, producing the wrong fingerprint and RCA. Pass test.outcome into the classifier and prioritize explicit timeout/aborted outcomes before message heuristics.
  const failureType = classifyTestFailureType(test.errorMessage);

.github/ci-quality-monitor/azure/observations.mjs:24

  • The generic checkout match runs before the authentication and network checks, so a checkout task reporting 401 Unauthorized or 503 Service Unavailable is always mislabeled source-unavailable. That collapses the independent failure-type axis and can route/deduplicate the incident incorrectly. Apply the specific auth/network classifications before the checkout fallback; inferTaskPhase() already preserves source-checkout as the phase.
  if (/checkout|couldn't find remote ref|repository not found/i.test(text)) {
    return { phase: "source-checkout", failureType: "source-unavailable", diagnosticCode };

.github/ci-quality-monitor/collector-policy.mjs:9

  • A build queued after the commit is treated as coverage regardless of its reason or source version. Consequently, manually queuing an older main commit after the current head landed suppresses the heartbeat and hides a missing CI trigger. Limit the queue-time batching fallback to CI-triggered builds; exact sourceVersion === head.sha can continue to cover other reasons.
  const covered = builds.some(build => build.sourceVersion === head.sha || Date.parse(build.queueTime) >= committedAt);

.github/ci-quality-monitor/helix/client.mjs:91

  • This selects whichever .xml or .trx entry happens to appear first. If a work item lists an unrelated XML artifact before its TRX, the TRX parser returns no named failures (or throws) and the actual test evidence is skipped. Prefer .trx explicitly, using .xml only as a fallback.
    const testFile = (workItem.Files ?? []).find(file => /\.(?:trx|xml)$/i.test(file.FileName));

.github/ci-quality-monitor/pipeline-health-monitor.mjs:24

  • A failed heartbeat retrieval leaves the prior heartbeatMisses count intact. Thus miss → API failure → miss becomes actionable even though the two misses were not consecutive daily checks as required. Reset the tracked heartbeat on evidence-collection failure before returning the non-actionable observation.
    } catch (error) {
      return {

.github/ci-quality-monitor/pipelines.json:30

  • The PR description limits the implemented stage to main and lists release-branch auditing as future work, but every release/* entry here is accepted by selectEventCandidate() for merged-PR investigation. This enables automatic release-branch incidents now. Keep only main in stableBranches until that expansion is intended and documented.
        "refs/heads/release/dnup",

.github/ci-quality-monitor/README.md:9

  • The credential description contradicts the workflow: lines 159–178 of ci-quality-monitor.md select COPILOT_GITHUB_TOKEN from COPILOT_PAT_0…9 in the copilot-pat-pool environment. This workflow therefore depends on PAT secrets for inference, not solely on the GitHub Actions token; document that operational prerequisite while retaining the credential-free Azure evidence boundary.
service hook or credential. The workflow uses the GitHub Actions token for Copilot
inference through the scoped `copilot-requests: write` permission and keeps all

.github/ci-quality-monitor/README.md:88

  • This failure-model section is incomplete: the three axis names and bullets are missing, and “them” has no antecedent. As written, readers cannot map the listed examples to phase, failureType, and evidenceSources, despite those distinctions driving issue policy.
The collector models each observation on independent axes:

  `source-checkout`, `dependency-restore`, `compilation`, `signing`, or
  `test-execution`
  `process-crash`

@nagilson
nagilson marked this pull request as ready for review August 13, 2026 21:55
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@nagilson
nagilson requested a review from baronfel August 14, 2026 00:16
Comment thread .github/workflows/ci-quality-monitor.md Resolved
@nagilson

nagilson commented Aug 14, 2026 •

Copy link
Copy Markdown
Member Author

I reconfirmed the analysis works and also tested the scenario where a build failure regresses, such that the issue is re-filed if it was closed previously: nagilson#163. Thanks for your review!

@nagilson

Copy link
Copy Markdown
Member Author

Confirmed it's still working e2e, with an example here: nagilson#168

@nagilson

Copy link
Copy Markdown
Member Author

Thank you 🥳

@nagilson
nagilson merged commit d6e2be3 into dotnet:main Aug 14, 2026
22 of 25 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Aug 15, 2026

This branch had an error being deployed

1 failed deployment
copilot-pat-pool — c420cd40 Deployed Aug 14, 2026 by nagilson via pre_activation #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants