DEV Community

Todd Sullivan
Todd Sullivan

Posted on

My AI Coding Agent Found a Missing Component. Git History Said Not to Build It.

An automated coding agent picked up what looked like a simple missing-work item:

TrialExpiredCard is declared in the implementation plan but missing from the codebase.

The plan was specific, the symbol was absent, and roughly 95% of the other named artifacts already existed. This is exactly the kind of task an agent can “complete” quickly and get completely wrong.

Instead of creating the component, I made the agent treat the spec as a hypothesis.

It checked three things:

grep -R "TrialExpiredCard" .
git log -S TrialExpiredCard --oneline
git show <matching-commit>
Enter fullscreen mode Exit fullscreen mode

The history showed two deliberate architecture changes.

First, the app's hand-rolled local trial had been replaced with a real StoreKit introductory offer. The old state used a Keychain date, local isTrialActive logic and a fixed duration. StoreKit now owns eligibility and the transaction state.

Then TrialExpiredCard was renamed to PremiumUpsellCard.

That was not cosmetic. Under the new model, every non-subscriber can see the card, including someone opening the app for the first time. Recreating the component from the stale plan would put “Your Free Trial Has Ended” in front of users who had never started one.

The current component was already wired into the dashboard and still opened the upgrade flow. The implementation existed; only the old symbol name was gone.

The correct agent result was:

  • zero files changed
  • zero tests run
  • zero commits created
  • one stale-spec finding recorded

This is now a rule in my coding-agent workflows: a missing symbol is not proof of missing behaviour.

Before generating code from a plan, the agent has to check the current implementation, search git history for renames/removals, and identify the product or architecture decision behind the change.

Most AI coding failures are described as hallucinated code. The quieter failure is obedient code: implementing an outdated instruction perfectly and restoring a bug the codebase already removed.

Sometimes the best AI-generated diff is no diff.

Top comments (1)

Collapse
 
salparvez profile image
Sal Parvez | ML Systems RI •

"Obedient code" is a useful name for it. The same thing happens on a renovation with drawings: the plan shows a wall, the wall isn't there, and the wrong move is to build it back. Somebody took it out for a reason, and the as-built is the truth, not the print. Treating the spec as a hypothesis and checking the history before cutting anything is the right habit. I'd also keep the last line of that report, one stale-spec finding recorded, as a first-class result. If a run that correctly changes nothing looks like a failure in the logs, people will train the agent out of doing it.