← Latest papers
💻 computer science

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

This paper introduces HarnessFix, a trace-guided framework that diagnoses agent failures by analyzing execution traces and harness code to generate targeted, validated patches that significantly improve LLM agent reliability across multiple benchmarks.

Original authors: Mengzhuo Chen, Junjie Wang, Zhe Liu, Yawen Wang, Qing Wang

Published 2026-06-05
📖 5 min read🧠 Deep dive

Original authors: Mengzhuo Chen, Junjie Wang, Zhe Liu, Yawen Wang, Qing Wang

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you have a brilliant but sometimes confused assistant (the LLM Agent) trying to solve complex puzzles, like fixing a broken computer program or planning a trip. This assistant doesn't work alone; it works inside a "control room" built by engineers. This control room is called the Harness.

The Harness is the set of rules, tools, and safety checks that tell the assistant:

  • What tools it can use (like a screwdriver or a search engine).
  • What information it can see (like a map or a manual).
  • How to report its progress.
  • When to stop and say, "I'm done."

The Problem: The "Black Box" of Failure

Sometimes, the assistant fails. In the past, when things went wrong, engineers tried to fix it by:

  1. Tweaking the Assistant's instructions: "Hey, try to be more careful!" (This is like telling a driver to "drive better" without fixing the broken brakes).
  2. Guessing: Looking at the final result and hoping a random change helps.

The problem is that these methods often miss the real issue. The failure might not be the assistant's fault; it might be that the Harness gave the assistant the wrong tool, hid a crucial error message, or let the assistant quit before finishing the job. Because the assistant's actions happen in a long, messy chain of events, it's hard to pinpoint exactly where the control room broke.

The Solution: HARNESSFIX (The Detective)

The authors of this paper created a new system called HARNESSFIX. Think of it as a forensic detective for the control room. Instead of guessing, it investigates the crime scene (the failed attempt) step-by-step to find the exact broken part of the Harness.

Here is how HARNESSFIX works, using a simple analogy:

1. The "Translator" (HTIR)

First, the detective takes the messy, confusing log of what happened (the "trace") and the code of the control room, and translates them into a clean, organized map called HTIR.

  • Analogy: Imagine a chaotic crime scene with scattered clues. The detective organizes them into a clear timeline: "At 10:00, the agent asked for a tool. At 10:01, the tool gave an error. At 10:02, the agent ignored the error." This map connects the agent's actions directly to the rules that governed them.

2. The "Diagnosis" (Finding the Culprit)

Next, the detective looks at the map to find exactly where the chain broke.

  • Analogy: The detective asks: "Did the agent fail because it didn't know the password? Or because the door was locked by the security system (the Harness)?"
  • HARNESSFIX identifies if the problem was in the Tool Interface (bad instructions), Lifecycle (letting the agent quit too early), or Observability (hiding the error messages). It creates a specific "Flaw Report" for recurring problems.

3. The "Repair Shop" (Scoped Fixes)

Once the flaw is identified, HARNESSFIX doesn't just let anyone rewrite the whole control room. That would be dangerous and might break other things. Instead, it uses a set of Repair Operators.

  • Analogy: Think of these as specific tools in a mechanic's kit. If the problem is a loose bolt, the mechanic uses a wrench. If the problem is a flat tire, they use a jack. HARNESSFIX only uses the specific "wrench" needed for that specific flaw. It writes a small, precise patch to fix only that broken part, ensuring it doesn't accidentally break the engine.

4. The "Safety Inspector" (Validation)

Before the new patch is installed, a safety inspector checks it.

  • Analogy: The inspector asks two questions:
    1. "Did this fix the specific problem we found?"
    2. "Did this fix accidentally break something else that was working fine?"
  • If the answer to the second question is "Yes," the patch is rejected. This prevents the system from getting worse while trying to get better.

What Did They Find?

The researchers tested this detective system on four different types of difficult tasks (fixing software, using command lines, doing research, and automating apps).

  • The Results: HARNESSFIX improved the success rate of the agents by 15% to 50% compared to the original setup.
  • The Comparison: It performed better than:
    • Human experts who manually designed the control rooms.
    • Other AI systems that tried to fix themselves by just changing instructions or guessing.
  • The Discovery: They found that many failures weren't because the AI was "dumb," but because the "control room" had hidden flaws, like hiding error messages or letting the AI quit too soon. HARNESSFIX found these hidden flaws and fixed them.

In Summary

HARNESSFIX is a system that treats a failed AI attempt like a crime scene. It doesn't just blame the AI; it investigates the environment the AI was working in, finds the specific broken rule or tool, and applies a precise, safe fix. This makes the AI much more reliable without needing to retrain the AI's brain or guess what went wrong.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →