From Failed Trajectories to Reliable LLM Agents: Diagnosing and Repairing Harness Flaws

Mengzhuo Chen, Junjie Wang, Zhe Liu, Yawen Wang, Qing Wang
6/4/2026
cs.SEcs.MA

No official code found. Best implementation: HarnessFix/HarnessFix (17 stars, last commit 2026-07-02).

Abstract

LLM-based agents increasingly rely on harnesses that provide execution environments, tool interfaces, context, lifecycle orchestration, observability, verification, and governance. Existing self-improving agents and automatic harness evolution methods mainly improve agents through runtime supervision, prompt optimization, workflow search, or harness modification based on final outcomes. However, they often fail to diagnose where the responsible evidence lies in failed trajectories and which harness layer causes the unreliable behavior, resulting in broad, indirect, or poorly scoped changes. This paper proposes HarnessFix, a trace-guided framework for diagnosing agent failures and repairing agent harnesses. HarnessFix compiles raw execution traces and harness code into a Harness-aware Trace Intermediate Representation (HTIR), which normalizes fragmented trajectory evidence and captures step-level provenance and control-flow relations. It then attributes failures to responsible trajectory steps and harness layers, consolidates recurring diagnoses into actionable flaw records, and maps them to scoped repair operators. Finally, HarnessFix generates and validates harness patches under flaw-specific repair specifications to reduce target flaws without introducing unacceptable regressions. We evaluate HarnessFix on SWE-Bench Verified, Terminal-Bench 2.0 Verified, GAIA and AppWorld. Across these benchmarks, HarnessFix improves held-out test performance over the initial harnesses by 15.2%--50.0%, outperforms human-designed and self-evolution baselines, and reveals recurring harness-flaw patterns across ETCLOVG layers.

View on arXivView PDF

Code Implementations(1)

This is the official repository for the paper From Failed Trajectories to Reliable LLM Agents: Diagnosing and Repairing Harness Flaws

171Shell, PythonJun 22, 20263 months ago

Similar Papers

Cite this paper

@article{chen2026from,
  title  = {From Failed Trajectories to Reliable LLM Agents: Diagnosing and Repairing Harness Flaws},
  author = {Mengzhuo Chen and Junjie Wang and Zhe Liu and Yawen Wang and Qing Wang},
  year   = {2026},
  eprint = {2606.06324},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.06324v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.06324.svg)](https://codeofpaper.com/paper/2606.06324)

Discussion