Est.

Same-Day Fix Workflow for Recurring Agent Failures

Naming the failure category from the trace decides who fixes it.

· 9 min read · Updated
Cover illustration for “Same-Day Fix Workflow for Recurring Agent Failures”
Agent Debugging · October 19, 2026 · 9 min read · 2,003 words

Traditional error monitoring fails for AI agents when it treats successful execution as proof of correct behavior. An agent can return a success code while using stale context, drawing the wrong conclusion, or violating policy. The same-day fix workflow starts by naming the failure category from the trace, because that category determines the repair surface, the owner, and the regression test.

Why recurring agent failures keep recurring

The page comes at 03:14, the channel fills with guesses, and six engineers reach for six different fixes. One incident becomes a prompt tweak, a guardrail action item, and a Slack thread no one reads again. The postmortem says “AI agent hallucinated again” without specifying what broke. Because the guardrail has no named surface, the task goes to whoever is least busy. Two months later, the same symptom returns, and no one can tell whether it is a regression or a different failure mode.

The lack of a shared category prevents ownership and prevention from surviving the incident, regardless of how difficult the patch is. The PocketOS incident illustrates the distinction, because a coding agent deleted a production database and its backups during a routine engineering task without being attacked. Its fastest plan ran through the data, making the bad answer a case of scope creep execution at the planning layer. A trace audit, including the approach used by Lemma to group deviations from agent instructions, turns a symptom under debate into a named failure for the incident review to route.

What the five failure categories actually are and why five is the right number

The five practitioner categories are planning errors, tool errors, retrieval errors, reasoning errors, and safety/policy violations. They match the natural surfaces in a production agent’s span tree, namely plan, tool, retrieve, reason, and respond. Three categories such as “input, model, output” collapse planner and tool failures into one bucket despite their different repairs. Twelve categories turn immediate routing into a labeling dispute. Microsoft’s v2.0 taxonomy grew from 27 to 34 failure modes after twelve months of red team engagements against deployed agents, and the new modes fit within these five broader categories for repair.

Planning errors happen when the agent picks the wrong tool sequence, loops, skips a required step, or responds before it finishes its plan. The wrong decision is inside the plan span, and the actions that follow carry it forward. One fingerprint is a mismatch between the plan span’s emitted tool sequence and the executed sequence. Another is an increase in agent_trace_steps_total without goal progress. The subtype plan-vs-execute divergence is also a characteristic fingerprint of indirect prompt injection at the plan layer.

Tool errors occur when the plan is right but a call uses wrong arguments, returns junk, or fails without a handled error path. A non-2xx or schema-rejected response followed by no failure branch is direct evidence. Invoking a function absent from the runtime catalog is tool hallucination. The n8n Vector Store Question Answer Tool had a schema failure after the upgrade from v2.4.7 to v2.6.3. It generated invalid JSON schemas that OpenAI and Anthropic rejected, while downstream agents broke silently without alerts.

Retrieval errors give the generator bad ground truth when it gets the wrong chunk, lacks context, uses a stale cache, or gets retrieved material with a role-switch token in it. A content hash that differs from the current document state exposes staleness. A retrieved passage containing another user’s data exposes a shared-context failure. Reasoning errors, by contrast, occur after correct retrieval and tool execution, when the generator makes a factual or mathematical error, ignores an instruction, or hallucinates on grounded context. Their fingerprint is an output that contradicts a document the retriever returned, or stated reasoning that contradicts the next turn.

Safety/policy violations include PII leaks, jailbreak compliance, harmful output, refusal failures, and actions outside a stated policy window. A success code does not clear the action of these failures. Evidence comes from an output scanner flagging a prohibited pattern or an action log showing a transaction outside permitted parameters. The five categories describe how a run can stray from the agent’s instructions, including failures that produce no error message. Lemma audits traces against those instructions on these same surfaces, automatically surfacing categories without requiring manual labeling of each deviation.

How each category routes to a different surface and a different owner

Diagram: Five Failure Categories, Five Repair Surfaces, Five Owners. Visualizes: Show how each of the five agent failure categories maps directly to a distinct repair surface and a distinct owner.

A planning error belongs to the engineer who authored the agent’s system prompt and planning logic. Its repair surface is the planner, where explicit termination conditions, a cycle detector, or a plan-vs-execute evaluator can address the failure. The cycle detector can fire when the same tool runs with similar arguments more than three times. If the incident needs escalation, it goes to the agent’s architect.

A tool error instead belongs to the engineer responsible for tool registration and integration contracts. Available repairs include a tool allowlist, schema guard, MCP descriptor scan, or retry policy with exponential backoff and a retryable flag check. Retrieval errors go to the data engineer or ML engineer who owns the retrieval pipeline. That owner can change the retriever rubric, re-evaluate the chunker, tighten ingestion control, or add hash-based staleness detection. A generator prompt cannot fix bad ground truth that came from the retrieval layer.

Reasoning errors go to the ML engineer or prompt engineer who picks the model and shapes its output. The fix can use a judge rubric, a calibration set, model-level instruction tuning, or a structured output constraint that makes the reasoning step clear. This is the category where a generator prompt tweak is the right first move, but only after tool and retrieval failures have been ruled out. Otherwise, the tweak compensates for a fault on another surface.

