That loop is the quality half of the AI agent orchestration described in Shipping a SaaS product with a fleet of AI coding agents. The briefs and file ownership make parallel building possible; the waves are what stop parallel building from turning into parallel defects.
Why can’t builders grade their own work?
Builders cannot grade their own work because the same reasoning that produced the defect also decides whether it is a defect. An agent that made cleanup throw is not the agent most likely to notice that a test named “never throws over a good download” now expects rejection.
It is the same separation of duties that puts a different engineer on code review: the author’s context makes intended behaviour feel obvious. Independent agents arrive without it and read the app as a user would.
The failure modes repeat, which is what makes a separate wave worth the cost. In the runs behind this article, builders shipped tests rewritten to pass, fixtures hard-coded into shared code, UI calling an API route that did not exist, and one whole content family that was written, linked and 404ing. None of those were caught by the builders’ own tests.
What are the seven phases of an agent wave?
The pipeline moves from planning to verification in seven phases, and each phase has a different owner.
| Phase | Owner | Output | Gate to the next phase |
|---|---|---|---|
| 1. Plan | Orchestrator | Spec, shared rules, one brief per workstream | Every judgement call decided |
| 2. Build | Builder agents | Branches in worktrees | Agent done, commits present |
| 3. QA | Read-only auditors | Findings with repro steps and file references | Summary table reviewed |
| 4. Triage | Orchestrator | Finding IDs grouped into fix briefs | Every fix decided |
| 5. Fix | Fix agents | Branches with tests that fail without the fix | Merge and verify |
| 6. Re-QA | Fresh auditors | Same findings re-tested on the rebuilt app | Findings closed or re-opened |
| 7. Verify | Orchestrator | Typecheck, tests, build, browser check | Green on the integration branch |
The value is who owns each phase: builders never mark their own work done, auditors never edit code, and the orchestrator never delegates the final verification.
How do you brief a read-only QA agent?
A read-only QA agent gets one job: reproduce, document and rank defects against a build it did not write. It gets no write access to the repository and no permission to restart servers.
The QA brief that worked had six rules:
- Read-only. No repo edits, no server restarts, no production URLs. Screenshots and notes go to a scratch directory.
- One shared build. All auditors point at the same production build with mocked paid APIs and a local mail sink. Each auditor starting its own server is what crashed a laptop.
- Two widths, two themes. Playwright at 1440×900 and 390×844, light and dark. One viewport hides half the layout defects.
- Their own data. Each auditor creates its own test account and records, so findings are reproducible.
- A fixed report schema. Summary table, then findings with ID, severity, area, repro steps, expected versus actual, screenshot path and a suspected root cause with a file reference.
- Known complaints as seeds. Give each auditor the real user complaints for its area, so it reproduces and root-causes them instead of wandering.
A shared severity scale belongs in the brief. Whatever the labels, the team needs one meaning for a normal path being broken, a core flow being wrong, and polish; without that, every auditor invents a scale.
How does triage turn reports into fix briefs?
Triage reads only the summary tables first, decides every fix, then groups finding IDs into fix briefs partitioned by file ownership.
The orchestrator’s job is not to read every full report. It is to read the ranked summary, pick the findings that matter, decide the intended behaviour for each, and assign it to the agent that owns the file. The detailed report is the fix agent’s input, not the orchestrator’s.
Three rules make this work:
- One fix per finding, decided once. If two findings need the same change, they go in one brief. If one finding needs changes in two owners’ files, it becomes two briefs with a dependency.
- The brief wins over the report. Where the QA report’s suggested fix differs from the fix brief, the brief wins. The orchestrator made the judgement call; the auditor did not, and two agents implementing two reasonable fixes is how a merge acquires unspecified behaviour.
- Finding IDs are the contract. A fix brief names
SEC-03andUI-12, and the result file reports on those IDs. Nothing gets fixed “generally”.
Grouping by file ownership is the part that prevents merge conflicts. A fix brief that spans three owners’ paths is three briefs with a merge order, not one agent editing everything.
What goes into a fix brief?
A fix brief names the finding, owned files, the exact behaviour to implement, and the test that must fail without the fix. It is a small brief, usually under a page, because the QA report already carries the reproduction.
The shape:
GOAL: Fix the confirmed defects in the files you own. Do not redesign them.
FINDINGS: SEC-03, UI-12
YOU OWN: <files>
DEFECT: <what happens now, concretely>
FIX: <the behaviour the orchestrator decided>
TEST: must fail on the current code, pass after the fix
DO NOT: weaken or rewrite existing tests; edit files you do not own
OUTPUT: result file + AGENT DONE <name> <commit>
The test requirement is what stops a fix from being cosmetic. “Tests must fail without the fix” is checkable, and it blocks the most common shortcut, which is to change the assertion until it agrees with the broken behaviour.
Why re-QA in a fresh session?
Re-QA uses new agents, the same finding IDs and a rebuilt app, because the fix agents’ assurances are claims and the original auditors may have anchored on their first reproduction.
Fresh agents do not inherit the fix agent’s explanation of why something now works. They open the page, follow the reproduction and record what happens. That independence is the point: a fix that only passes in the fixer’s account is not fixed.
Re-QA also catches regressions the fixes introduced: a shared component changed for one finding can break a page nobody re-tested. Re-running the same findings is a cheap check on those surfaces.
How should merges be sequenced?
Merges go foundation first, one branch at a time, into an integration branch with --no-ff, with the test suite run after each merge.
The order is not cosmetic. If two branches both depend on a schema change, merging the dependents before the schema guarantees a broken integration branch and an unreadable conflict. Land the foundation, merge it to main, then branch dependents from the new main.
--no-ff keeps each workstream visible as a merge commit even when git could fast-forward, which makes a wave revertible as a unit. After each merge, run the tests yourself. An agent’s “all green” is a measurement of the agent’s branch, not of the integration branch.
Apply each agent’s “needs from others” items at merge time. Those are the small cross-file changes the agent was not allowed to make, and they are exactly the changes most likely to be forgotten if nobody owns the merge.
One big run versus waves
Both produce working code; they fail differently.
| Dimension | One big run | Build, QA, fix, re-QA waves |
|---|---|---|
| Defect discovery | Builder’s own tests, which share its assumptions | Independent auditors with repro steps |
| Merge risk | Many branches landing at once | Foundation first, one merge at a time |
| Context cost | One enormous session | Small briefs and summary tables |
| First signal | At the end | After the build wave |
| Rollback | Revert a large change | Revert one workstream merge |
| Human attention | Absorbed by the diff | Spent on triage and verification |
| Failure mode | Confident green report | A longer pipeline with clear gates |
Which should you choose?
Use waves for anything that spans more than one app area, more than one agent, or any money, auth or tenant path. A single-file fix with one owner does not need a QA fleet; a contract change plus a UI change plus a migration always does. The test is whether a defect could hide in a place the builder was not looking.
What broke and what we changed
A hand-resolved merge conflict dropped a security flag. Resolving a conflict in a settings registry by hand removed a secret: true field. The syntax error took down most of the web test suites in the next verify run. The fix was a rule: after any hand-resolved conflict, run the build, not just the tests.
A CSS conflict was resolved by deleting the markers and two closing braces. Every test passed and the page did not render. Only opening it in a browser caught it. UI changes now get a browser check at desktop and phone width before the wave is called done.
A builder rewrote the test instead of the code. It made cleanup throw, then changed a test named “never throws over a good download” to expect rejection. Review now greps the test diff for changed assertions, and the common rules forbid weakening a test.
A hardcoded page count broke every merge. Tests asserted “exactly 14 pages” while 12 writers added pages in parallel, so each merge failed. The fix was floors, not equalities: assert at least the pages that must exist, not an exact total.
A content family shipped with no route. Pages were written and linked, but nobody built the route, so every URL returned 404. Typecheck and unit tests passed. The fix was a test that resolves every content id and slug, plus a grep of content directories against the app’s routes.
The QA fleet outgrew the laptop. Seven parallel browser agents plus a local dev server crashed a 16 GB machine. The fleet was capped at four or five agents on a laptop, with browser concurrency limited and heavy verification moved to a Linux box.
An agent edited a file outside its ownership. It changed the Next config for a good reason, which still required review. Another agent reported eight test failures as “probably unrelated”; running the suite on the base commit showed they were test-database contention, not regressions. Compare against the base before believing or dismissing a failure count.
Related
- Shipping a SaaS product with a fleet of AI coding agents — the pillar post for this cluster.
- Agents report success while shipping defects — the failure modes a QA wave exists to catch.
- Writing briefs that AI coding agents can’t misread — the fix-brief format in full.
- Quota gates and stall detection for long agent runs — keeping a multi-wave run alive.
- Mass agent orchestration case study — the systems these waves shipped.
Frequently asked questions
What is a QA wave in an agent workflow?
A QA wave is a set of read-only agents that audit a build the builders did not review, each covering one app area against a shared running build. They produce ranked findings with reproduction steps, which the orchestrator triages into fix briefs for a later wave.
Why use separate agents for QA instead of asking the builders?
Because the builder's context is the reason the defect exists. A separate agent reads the code and the running app without the author's assumptions, and it can report a problem without defending its own work. Independent audits found 49 issues after every builder had reported success.
How many QA agents should audit one build?
One per app area is a practical default; typical areas are auth, billing, the core workflow, settings, reporting and the public pages. More agents than areas adds duplicate findings, not coverage. Cap browser concurrency; each auditor with a browser costs real memory.
What is a fix brief?
A fix brief is a small work order for one owner that names the finding IDs, the files owned, the defect, the decided behaviour and the test that must fail without the fix. It is deliberately narrow, because the QA report already contains the reproduction.
Do you re-run the whole test suite or only the fixed findings?
Both. Re-QA re-tests the same findings on the rebuilt app, and the orchestrator runs the full suite, typecheck and build on the integration branch. The findings check that the fixes work; the suite checks that the fixes did not break something else.
