July 2, 2026 · 8 min read
The Duplicate Component Trap: Why Your AI Agent Says It's Fixed But Nothing Changes
Replit Agent and Bolt.new quietly spawn checkout-v2.tsx, declare victory, and leave your app running the broken original. Here's how to spot it and stop it.
By Launched team
You asked the agent to fix the checkout bug. It thought for ninety seconds, streamed a confident "Done! I've updated the checkout flow to handle the edge case," and you reloaded the app. Same bug. Same broken redirect. Same charge that never clears. You ask again. Same result. Three hours and 40,000 tokens later you finally open the file tree and find it: checkout.tsx, checkout-v2.tsx, checkout-new.tsx, checkout-fixed.tsx. The agent has been "fixing" a file your router never imports.
Context collapse is not a quirk, it's the failure mode
When an AI coding agent loses track of which files actually wire into your running app, it doesn't tell you. It does the next plausible thing: it creates a new file with the changes you asked for and reports success. From its perspective the diff is real. From your perspective the bug never moved.
Why Bolt.new and Replit Agent are especially prone to this
- Long sessions blow past the context window; the agent forgets which file is canonical.
- Tool-call retries on a failed edit often fall back to "create new file" as a safer-looking action.
- The agent can't actually run your app and verify; it trusts that a successful write equals a successful fix.
How to detect it in 60 seconds
1. Search your repo for version suffixes
rg -l "v2|new|fixed|copy|backup" across your routes and components folder. If you see siblings of the same component, you have ghosts.
2. Check what your router actually imports
Open the router or route file. The import path is the source of truth. Anything not on that path is dead code the agent is happily editing.
3. Add a console.log no agent would think to add
Put a unique string at the top of the file you think is loading. Reload. If you don't see it, you're not editing what you're running.
How to stop the bleed
Delete the ghosts before the next prompt
Every duplicate you leave in the tree is a future trap. Remove them, commit, then ask the agent to continue.
Pin file paths in every prompt
"Edit src/routes/checkout.tsx. Do not create new files." Boring, repetitive, effective.
Stop trusting "Done"
Treat agent confirmations as a hypothesis. Reload, click through, verify. If you can't reproduce the fix in the UI in 30 seconds, it didn't happen.
Where Launched comes in
We get called in after the duplicate-component spiral has produced a repo with six checkout files and a Stripe integration nobody trusts. We clean it up — delete the ghosts, restore a single source of truth per route, and finish the actual fix — for a flat fee, in days. Book a 20-minute call. Related: Own your build.
