Self-healing is a loop, not a test that goes green on its own
A fix that comes back with a passing test is not fixed yet. One public .NET bug shows what the retest, and the people at each end, are for.
By Homayoon Behroozian, , 9 min read
A bug you reported comes back marked done. The change has a new test with it, and the test passes. Maybe a colleague wrote the fix. Maybe a coding agent did. Do you close the bug?
I'd guess many teams do, and it's a fair habit. A passing test is what we asked for. But if the bug is still there, it is closed under your name on a board that shows it as done, and nobody looks again until a customer does.
Some testing tools take that habit a step further: they repair an existing test that has started to fail, and some of them call that self-healing 1. Playwright's documentation gives its healer agent's output as "A passing test, or a skipped test if the healer believes that functionality is broken." 2
To me, a self-healing test doesn't mean a test that goes green on its own. A test should not go green on its own. What heals is the loop: the testing side confirms a bug, development fixes it, and the testing side retests it before anyone calls it fixed. Even then, a pass proves only what the retest covered. People still settle what "fixed" means at the start, and check the result at the end.
This loop is a proposal. It's how I think the work should be wired. A public bug in Microsoft's .NET shows why.
An agent's fix arrived with a test that agreed with it
The bug in .NET was reported in April 2025. A user reported that one text pattern made .NET's pattern engine throw an error on any input that wasn't empty 3. The report had a field called "Expected behavior", and the field held one sentence: "The function should return without throwing an error."
On May 19, Stephen Toub, a maintainer of .NET at Microsoft, handed the bug to GitHub's Copilot coding agent. The agent opened a change whose description said "Fixes #114626". Its fix was written to report no match where the engine used to throw. In the description's words, the engine now "properly indicates a 'no match' result instead of throwing an exception".
The agent's first test carried a comment: "No assertion on match result, just verifying it doesn't throw". Toub read the change that day and asked whether it was "fixing the symptom rather than the underlying issue". The agent agreed: "You're right that this fix addresses the symptom rather than the root cause."
The next day Toub wrote, "Your added tests are failing." About five minutes later the agent had changed its fix and rewritten its test.
- // No assertion on match result, just verifying it doesn't throw
- Assert.True(true, "No exception was thrown");
+ // Verify it doesn't throw and correctly reports no match
+ Assert.False(match.Success, "When backtracking stack is exhausted, match should be unsuccessful");Two days after that, Toub closed the change without merging it. In October, five months after the agent's attempt, his own fix was merged, and its test expects the pattern to match.
So the fix and this test had ended up with the same answer, no match, and the answer was wrong. The report's field never said whether the pattern should match. A day after the report, in the thread under it, the user wrote what he had expected: "I wasn't expecting the Regex to match." Nobody in the thread told him otherwise. No match was the answer the person who found the bug had said he expected, and it was the answer the fix took, and then its test. The test checked what the fixer had understood, and nobody had settled what the right answer was.
What I've told here is one case. Looking back in March 2026 over ten months of the agent's work, Toub wrote that it "can produce tests that validate existing incorrect behavior, effectively encoding a bug as the expected result" 4. This one did not ship. A person closed it.
Healing is the loop that sends a fix back for a retest
So what should have happened when "Fixes #114626" came back? I'd start with two words and who gets to say each. "Done" is the fixer's word, whether the fixer is a person or an agent. "Fixed" belongs to the side that found the bug. The coding task being done and the bug being fixed are two different events, and the loop is what connects them.
The loop has four stations. The testing side confirms a bug. Development takes it. The fix comes back. The testing side retests it. From there the bug is closed, or it goes back to development.
By the testing side I mean whoever found and confirmed the bug: a tester, a team, or a testing agent with a person behind it.
All four stations are tracked on one board that both sides read. A change of status on that board can start the retest, and it doesn't matter whether a person or an agent made the fix. Nothing has to guess that a fix is complete because some code changed.
Walk the .NET bug round the loop. By the time the agent wrote "Fixes #114626", the bug had been reported and handed to development. In the loop that sentence is the third station of four, the fix coming back. It would start a retest and close nothing.
When nobody has settled what the right answer is, the fixer's own test is a target painted after the arrow has landed. The retest is someone else walking up to a target that was drawn first.
Shoot again
Two walls and one arrow. On the left the target is painted after the arrow lands, so every shot is in the centre and the wall says done. On the right the target was drawn first and someone walks up to look: inside the target the wall says fixed, outside it says sent back. Wherever the arrow goes, the left wall says the same thing.
The second kind of check is old practice. Bugzilla has long kept two states for it, "resolved" and then "verified" by "QA" 5. My hypothesis is that development and testing are both becoming more agentic, and that the two can be linked in both directions.
A retest that passes proves only what it covered
Is the bug fixed when the retest passes? Hand the .NET bug to the testing side with nothing but the report, and ask what retest it would write. The report says one thing: "The function should return without throwing an error." A retest written from that sentence would check that nothing is thrown. That is what the agent's first test said of itself: "just verifying it doesn't throw". A fix that returned no match would get through that retest, and so would a fix that returned a match.
Now give the retest what the user said he expected, and it would ask for no match, which is the answer the agent's fix was written to give and the opposite of the one that was merged. A retest by the side that found the bug can only ask for what that side believes is right. Having the testing side run the retest still matters, and it is not the whole answer.
A passing test proves the thing it was written to check and says nothing about the rest of the feature. That is its scope, what it was written to check, and it is usually much smaller than the feature.
A pass of mine confirms a path a person walked first. I usually test a scenario by hand before I automate it. The bugs on that path mostly turn up then, while I'm looking at it. The automated run afterwards mainly tells me the path still works. In the .NET case nobody had settled what the pattern should return.
I have never seen automation as a way to find bugs. I've mainly seen it as a way to gain confidence. The mistake, to me, is taking one small check for the whole feature. So when a retest passes, report the pass together with what it covered.
That leaves two questions open: who settles what the right answer is before the fix, and who looks at the result after it.
People settle what fixed means at the start and check it at the end
In the .NET case nobody had settled whether the pattern should match. The field on the report was filled in, and it didn't say. What the user expected was in a comment in the thread, and a comment nobody answers on that point is one person's expectation, not the answer agreed and written on the bug. One line on the bug from a maintainer, "the pattern should match", would have given the retest something to check. That line would have come from neither the fixer nor the person who found the bug. In the loop I'm describing, that answer is agreed and written on the bug before the fix, and the fixer then shows how it handled it.
A person was at the end of this change, and it was not merged. Toub questioned the fix and closed the change, giving the agent's setup as his reason. No maintainer in the change said the test's answer was wrong. People settle what fixed means at the start and check the result at the end, which is why today I would not let an agent merge its own change, though perhaps later, with guardrails.
Someone has to draw the target before the shot, and someone has to walk up and look where the arrow went.
The strongest objection comes from the case itself. Of the agent's first weeks, which include this change, the same look back says: "The failure wasn't in the AI, it was in our preparation." 4 That is right as far as it goes: the agent could not build or run the tests, and the team fixed that afterwards. The fixer's own test is still worth running.
One item is missing from that preparation. Before the agent starts, a maintainer settles whether the pattern should match. That item is a person's, for each bug, and no setup supplies it once for all. A fixer that can run every test still cannot know an answer nobody has settled.
A tool that repairs a test after a button was renamed is doing useful work on the test, and that repair goes round the same loop.
So, do you close the bug? Not yet.
That's the only change I'd ask for this week. The loop is still a proposal, and it's how I think the work should be wired. Until the side that found the bug has retested the fix, and a person has looked at what that retest covered, I'd call it done and not yet fixed.
Sources
- healenium-web: "Self-healing library for Selenium Web-based tests", healenium, GitHub
- Playwright Test Agents: the healer, Microsoft, Playwright documentation
- Issue 114626, "Regex engine throws index out of range", with the user's comment of April 15, 2025; pull request 115733 (Copilot, closed unmerged May 22, 2025); pull request 120872 (merged October 19, 2025), dotnet/runtime, GitHub, 2025-04-14
- Ten Months with Copilot Coding Agent in dotnet/runtime, Stephen Toub, .NET Blog, 2026-03-23
- A Bug's Life Cycle, Bugzilla 2.16.7, Bugzilla