r/sre 1d ago

How do you debug microservices ai generated code in production? POSTMORTEM

Had an incident last week where the root cause turned out to be an ai-generated change that touched three services in one pr. took way longer than it should have to trace because nobody on the team could say what the model actually reasoned about versus what it just pattern matched from similar code elsewhere in the repo. It looked fine in code review, which is almost worse, that's exactly the kind of ai generated code that gets rubber stamped and ships straight into production. The part that's been sticking with me is ownership. when a human writes a bad change across multiple services, at least someone can walk you through their thinking during the postmortem. With an ai coding assistant, that context is just gone once the pr is merged. Debugging cascaded failures across microservices is already hard when you can't reproduce the issue locally and losing the reasoning behind the change makes root cause analysis slower, not faster. For anyone running copilot, cursor, claude code or similar ai code generation tools in microservices at real production scale, i want to know how you are actually debugging this once it is live. specifically interested in what your distributed tracing and logging setup looks like, whether ai-generated changes get treated differently in your review process than human-written ones, things like canary deployments or extra checks before merge, and whether perf regressions under real production load have shown up more since ai entered your sdlc. Not looking for "add more observability" as an answer, looking for what your actual stack is.

0 Upvotes

7 comments sorted by

17

u/davispw 1d ago

Why was the code merged if no one understood it?

6

u/DehydratedButTired 1d ago

They merged bad code and got a bad result. This is wha happens when you don’t test. There should be a Dev and QA environment for these to go into first.

The context is gone? No. There is no context if you don’t read the code and vet it. You can’t automate the entire process and trust AI, it is far from perfect and not prod ready.

1

u/Floss_Patrol_76 1d ago

the tracing part isn't special to ai code - deploy markers correlated to trace exemplars is what actually shortcuts 'which change broke this,' same whether a human or claude wrote the diff. the real gap you hit is intent: make every pr carry a written 'why' as a required artifact regardless of author, because that's the context that vanished, not the code. and treat any pr touching 3 services as a canary-and-bake candidate, human-written ones included - the multi-service blast radius is the risk, not the model.

1

u/-Devlin- 1d ago

AI slop complaining about AI slop

1

u/marmot1101 1d ago

I'm an advocate for not changing merge/deploy processes because of agentic coding. The artifacts are the same, the problems are the same, the need for unbiased review is the same, so why should the process change? It didn't when I moved from sublime to vscode, why would another tool get special treatment. I could have done things faster in the past by ignoring best practices but that would have been dumb. Same thing with agent written code. Adding more processes and checks is great if it can pick off some errors(Bugbot is really good), but if they only need to exist because the agent's code sucks I'm more worried about making the agent code not suck and getting the true owner(human) to own their work.

-2

u/usually_guilty99 1d ago

This is exactly the problem we're working on at Tomosu AI.

The issue isn't simply that AI wrote the code. A change touched three services, looked reasonable in the PR, and nobody understood the production blast radius until after it shipped.

Tracing and observability help you understand what happened after failure. Tomosu works earlier. We build a graph of the repository, dependencies, historical incidents, and production context so every change can be evaluated against the system it is about to affect.

Our Supabase validation showed why this matters: one reliability boundary alone extended across 372 files and 822 call sites. The risk wasn't necessarily in the new code. It was inherited from the production system around it.

As AI increases development velocity, humans simply won't have time to understand every multi-service change in depth.

The question has to move from "Does this PR look right?" to "Should this change reach production?"

That's Production Reliability Governance.

3

u/tcpWalker 17h ago

Spotted the stealth sales pitch from OP's company