Runtime-trace collection inside automated program repair
Bug-fixing agents can add a debugging pass before patch generation. The useful change is simple: when a failing test and stack trace do not explain the fault, instrument the suspect function, run the reduced failing test, and feed the runtime state back into the repair loop. DebugRepair reports 295 correct fixes on Defects4J with DeepSeek-V3 and a 51.3% average gain over each backbone model’s vanilla setting across five additional models. The paper also includes two guardrails that matter for production use: it strips the failing test down to the minimal failure-triggering context, and it checks that inserted debug statements do not change the original logic, with an AST-based fallback when LLM-written instrumentation breaks compilation.
This is a concrete build for teams already running automated patch suggestions in CI or issue triage. A cheap first check is to take bugs that your current repair flow marks as unresolved after one or two attempts, then compare plain retrying against a trace-collection step that captures key variable values and branch states before asking for the next patch. The practical payoff is fewer patches that only suppress the visible failure and more patches that address the actual runtime condition behind it.