AI
New System Guides AI to Fix Code Bugs by Observing Program Behavior in Action
Researchers introduce TraceRepair, a multi-agent framework that uses runtime execution traces to help large language models generate more accurate software bug fixes.
Automated program repair—the task of fixing software bugs without human input—remains difficult for AI systems, especially when dealing with subtle logic errors or failures that produce no error messages. Existing approaches lean heavily on source code analysis and basic test results, which often fail to capture what actually happens when code runs.
A new research paper submitted to arXiv proposes TraceRepair, a system that treats the record of a program's execution—its runtime trace—as crucial evidence for validating repair ideas rather than just additional context to feed an AI model.
How execution traces improve repair#
The key insight is that watching a program's state as it runs reveals concrete information: which variables change, when they change, and what values they hold. Rather than a single AI model trying to guess the right fix in isolation, TraceRepair deploys multiple specialized agents:
- A Probe Agent captures snapshots of critical variables during execution
- Repair agents generate candidate patches and compare them against the observed runtime data
- A Judge Agent weighs the remaining hypotheses and produces the final patch
This multi-agent debate ensures that patches are validated against real execution evidence, reducing the risk of fixes that pass tests by accident but fail in the wild.
Testing and results#
The system was evaluated on Defects4J, a benchmark of real software defects. TraceRepair successfully corrected 392 defects, outperforming existing AI-based repair methods. Additional experiments showed the approach scales efficiently and generalizes well to newly discovered bugs, suggesting improvements come from genuine reasoning about runtime behavior rather than memorization of training data.
Why this matters#
Complex bugs often hide in dynamic behavior—how data flows through a program as it executes. By grounding repair attempts in actual execution traces, this work moves AI-powered debugging from guesswork toward systematic, evidence-based reasoning.

