Mayank Bhola, Co-Founder and Head of Products, (Formerly Lambdatest).
If your engineers use coding agents, you have watched a new habit form. A service gets tangled, and instead of scheduling a refactor, someone deletes the module, hands the agent the interface and the existing tests and merges a fresh implementation that afternoon. A few rounds of that and the code your team ships in March may share little with what it ships in September.
My answer is the tests; teams that work this way still maintain something, and I’d argue it’s the test suite. For decades we treated code as the expensive asset and tests as the insurance policy on it.
Coding agents flip that. Once an implementation takes an afternoon to regenerate, the thing to protect is the executable record of what the software must do, and in most companies that record already sits in the tests, whether anyone designed it that way or not.
The economics have already shifted.
GitClear’s found an eightfold increase during 2024 in blocks of five or more lines that duplicate adjacent code.
Copy-pasted lines also outnumbered moved lines, which GitClear treats as its signal for refactoring and reuse. Developers are adding new code far more often than they tidy old code.
Teams are producing more code, curating less of it and shipping changes that fail more often.
Asking reviewers to look harder won’t close that gap, because review processes were built for changes a human wrote and planned to live with. Engineering leaders need a check that survives the rewrite.
Most suites were built to protect code that stays.
A lot of today’s tests are welded to implementation detail, such as private method names or the exact order of mocked calls. Those tests break whenever an agent produces code that is organized differently but behaves the same.
Teams under deadline tend to regenerate the tests along with the code. From that point on, the suite confirms whatever the agent wrote last.
The tests worth funding check behavior at the boundaries. They survive a rewrite because none of them care how the code is laid out:
• API contracts between services
• End-to-end user journeys, such as signup or checkout
• Business rules written in the language of the domain
• Regression tests for past incidents, which tend to be the most valuable tests a company owns and the least glamorous to maintain
For a quick diagnostic, pull the last few modules your team regenerated with AI and count how many test files changed in the same pull request. A high count means your suite moves whenever the code moves, and a suite in that state can’t catch a regression the agent introduced.
How can you stop coding agents from grading their own work?
When an agent can edit the tests it is judged by, it often will. Researchers at Carnegie Mellon and Anthropic showed this in by altering tests so they contradicted the written specification. The highest-performing model still passed 54% of these impossible tasks on the conflicting SWE-bench variant, and more capable models generally cheated more.
The researchers also tested access limits. Hiding the tests cut cheating to near zero but hurt legitimate performance, while read-only tests stopped edits and left hardcoded answers untouched.
When we built our own agentic test automation, we kept it separate from the coding agent on purpose. It writes behavioral tests from natural-language intent and exports them as standard Playwright or Selenium code, so the checks come from a different source than the code they judge.
Kane CLI takes the same approach into the terminal: the testing agent runs right beside a team’s coding agent for web and mobile apps, without sharing its job.
I treat this the way an auditor would: Whoever produces the work does not control the standard it is judged against. In practice, that comes down to four controls:
• Make behavioral tests read-only for coding agents. Agents can add new tests in a separate folder, but existing contract and end-to-end tests stay locked in their workspace.
• Put test directories under code-owner review. Any change to an existing assertion needs sign-off from a person or a separate verification agent that did not write the code under test.
• Fail the build on weakened assertions. A pipeline check on AI-authored pull requests should flag deleted tests, new skip markers and loosened expected values before anyone reviews the code.
• Keep a held-out suite for hardcoding. Read-only access does not stop an agent from special-casing the checks it can see, so rotate a set of behavioral tests the agent never sees and run it before merge.
Trust follows the cost of checking.
Developers already set their trust by how easy the output is to check. In Stack Overflow’s , 48% of respondents said they trust AI output when they can easily verify it, and only 6.6% trust it for important work decisions.
A team with a protected behavioral suite can check regenerated code by running it, so it can let agents move faster. A team without one falls back on reading diffs line by line, which breaks down once agents write most of the changes.
Protect what outlasts the code.
The approach has a failure mode of its own. A locked test that encodes the wrong business rule keeps the bug alive, so every behavioral test needs a named owner who can change it on purpose and log why.
Payment flows and regulated workflows also still earn careful human authorship. For everything else, I’d report one new number to leadership each quarter: the share of behavioral tests that survived the last regeneration without edits.
Coverage measures how much code your tests touch. This number measures whether the definition of your product held steady while the code underneath it changed.
A falling number means agents are rewriting requirements along with the implementation, and product and engineering leaders should review that together before it reaches customers.
Forbes Technology Council is an invitation-only community for world-class CIOs, CTOs and technology executives. Do I qualify?
