Harness-Layer Fault Isolation as a Learning Loop Not Just a Debugging Step
Turning agent failure diagnosis into continuous improvement through harness redesign.

AI agent failure attribution by harness layer identifies the first divergence from correct execution and connects it to the runtime component responsible. Its value extends beyond diagnosis only when that finding drives a reviewable edit, replay validation, and production monitoring.
Why harness-layer failures keep recurring after engineers have already fixed them
A failure is fixed, then returns in a different guise. The next run may use different evidence or a task phrased another way, but the same defect remains. The trajectory-level RCA study found recurring patterns of evidence omission, misinterpreted evidence, and unsupported reasoning across multiple benchmark configurations and backbone models. An instance-level patch can therefore resolve the immediate failure without extracting the pattern that made it possible.
The persistence of common pitfalls across model capability tiers also points toward the shared agent framework. Yet the conventional sequence of opening a ticket, isolating the fault, applying a patch, and closing the ticket treats the incident as the unit of work. When no reusable failure pattern survives that sequence, the next incident begins without the benefit of the previous diagnosis. Each discarded attribution is a missed opportunity to tighten a component that will operate again under slightly different conditions.
What makes the harness the right place to look for recurring failure signal
The harness is the stateful program around the model that controls context, tool access, memory, retry policy, loop control, and action validation. It is an active part of execution. Because it determines what the model observes and which actions are available, a defect there can shape every decision that follows. The harness is therefore both a source of recurring failures and a direct surface for correcting them without retraining.
Jung and Son’s harness decomposition study demonstrates how much performance can come from that surface. Its declarative planning layer accounts for 24.1 percentage points of win-rate improvement over a belief-only harness without a single LLM call, while LLM-backed revision activates on only a small fraction of turns. That result comes from one planning harness and has yet to be shown across every agent architecture. It nevertheless establishes that competence cannot be assigned to model weights alone. Runtime design can do much of the work before the model makes a decision.
The model still makes decisions, but within constraints the harness supplies. An agent that loops without a termination constraint exposes a runtime control problem, even when the model selects each repeated action. The missing constraint belongs in the harness. Attribution to a prompt, tool gateway, loop controller, memory component, or retry policy consequently identifies a concrete engineering lever. It turns a broad complaint about agent reliability into a change that can be inspected and tested.
How do you pinpoint which layer of an AI agent stack caused a failure?
A wrong answer identifies an outcome. Specific attribution instead locates the first divergence from correct execution and connects it to the layer responsible. The RCA study illustrates the difference with an agent that reaches the correct root-cause service but leaves key metrics uninspected and reports the wrong answer. Outcome-level scoring records that the final label is wrong. The trajectory exposes the earlier omission that a useful intervention must address.
HarnessFix’s HTIR approach addresses the difficulty of assembling that evidence from heterogeneous execution traces. It normalizes trajectory evidence and aligns runtime steps with the harness artifacts that shaped them, making dispersed evidence usable for attribution. To tell a bad prompt from a broken tool call, an attribution system needs evidence that links the mistaken step to the instructions, payload, or tool interaction involved. A final-answer score alone cannot make that distinction.
Attribution must also tell apart defects in the harness, failures of the model, and problems with the environment or grader. Those categories direct work to different destinations. Harness failures guide runtime redesign, model failures inform post-training objectives, and environment or grader issues require benchmark repair. Treating all three as a generic failed run can send a valid engineering effort toward the wrong component. The useful signal is not simply that execution failed, but where correction belongs.
The three harness-layer failure categories and why each generates a different kind of improvement signal
Tool schema drift implicates the tool gateway. An agent may send a stale or partial payload that the tool coerces, defaults, or accepts after dropping fields. The response can still look valid, allowing the agent to narrate a confident result until a user or downstream system detects the mismatch. Here, the improvement signal is a schema validation gate that catches malformed payloads before they produce misleading outputs. Because drift can occur within days of a tool update, an attributed instance also motivates systematic schema monitoring.
Prompt ambiguity implicates the decision-making instructions instead. At the step level, task misunderstanding can arise from ambiguous wording or a failure to distinguish instructions in the prompt from instructions embedded in data. The agent’s path is essential evidence here. When attribution identifies the prompt as the source, structural disambiguation provides a direct harness edit whose effect can be tested by replaying the failing trace. Without that specificity, the same ambiguity can return through another surface phrasing of the task.
Workflow loops implicate deterministic execution control. CAAF’s ablation study found that LLM-based evaluation achieves zero paradox detection across eighty trials under deployment-realistic conditions. Apparent reliability in prompted settings is therefore not a dependable architectural termination guarantee. Loop attribution points to iteration budgets, structured termination rules, and state-locking at the harness layer. Unlike an ambiguous instruction, this failure requires a control boundary that a prompt-level intervention alone cannot supply.
A task that does not complete might need clearer instructions or a termination rule, while a confident wrong answer might originate in silently altered tool arguments. Misclassification directs the patch toward the symptom. The operational purpose of the taxonomy is to connect each recurring pattern to its responsible component and to the kind of change that can address it.
What a structured improvement cycle built on attributed failures actually looks like
The first step is attribution to a specific harness component. The engineering output is not just a failed-run label, but an account of the divergence and the runtime artifact responsible. That account becomes the input to the next change. Its specificity distinguishes a prompt misunderstanding from a malformed tool interaction or a missing execution constraint. Without that distinction, the cycle starts with an unsupported assumption about what needs repair.
The second step is a proposed harness edit. A prompt rewrite, schema validation rule, termination constraint, or memory update must be reviewable and inspectable as a response to the attributed cause. The proposed change is a hypothesis about how the harness should behave differently when the same failure conditions arise. Keeping that hypothesis tied to the attribution prevents a patch from drifting into an unrelated attempt to improve the final answer.
The third step is replay validation against the failing trace and a broader set of historical traces. The original case tests whether the edit fixes the diagnosed failure, while past cases test for regressions. Both are needed before the change ships. This requires traces that capture reasoning steps, tools considered and invoked, arguments passed, responses returned, tokens spent, and latency per hop. Those records must form a hierarchical trace that can be replayed deterministically, giving validation a concrete execution history.
The fourth step is production monitoring with the scorer that flagged the original failure. Once the edit ships, that scorer continues to assess live traffic so recurrence becomes another input to the cycle. Validation establishes evidence for the current edit, while monitoring tests whether the pattern remains controlled as production inputs change.
The RCA study provides empirical support for extracting patterns this way. It used failure patterns mined from diagnostic trajectories to build a lightweight defense prototype. Across two held-out benchmarks, six diagnostic frameworks, and two backbone models, the cataloged patterns recurred, and the prototype reduced their prevalence by 3.5 to 35.1 percentage points. The evidence supports pattern reuse beyond the original incidents.
How learned harness editing extends the loop beyond human-authored patches
A manual improvement cycle can only do as much as engineers have time for. Learned harness editing extends the same structure by using failure trajectories to propose executable changes and testing those changes through fresh execution. The automation does not remove the validation requirement. Production monitoring still supplies the recurring failures on which the larger cycle depends.
Harness-R1 post-trains a dedicated nine-billion-parameter harness engineer with online reinforcement learning. The engineer converts batches of target-agent failure trajectories into validated executable patches, while fresh reruns of the frozen target agent provide outcome rewards. Across WebShop, ALFWorld, and DBBench, the framework raises the baseline agent’s success rate by more than nine percentage points and produces further gains after direct target-agent fine-tuning. Those results make harness editing a complementary route to improvement alongside model training.
Harness-R1 trains the engineer on task success after the edit.
The Continual Harness framework and prompt-optimization sub-loops extend this research direction to online in-context learning over full harness state during a continuous episode. The edit surface grows from system-prompt rewrites to full harness-state rewrites based on the current trajectory window. As that surface grows, attribution is still needed to link changes to the runtime conditions they are meant to fix.
What changes when teams treat fault isolation as a recurring engineering discipline rather than an incident response
Teams that adopt this discipline keep attribution reports in a catalog that they archive and update beyond the end of an incident. Patterns that recur then guide how teams design the harness across tickets. Replay validation becomes a release gate. Before a harness change ships, it must be tested against historical traces that include the failure cases it is meant to fix.
Sampled live traffic is graded using the same rubrics, allowing distribution shift and silent regression to be detected through the mechanism used for the original failure. The harness is also versioned and reviewed as production code, so changes are auditable and rollback remains possible. Its improvement history becomes legible to the team. Together, those practices connect the failure report, the edit, the validation evidence, and subsequent production behavior.
CAAF formalizes domain invariants as a machine-readable harness asset, showing how verified constraints can accumulate independently of a particular foundation model. The harness records what engineering has learned to require. Silent schema drift and undetected loops keep causing incidents for users when teams have no standing process for learning from and fixing their causes.
Sources
- Harness-R1: Learning to Edit Executable Runtime Harnesses from Agent Failure Trajectories
- Beyond Fault Localization: A Trajectory-Level Study of LLM Agents for Microservice Root Cause Analysis
- How Much Heavy Lifting Can an Agent Harness Do?: Measuring the LLM's Residual Role in a Planning Agent
- From Failed Trajectories to Reliable LLM Agents: Diagnosing and Repairing Harness Flaws
- Harness as an Asset: Enforcing Determinism via the Convergent AI Agent Framework (CAAF)
- Root-Cause Attribution Is a Search Problem: Continual Search for Long-Horizon Agent Failures


