Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

The Agent Reintroduces a Bug You Already Fixed in an Earlier Session

Description and use

An AI agent can reintroduce a previously fixed bug if the fix isn’t enforced by a test. Adding a regression test named after the invariant and making it a merge requirement ensures the bug stays fixed.

Problem

An AI coding agent can reintroduce a bug that was previously fixed because it has no memory of past fixes, leading to regressions that are hard to detect until a regression test fails.

Outcome

By encoding invariants as executable tests and keeping them close to the code, teams prevent AI agents from reintroducing previously fixed bugs, even across refactors.

Workflow

  • 1. Identify the bug and fix it in the current session.
  • 2. Add a regression test that reproduces the original failure (red) and passes after the fix.
  • 3. Name the test after the invariant, not the implementation.
  • 4. Add a short comment only for non‑obvious constraints.
  • 5. If the bug depends on a boundary, add an end‑to‑end test that drives the real path.
  • 6. Commit the corrected code, the regression test, and the comment together.
  • 7. Run the test against the previous commit to confirm it would have caught the original failure.
  • 8. Make the test a merge requirement so every future session must pass it.

Evidence

An agent has no memory of a fix it made in a previous session, so nothing structurally stops it from reintroducing the exact bug you already paid to remove.

Source

Write the regression test before considering the bug closed.

Source

If the bug lived across a layer transition, a unit test is insufficient — drive the real path and assert the observable outcome.

Source

  • Record date: 2026-11-01T06:28:47.994Z