
Most "AI in DevOps" demos end with the AI pushing a fix. I wanted the opposite: an AI that diagnoses a broken pipeline and then stops, so a human stays in charge. Here's how I built that for my Azure DevOps pipelines in the DevOps Micro Internship (DMI) with Agentic AI, and how I broke a pipeline on purpose to test it.
The setup
My EpicBook project has two pipelines:
- an Infrastructure pipeline (Terraform on Azure), and
- an Application pipeline (Ansible deploying Node.js, Nginx and MySQL).
The triage workflow follows four steps: Gather → Analyze → Human Act → Verify.
- Gather. A read-only Bash script asks Azure DevOps for the latest run of each pipeline, downloads the console logs through the Build Logs API (GET requests only) and classifies any failure into categories: agent/queue, dependency install, build, test, auth/SSH, Terraform, Ansible/Nginx. If nothing matches, it reports "Unclassified Pipeline Failure" rather than guessing.
- Analyze. Claude Code runs a
/pipeline-triageskill that executes the script, reads the report and explains the likely cause, with quoted evidence. - Human Act. Claude recommends one fix. I apply it myself.
- Verify. I run the triage again to confirm recovery.
Guardrails that don't depend on good behaviour
Telling an AI "please don't change anything" isn't a control. These are:
-
disable-model-invocation: true, so only I can start the skill by typing/pipeline-triage. - A narrow
allowed-toolslist: one approved command and read access to the reports. - Deny rules in
.claude/settings.jsonfor editing,git, the cloud CLI, Terraform, Ansible and anything that could change a pipeline. - A sanitizer in the script that replaces any log line that looks like a credential, token or private key with a redaction notice before it reaches a report.
- Exit codes that automation can trust: 0 healthy, 1 warning, 2 pipeline failure, 3 triage error. A broken sign-in is never reported as "healthy".
The drill (and a design flaw I almost missed)
The assignment's drill adds an invalid dependency to package.json. In my pipeline, though, npm ci only ran on the production VM during deployment. The "safe" failure would have happened during a real deploy.
So before breaking anything, I added a dependency-install step to the Validate stage and made Deploy run only on main. Then I created a temporary branch, added not-a-real-package-xyz and queued the pipeline manually.
It failed in Validate and Deploy was skipped, so production was never touched. The triage report came back with:
- Overall status FAILED, exit code 2
- Failed step: Install Node dependencies
- Category: Dependency installation
- Evidence:
npm ERR! 404 'not-a-real-package-xyz@1.0.0' is not in this registry
Claude's analysis matched: one cause, one recommendation, one verification step, no edits and no reruns.
The fix, and the second triage
I reverted the drill commit myself, pushed, re-queued the pipeline and got a green run. Then I ran /pipeline-triage again: HEALTHY, exit code 0. That second run matters, because "the pipeline is green" and "the triage tooling agrees" are two separate pieces of evidence.
What I learned
- Evidence beats guessing. Reports that quote sanitized log lines are far more useful than "something failed".
- Fail closed. A queued run, an expired sign-in or an unreachable API is a warning or an error, never a quiet pass.
- Test where the failure lands. A drill is only safe if you know which stage it hits.
- My own tooling had bugs too. My first real run reported warnings because my parser assumed the Azure CLI's text layout. Switching to JSON made it independent of the CLI's output format.
- A note on honesty: the supplied resource files weren't available to me, so I built the script and skill to the assignment's specification with AI help and tested them against simulated pipeline responses before using them on real pipelines.
The part I like most is that the AI makes me faster without taking away my responsibility. It finds the problem, and I own the fix.
P.S. This post is part of the DevOps Micro Internship (DMI) with Agentic AI, Cohort 3, by Pravin Mishra. Start your DevOps journey: https://dmi.pravinmishra.com/?utm_source=student&utm_medium=ps-blog&utm_campaign=cohort3
