Blog / October 24, 2026

I Spent 19 Hours Debugging One Feature. Here's What I Learned.

vibe-codingagentic-buildingarchitecture-driftcontext-rotpre-build-planning
D
David
I Spent 19 Hours Debugging One Feature. Here's What I Learned.

This is a true story. The image is a close representation of my physical and mental state at the end of this saga.


TL;DR: I started at 7am and didn't wrap up until 2:30am. This wasn't because the feature was complicated. It was because the entire architecture collapsed the moment I tried to ship it.

How it happened

After implementing and testing a new feature, I ran into the first bug. While trying to fix it, I uncovered bug number two, a pre-existing issue that had to be resolved before I could even test the first one properly. So, I switched my focus to bug 2. I got a fix in and ran a code review, which came back with three valid findings. However, as soon as I started addressing the very first finding, I found bug 3. By this point, I had completely lost track of the original feature I was trying to build.

I switch agents and ran an investigation session so I could plainly understand what the codebase was actually doing. That's when I realized the foundation had been built in a way that never accounted for this specific use case. This wasn't just a bug, it was a massive structural gap. I knew a refactor was unavoidable, so I closed the PR, created tickets for the unfixed issues, recorded the current state, and started the refactor.

In a few hours, the refactor was complete. While running a code review, several bugs were discovered, which thankfully were fixed without issues. I then started the backward journey and retraced my steps back to bug 3, and realized it had thankfully vanished during the refactor. I moved on to bug 2, shipped a fix and tested it again and it worked.

Finally, I made it back to bug 1. I switched from Sonnet to Opus on high, burning through Claude's five-hour credit limit in just less than an hour while Opus worked uninterrupted to trace the issue. Eventually, it found the root cause and we got it fixed.

I tested everything one last time. It worked. Ran another code review, no blocking issues. Merged the PR. I was exhausted and frustrated, but relieved. I looked at the time. 2:30am.

What actually went wrong

None of those bugs were random, they were all downstream of a single failure point. Earlier on in the project, the agent made an architectural decision that simply didn't hold up in reality. This is architecture drift. It happens when an AI builds without a master plan. It never fails loudly. Instead, it invents patterns, fills in gaps with reasonable-sounding choices, and keeps building on top of a foundation it completely made up. Everything looks perfectly fine right up until you push the one feature that exposes the assumption.

By the time I hit that 7am-to-2:30am session, I wasn't debugging a feature anymore. I was paying back the architectural debt the agent accumulated while building without a spec.

The fix isn't better prompting

I've seen the general advice in AI communities many times, "Write a better prompt next time.", "Be more specific", "Add more context". That might help at the margins, but it doesn't fix the core issue. An agent without a spec isn't just missing information. It is actively making decisions on your behalf, decisions that will most likely come back to bite you. It makes those decisions once, early on, and then builds blindly on top of them.

When a use case arrives that the original decision didn't account for, you don't get a clean error. You get a cascade, and that cascade is exactly where those 19 hours went. The only real fix is giving the agent a stable architectural foundation before you write your first prompt. You need a defined schema, a strict routing plan, and hard component boundaries. When those decisions are locked in upfront, the agent stops inventing and starts executing. That is the difference between a build that holds up and a build that takes you on a 19-hour debugging detour.


Zalcro generates your Architecture Design Document and phased implementation plan before your agent writes a single line, so it builds on a foundation you designed, not one it invented.

Keep Reading