đź”§ From Frustration to Success: How I Fixed a Stubborn Bug with AI Using Debug-Only Mode
Ever had an AI assistant confidently tell you “bug fixed!” several times… only to discover the bug is still alive and kicking? I sure did.
The Problem
I was fighting a stubborn UI glitch in the macOS tray menu of my side-project.
Using Cursor, I followed my normal routine: describe the bug in detail, list the steps to reproduce it, and spell out the expected behaviour.
My First Approach (That Failed)
I threw every model I had at the issue—Claude-4 Sonnet, Gemini 2.5 Pro, GPT-4.1 and even attached screenshots.
Each model rewrote different parts of the code and proudly announced “Fixed!”.
But when I ran the app, the bug was still there.
Worse, the AI sometimes got stuck in loops or removed unrelated features in its attempts to “help.” After a few hours, I realised I was spinning my wheels.
The Game-Changing Strategy: Debug-Only Mode
Instead of letting the AI rewrite code, I set one hard rule: the AI can only add debug logs—nothing else.
Here’s how it worked:
- Restrict AI permissions – “Add log lines only.”
- Get targeted grep commands – the AI supplies copy-ready commands after every change.
- Feed real data back – run the app, reproduce the bug, paste the filtered logs into chat.
- Repeat until breakthrough – short, focused iterations.
The Results
After 4–5 loops, we traced the culprit to bad cache invalidation in the data layer—nowhere near the UI. One tiny manual patch fixed everything.
Why This Works
- Real data beats guesswork 📊
- You stay in control 🎮
- Fast feedback loops ⚡
- Prevents scope creep 🎯
Your Turn
Have you tried limiting your AI assistant’s permissions?
What debugging tricks work best for you? Let me know in the comments!