I had two AI coding agents build the same feature. One studied the regression tests before designing or coding anything. The other had the same tests and ran them, but wasn’t asked to read them first.
The first agent never failed a single one of those regression tests. The second broke 11 regression tests and had to go back and fix.
Two parallel coding runs, designed to show the difference between two ways of working.
Run only. The agent ran the regression tests before every commit, but wasn’t asked to read them.
Rails. The agent was told to study specific regression tests and use them while designing and coding.
What was odd was that a blind comparison preferred the run-only agent’s code. Wasn’t expecting that!
Here’s what happened, and what I think really helps.
This follows on from Your Regression Tests Just Got a New Job.
The set-up
Four separate changes to a code base. A mixture of bug fixes and enhancements.
Each built twice in parallel from the same starting point. Three bug fixes, one of which deliberately changed behaviour, and a feature enhancement.
One build follows my normal process. The other is given a set of existing regression tests, picked by a separate agent. It’s told to use these tests as its rails, for both design and coding.

Four changes, one run each. So this is a signal, not proof.
The early bug fix runs were small. The rails showed no benefit on two of the runs. On the third the normal build came out ahead. It turned out those first three changes didn’t threaten anything that already worked. So the rails had nothing to protect.
So for the fourth run I picked a change that threatened what already works.
I also changed the comparison. For this run, both builds got the tests. Only one of them was asked to use the regression tests to shape its design and coding.
The feature enhancement
The feature enhancement I picked touched several routes through shared code. Plenty to break.
A separate agent picked 58 existing regression tests (to act as the design and coding rails) that the change had to keep passing. Both builds got all 58, and both had to pass them before every commit.
The difference was nine tests. The rails build was told to study those nine before designing anything. The other build only ran them.

Reading prevented the breaks
The rails build wrote down what each of the nine tests pins before writing any code.
It read the test case (human readable tests) for the rule. It read the test script (test automation code) for the exact check.
Some of its design came straight from the script. One test checked that a file was left untouched. So the agent decided the code must not rewrite that file at all on that route, even with identical content.

So that was one test holding a rule nobody had written in the requirements. Only the test knew it.
That was deliberate. Before the run, the agent picking the tests found four rules like this that the tests pinned and the requirements didn’t state. I left them out of the requirements on purpose, to see whether reading the tests would find them. That’s why we have regression tests. They catch the effects of a change you didn’t expect.
The result was that the rails build never had a failing test run on committed code.
Running caught them, an hour later
For the run-only build, its first test run failed 12 of the 58.
One was a test I’d broken myself while setting up. The other 11 were real breaks of existing behaviour.
The agent fixed all 11 by running the tests and working through the failures. It took about an hour.

The 11 breaks lined up almost one for one with the rails build’s design notes.
Running the tests caught the breaks. Reading them prevented them.
Hand over the regression tests
Some teams hide tests from the AI that writes their code. They keep a set back and run them at the end.
The worry is that if the AI can see the tests, it’ll write code that just passes the tests.
The analogy I work with here is building houses.
Think about building an extension. You give the builder the building regulations before they draw the plans.
You don’t hide the regulations so the inspector can catch them out at the end. Nobody would see that as a productive way of working. You’d just end up paying to have the work re-done.

Regression tests are your building regulations. They’re the rules the new work has to respect.
Let’s say your AI agent codes just to pass tests, and doesn’t focus fully on architecture, features and good implementation. Do you think taking the tests away is really the solution? The fix is better workflow, better design process, better implementation practices.
Hiding the tests is just covering up aspects of your process that are poor in the first place.
Handing over the regression tests and perfecting your process takes your coding agent to the next level.
Nothing was hidden from the run-only build. It had all 58 tests and ran them before every commit.
It still broke 11 things, because it designed first and checked later. That’s a builder with the regulations in the van, who only looks at them when the inspector turns up.
So having the tests isn’t enough. Give your agent the tests, and make it read them before it designs.
The inspector still comes at the end. More on that below.
The unexpected twist
Both builds went through three rounds of independent code review, then a full regression run of every test in the project.
Then a blind comparison built both versions and threw awkward inputs at each one.
That blind comparison agent preferred the run-only build’s code.
Each build had three defects. All six needed unusual inputs to show up.
The rails build’s were worse. In those unusual cases, it could change the user’s files while reporting success. The run-only build’s defects were milder and never touched the user’s config.
The margin was small, and it was all in edge cases.
None of the six was something an existing test covered. They were gaps in the new behaviour, or changes nobody had a test for. Issues that only the experience of building everything was going to throw up.
The regression tests tell your agent what not to break. They can’t tell it what the new behaviour should do.
Those are two different questions. Reading the tests helped with the first. It couldn’t help with the second.
You can’t pre-empt everything up front. There are new tests the change needs. There are regression tests it must keep passing. And there are tests you couldn’t have thought of until you’d seen the design and the code.
What still got through
Six review rounds across the two builds found no regression that an existing test covered. Almost every finding was a gap in the new behaviour, or a defect introduced by the previous round’s fix.
The full regression run did find two failures. One in each build.
Both were in tests nobody had picked at the start.
The run-only build’s was a check on the user guide’s wording, tripped by a new paragraph. Minor, but still a test that went from pass to fail.
The rails build’s was a real regression, and it came from a review fix. A reviewer asked for a change, and the agent running the process agreed without checking the existing tests. One of them pinned the old behaviour.
None of the 58 picked tests covered it. So the rails passed, and only the full run caught it.

So the full regression run still earns its place at the end. Reading the right tests up front doesn’t replace it.
What I think is missing
The defects that cost the rails build the comparison were found by something that ran the product and tried to break it.
That’s exploratory testing. My process has no stage for it.
I think it needs one, after the reviews and the full run. There’s a place for test cases nobody could have written down up front. I haven’t implemented that as a stage yet. It’s next on my to-do list.
Pick the right tests
Both failures that got through were in tests nobody picked at the start.
The rails protect what’s on the list. Pick well and the agent designs for the rules that matter. Miss one and you find out at the end, if you’re lucky.
Picking the right regression tests looks like a critical skill for getting the best out of a coding agent.
One more thing
I discovered another way to use the same tests. I took the run-only build’s code as it stood at that first failed run. Then I gave that code and the 58 tests to a separate agent. I asked one question. Which of these will fail? It ran nothing. Just read and analysed.
It named exactly the 12 that failed, with no false alarms.
That was interesting! More to follow on this.
What I’d take from this
Here are the lessons I’ve taken away from this:
- Give your coding agent the regression tests. Hand them over, like building regs.
- Make it read them before it designs, not just run them.
- Spend your effort picking the right ones.
- Keep the full regression run at the end.
- Don’t expect old tests to make new code good.
If I’ve learnt one thing, it’s that building the same change twice, changing one thing, is a good way to tune your AI coding agents.
Try it
GTMS is free and open source. It keeps your test cases next to your code, where an agent can read them. Download it, drop it into your project, and ask your AI coding assistant to run gtms --help.

