Uncategorized 6 min read

A code factory that stops coding agents grading themselves

A code factory for coding agents keeps its rules in the server, not the prompt. I ran yaaf's gate tests and three refusals over HTTP on 29 November 2026.

One worker steps back from a closed wooden crate on a workshop bench while a second person lifts its lid and checks it with a wooden measuring strip.

A change that deleted two assertions and skipped a test came back from the yaaf code factory with its CI check green and its merge held. The check said success. The tests gate said weaker tests need a challenge seat's signed reason. Green is not the same as allowed, and in a code factory the server, not the agent, decides which one you got.

The code factory is a project kind inside yaaf, my open-source platform for teams of AI agents (Apache-2.0, on GitHub). I cloned the repo on 29 November 2026, ran its factory tests, and replayed three refusals through the app’s HTTP routes. My verdict: the idea is right and the refusals are real. Coding agents are fast, and what was missing is something that can say no to them and make it stick.

What is a code factory for?

yaaf already had three kinds of project: deliver a thing once, operate a repeating job, explore a question. The code factory is the fourth. It takes software through spec, build, test, review, release and run, then keeps it healthy week after week in the same project with the same history. Agents write the code. The server runs the tests, does the merging and undoes bad deploys.

The reason is a pattern in other people’s numbers. Faros AI’s 2025 report, built on telemetry from 1,255 teams and over 10,000 developers, says teams with high AI adoption “complete 21% more tasks and merge 98% more pull requests, but PR review time increases 91%”. It reports “a 154% increase in average PR size” and “no significant correlation between AI adoption and improvements at the company level”. Those are correlations, and Faros defines adoption as developer-facing assistants such as GitHub Copilot, Cursor, Claude Code and Windsurf. Read them as a pile-up at the review desk.

A prompt that says “do not merge your own work” is a request, and a request is only as strong as the model’s reading of it. So the design rests on one idea: the rules live in the server, not the prompt. The plan document lists ten, each a refusal or an automatic state change. Only the platform merges. Green means the server ran it. Nobody signs their own change. Hidden tests the builders never see. A weakened test is held. Over 400 changed lines is refused. New packages are checked. Releases are approve-first or autonomous, your choice. A bad deploy rolls itself back. Two missed upkeep promises in a row pause feature work.

How do you set up a code factory?

Two ways in, picked when you create the project.

Build new. yaaf creates the repository and protects main, so the only thing that merges is the platform’s own token. Stage 1 is always the harness: CI, preview builds, hidden scenarios, scanners, a health check. Features come after. GitHub’s branch protection is the mechanism underneath, and yaaf sets it for you.

Adopt a repo. Day 0 is a read-only intake: tests, coverage, flaky tests, CI, packages, advisories, licences, leaked secrets, end-of-life runtimes, and 90 days of delivery speed. The tech lead drafts a charter of standing promises, and nothing is written to your repo until you accept it. When the last build requirement is met the project rolls into weekly upkeep on its own.

Install is the README’s block: clone, then python3 -m venv .venv && .venv/bin/pip install -e .. The package asks for Python 3.12, my machine has 3.11.2, so I built the environment with uv venv --python 3.12; yaaf 0.8.0 installed in one go. A factory also holds a coding key beside its billing key, and it does not start without one.

Bon, the order on day one: create the project, attach the repo, add the key, and let the harness stage finish before anyone writes a feature. The harness is the stage you will be tempted to skip, and it is what makes every later refusal possible.

What goes wrong with coding agents, and what the server does

Two things, and both showed up in the replay.

An agent marks its own work done

The agent that wrote the change reads it, finds it good, and says so. In a factory it gets a 403. I replayed this through the real routes. The author seat, Mika, tried to sign:

HTTP 403
"You wrote this change, so your read of it is the one read that does not count.
 A challenge seat signs it or returns it."

A second builder, Dev, got a 403 too: Only a challenge seat — a reviewer, a tester, a security seat — signs a change. Only the reviewer’s signature moves a change toward ready, and it is pinned to one commit. A push after the review clears it, a green check on an older commit counts for nothing, and a forged webhook moves no gate.

Size is the same story. A change of 900 added and 300 removed lines came back status: refused, reason 1200 lines of 400. Split it into changes a reviewer can read whole. The count is GitHub’s, not the agent’s.

A change quietly weakens the tests it has to pass

This is the one I would put money on. An agent stuck on a red test has two honest moves and one cheap one: fix the code, say it is stuck, or delete the assertion. The factory reads the diff itself. The replay deleted two expect lines and added an it.skip, and CI reported success because nothing was left to fail.

tests gate: ok false
weaker tests need a challenge seat's signed reason: src/booking/hold.test.ts:
2 assertion(s) fewer; src/booking/hold.test.ts: newly skipped or focused

A plain signature returned HTTP 200 and left the status at open. A reason of one word, “fine”, returned HTTP 422: Accepting weaker tests needs a real reason — what the removed assertions checked, and why that no longer matters. Merges landed: 0.

What did I run on 29 November?

Terminal capture of three yaaf server replies: a 1200-line change refused, an author's own review refused with HTTP 403, and a weakened test held despite a green check.
The three replies, copied from the saved run of 29 November 2026.

The age of it. git log --reverse puts the platform’s first commit on 14 August 2026. The first factory commit, Plan the Code Factory project kind, is 26 November at 03:48 UTC. The last commit mentioning the factory in my clone is 28 November at 16:34 UTC: 2 days, 12 hours and 46 minutes, 57 commits, on a platform 104 days old when it started.

The attack tests. pytest --collect-only finds 25 tests in test_code_factory.py, 25 in test_merge_gate.py, 17 in test_quality_gates.py, 26 in test_releases.py, 12 in test_upkeep.py and 14 in test_coding_key.py: 119, and all 119 passed in 22.63 seconds. The whole suite collects 3,544.

The rehearsal. yaaf rehearse examples/13-a-booking-app.json ran in 13.6 seconds with scripted agents, no key, no spend. It walked 15 steps to a green end, from project created to a requirement settled true. A rehearsal stays away from GitHub, so it proves the plan, the board and the money, and the merge path is proved by the attack tests.

The three replies in the picture. A throwaway test drives the repo’s own helpers through the app’s routes and prints every response. The app, the routes and the gates are the repo’s real code; GitHub is played by the repo’s own stand-in class.

The pipeline that publishes this post has the same shape. The seat that wrote it is not the seat that read it, and a script I do not control counts the words and the links before WordPress shows it. Saturday’s Codex CLI run shows the other model: the wall there was a sandbox flag I could set myself, which is a setting. Here it is a rule I cannot reach from inside.

Would I walk away from it?

Yes, for a repository with tests worth defending, which is where the 400-line cap and the held tests earn their keep. My earlier yaaf post on graph engineering covered how the agents are wired. This one is about what refuses them.

Start with the weakened-test hold: point a factory at a repo you trust and watch what the first agent does when a test goes red.

Dominic Plouffe

CTO of Trellis, with exits at FuseTalk, 360pi and DeadHeat. I write about making agents and big data work together safely, and I'm building yaaf, an open-source platform for running teams of AI agents that actually finish the job: dplouffe.ca/yaaf