Agents are confident. They finish a task and tell you it works, in good prose, with a summary. The pipeline is not impressed by prose. It runs the build, runs the tests, runs the scanners, and reports red or green without caring who wrote the code. In an agentic team the pipeline stops being plumbing and becomes the thing that makes the whole approach safe. This part describes ours.
Two lanes on every pull request
A pull request on open ordering triggers two pipelines at once, on two kinds of build agent.
The build-and-test lane runs on Windows, because the platform is .NET Framework. It restores packages from our Azure Artifacts feed, builds the applications, builds the database project into a dacpac, and runs the unit tests with code coverage. Nothing exotic, but the build is warning-clean and Roslyn analyzers are on, so a new warning is a failure.
The quality lane runs on Linux and has four steps. First, a track validation. Every ticket starts with a declared track, trivial, small or delivery run, and the pipeline checks that declaration against what the diff actually touches. A change that hits a hard trigger, a database change, security-relevant code, a public contract, cannot pass as "small". A delivery run without a run manifest created at the start fails, and a manifest written after the fact is marked as retrofitted and does not count. Second, an LLM code review: OpenAI Codex runs headless on the build agent against the pull request with our review conventions. It is deliberately a different model from the one that writes the code. A reviewer that shares the author's training shares the author's blind spots, so the second opinion comes from a second provider. It reads the diff and posts its findings as a comment on the pull request under the heading "LLM Code Review". Third, Trivy scans dependencies and images for known vulnerabilities and secrets and posts a summary. Fourth, Semgrep runs static analysis with the C# and OWASP Top Ten rule sets and posts a warning comment if it finds anything.
Both lanes have to be green, and a person has to review and approve, before anything merges.
Why a big diff gets no AI review
There is a guard in the review step: if the diff is above four thousand lines, the agent does not run. Instead the pipeline posts a comment asking for a manual review. The original reason was cost. A review of that size burns a lot of tokens for a result nobody will read. But the guard turned out to be a useful signal in its own right. A pull request that trips it is too big. Our refactoring skill works in steps of three hundred lines or less for the same reason, and a change that cannot be reviewed by a tireless reader in one sitting will not be reviewed well by a tired human either.
After the merge
The main pipeline runs on merges to the main and release branches. It is about fifteen hundred lines of YAML, which tells you something about how much a twenty-year-old platform needs to do to ship. In order:
- Build. Restore, build the applications and the database, transform configuration, publish artefacts for the web sites, the database and the search index.
- Images. Windows container images for the database, the application, external services and the job manager, and a Linux image for Solr, pushed to our registry.
- Deploy to the integration environment. HashiCorp Nomad jobs for the Windows and Linux parts, with health checks.
- Test stage. Deploy, health check, warm up, then an OWASP ZAP baseline scan against the running application. Microsoft Teams is told when it starts and how it ended.
- Sandbox stages. Deploy, run SonarQube analysis and the quality gate, run ZAP again, and trigger the separate automation-test pipeline.
Deployment to customer environments is a separate, human-triggered step with its own release checklist. The pipeline gets the code to the point where a person can decide to ship it.
The quality gate order
Separate from the pipeline stages, our Definition of Done lists the gates a change must pass, in order, and the order matters. We learned that the hard way: an architecture decision record exists specifically about a case where gates were run out of order and something slipped through that an earlier gate would have caught.
- Pre-flight. The spec is frozen, the plan exists, the track is classified.
- Build. Warning-clean, analyzers on, complexity budget respected.
- Tests. Seventy percent or more coverage on new code, a negative-path test for every happy path, contract tests derived from the Gherkin scenarios.
- Static analysis. SonarQube: zero new critical issues, zero open security hotspots, duplication at three percent or less.
- Dependencies. Zero new high or critical findings from the scanners.
- Architecture spot-check. Boundaries respected, nothing instantiating services in business logic.
- Contracts. OpenAPI linted, events versioned, backwards compatible.
- Migration safety. Database changes checked before they ship.
- Human gate. Peer review and product-owner acceptance.
Overriding any gate requires an architecture decision record that names the reason and the person. On veenion one the cross-tenant isolation probe cannot be overridden at all.
The complexity budget
The gate that changed our code the most is the least glamorous. SonarQube enforces a complexity budget: cognitive complexity of fifteen or less per method, cyclomatic complexity of ten or less, methods of fifty lines or less, files of four hundred lines or less, five parameters or fewer, nesting three deep at most, duplication at three percent or less.
On a legacy codebase that budget is aspirational for existing code and binding for new code. Going over it is possible, but it needs a written decision record explaining why. There are about twenty of those exception records in the open ordering repository, and each one is a place where a future refactoring is already justified.
The budget also closed the suppression loophole described in part two. A suppression comment without a justification fails review. Agents stopped reaching for it once it stopped working.
Watching the agents
One more piece of infrastructure deserves a mention. Claude Code sessions emit telemetry over OpenTelemetry, and we send it to Langfuse, hosted in the EU, to understand cost, duration and failure patterns per skill and per role. Prompt contents are not logged. Turning that on is itself the subject of a decision record, gated on a data processing agreement and sign-off from our data protection officer. We work in public procurement. We would rather have less data than the wrong data.
What the pipeline taught us
The lesson of this whole series fits in one sentence from our own rules: tools are the truth. An agent's claim that a change is correct is worth exactly as much as a colleague's claim, which is to say it is a good reason to run the pipeline. The pipeline does not read summaries. That is why we trust it, and that is why an agentic team needs a better one than a conventional team does, not a worse one.
Next in the series: how do you know any of this works? Part six is about the belt-grade assessment we run on ourselves every quarter, and the one rule that makes it bite.