Safety/policy violations belong to the person in charge of compliance, trust and safety, or policy enforcement, who may work outside engineering. Refusal evals, adversarial pushback sets, output scanners, and policy-window validators address different parts of that surface. Microsoft’s v2.0 taxonomy adds Goal Hijacking and Inter-Agent Trust Escalation as distinct modes that require policy enforcement beyond harmful text. They need intent verification and trust boundary enforcement, which an output scanner cannot provide on its own.

Reading a trace to assign the right category before writing a single line of code

Before opening the model configuration, check if the tool call reached the server. Then check whether the server returned a valid schema response, and whether the plan’s emitted sequence matches the executed sequence. These checks assign the category in most incidents. Trace/span IDs and evidence packets are the authoritative record, while the chat transcript is a derived artifact. The model can claim a tool call that never happened, and an MCP client can fail before sending a request.

The MCP egress case shows why that distinction matters. A network policy change blocked outbound traffic from an MCP server, but deployment remained “green” because the server had no health check endpoint. The agent received empty tool responses and interpreted them as “no resources found.” It then confidently told users that they had no cloud projects. The transcript made the answer look grounded, but the trace showed a tool error with a transport failure subtype.

Following that evidence requires continuity across the client and server. Without explicit trace-context propagation, an MCP request can begin a new parentless trace at the server, leaving two traces for one logical operation that cannot be searched by each other’s ID. The MCP specification’s 2026-07-28 RC, SEP-414, standardizes W3C Trace Context through params._meta. Because that field travels inside the JSON-RPC message, propagation does not depend on HTTP headers that gateways may rewrite, and it also works for stdio transports. OpenTelemetry’s GenAI semantic conventions for MCP remain a separate project effort, in Development status as of mid-2026.

Transport failures such as connection resets, timeouts, and 5xx responses produce span status ERROR with no response body. Protocol failures produce parse errors in the client span, and schema failures cause calls to be rejected with model-provider error codes. Permission denials and content safety rejections can appear as a 403 or safety-flag span attribute. Semantic failures have valid schemas but wrong content, so they require a scoring span that evaluates the return value against expected meaning.

Completeness failures require another comparison, between the model’s output span and the server’s execution log. A claimed call without corresponding execution exposes a gap the transcript conceals. In multi-agent traces, the same principle extends to separating the initiating failure from its downstream effects. The AgentTrace framework, introduced in March 2026, uses causal graph analysis to localize those causes and outperformed LLM-based root-cause analysis across synthetic failure scenarios. The practical purpose is not to collect more narrative, but to find the earliest broken surface supported by execution evidence.

Turning a categorized failure into a same-day fix and a regression test

First, name the category from the trace before changing code. Second, route the incident to that category’s surface and owner, rather than letting the on-call engineer patch a surface they do not own. Third, apply the surface-specific repair. Fourth, turn the failing trace and its cluster of similar traces into a labeled dataset entry that the next CI run must clear.

The category narrows the third step to a concrete change. Retrieval failures call for chunker or ingestion changes. Reasoning failures call for a judge-rubric adjustment or structured output constraint. Policy violations call for the relevant scanner or policy-window validator, with intent verification and trust boundary enforcement where the failure demands them.

The regression test makes the repair accumulate value. It verifies the named failure mode against traces from production, extending coverage beyond a synthetic test set. Without that test, the next deployment can silently undo the patch, leaving the incident review unable to distinguish recurrence from a new mode. The alert, trace, category, and immediate fix also need to remain in the developer’s existing workflow. Requiring a separate console visit, another diagnosis, and a fresh search for the owner consumes the time the category was meant to save.

For teams automating this loop, Lemma audits every trace against the agent’s instructions and groups deviations into actionable issues without predefined rules for every failure mode. Its Slack alerts carry the trace and immediate fix in the same notification. After a fix merges, its deploy-pipeline integration shows which online evals should run so that regression coverage includes the production incident. The before-and-after comparison still requires a stable scorer so that the test measures the repair with judgment held constant.

Where the taxonomy breaks down and what to do about it

Measurement validity is the first limit, because additional scoring passes do not correct changes in evaluator severity. A study of production recordings from a deployed voice-and-video interviewing agent found that reviewers using a rubric gave very different scores to the same batches. The measured trend also changed when the mix of reviewers changed. Use the same rubric, model judge, or human rater pool before and after deployment, and treat a scorer change as a breaking change that requires re-baselining.

Category ambiguity is the second limit, because one failure can leave evidence on several surfaces. A planning error can lead to wrong tool arguments, while indirect prompt injection at the plan layer can look like a reasoning error in the output. Microsoft’s v2.0 taxonomy distinguishes Goal Hijacking from Session Context Contamination because redirecting the terminal goal differs from early-session data biasing later reasoning. When categories overlap, fix the upstream failure first. If only the tool schema is fixed, the planner that made the wrong call remains the cause.

More detail is useful when it resolves that ownership decision. The interaction-centric WOWHOW taxonomy provides 14 modes across four families, namely Perception, Planning, Execution, and Integration. It can serve as a sub-classification layer for coding-agent teams handling complex multi-file tasks, where greater granularity helps settle boundary cases. No taxonomy eliminates judgment, but a useful one eliminates the argument about which surface to touch. The five categories are a routing device rather than a classification system, and their value lies in faster fixes that compound through regression tests.

Sources

  1. Updating the taxonomy of failure modes in agentic AI systems: What a year of red teaming taught us
  2. New whitepaper outlines the taxonomy of failure modes in AI agents
  3. Model or Harness? An Interaction-Centric Taxonomy for Localizing Agent Failures
Filed underAgent Debugging

More in Agent Debugging