Papers
Topics
Authors
Recent
Search
2000 character limit reached

Diagnosis-Guided Repair in Automated Systems

Updated 4 July 2026
  • Diagnosis-guided repair is a methodology that uses explicit diagnostics like runtime traces, compiler messages, and telemetry to constrain and validate repair interventions.
  • It employs a staged pipeline that localizes failures, applies constrained repair strategies, and re-verifies outcomes across various domains such as software, networks, and optimization.
  • Empirical studies demonstrate enhanced repair accuracy and reduced recomputation, underscoring the method's practical impact in fields like automated program repair and agentic reasoning.

Diagnosis-guided repair is a family of methods in which repair is conditioned on explicit diagnostic evidence rather than inferred from a failure symptom alone. Across automated program repair, agentic retrieval-augmented generation, optimization, formal verification, deep learning debugging, database and data cleaning, network troubleshooting, and cyber-physical synthesis, the shared premise is that failure analysis should constrain what counts as a valid intervention. In this view, runtime traces, compiler and test diagnostics, irreducible infeasible subsystem certificates, counterexamples, coverage-gated trajectory diagnoses, telemetry bundles, and device-level observations are not auxiliary hints but first-class objects that shape generation, ranking, and validation of repairs (Wu et al., 3 Apr 2026, Jiao et al., 1 Apr 2026, Ye et al., 2022).

1. Concept and scope

The term spans several distinct but structurally related research traditions. In automated program repair, diagnosis-guided repair means conditioning patch generation on runtime evidence, compiler diagnostics, test execution diagnostics, or live debugger context rather than on source code and test outcomes alone. TraceRepair defines it as using runtime diagnostic evidence—fine-grained execution traces, variable snapshots, and dynamic data dependencies—as hard constraints for patch generation and validation (Wu et al., 3 Apr 2026). SelfAPR defines a related variant in which repair is modeled as pθ(yx,d)p_\theta(y \mid x,d), where the diagnostic sequence dd contains failure type and context extracted from compilation and test execution (Ye et al., 2022). ROSE moves the same principle into interactive debugging by treating the suspended debugger state and a concise developer description of “what is wrong” as the diagnosis that guides localization and validation (Reiss et al., 2022).

Outside program repair, the same idea appears with different observables and repair actions. Doctor-RAG separates trajectory-level failure diagnosis from local repair in agentic RAG, preserving validated reasoning prefixes and intervening only at the earliest localized failure point (Jiao et al., 1 Apr 2026). PROBE transforms failed-run telemetry into structured evidence, structured diagnosis, and bounded recovery guidance for a subsequent attempt, and explicitly frames the diagnosis–recovery gap as the central systems problem (Zhao et al., 9 May 2026). In optimization, OptiRepair uses solver diagnostics, especially irreducible infeasible subsystem certificates, to localize infeasibility and then subjects repaired models to domain-specific rationality checks (Ao et al., 23 Feb 2026). In neural network safety, SpecRepair uses counterexamples from formal specification checking as diagnoses of safety violations and retrains against them while preserving task performance (Bauer-Marquart et al., 2021).

Earlier work established closely related foundations. Guided Data Repair ranks candidate data repairs by value of information and active learning, thereby using violation structure to prioritize which updates should be confirmed by users (Yakout et al., 2011). Decision-theoretic troubleshooting and hierarchical model-based diagnosis formulate repair as an expected-cost policy problem under probabilistic beliefs about component failures (Breese et al., 2013, Srinivas, 2013, Srinivas et al., 2013). In database theory, causality, consistency-based diagnosis, and denial-constraint repair are linked through diagnoses that explain why a query answer or constraint violation occurs and thereby determine tuple deletions (Salimi et al., 2014). For controller synthesis from Signal Temporal Logic, infeasible mixed-integer linear programs are diagnosed through irreducible infeasible subsystems and repaired through minimal predicate or interval changes (Ghosh et al., 2016). This breadth indicates that diagnosis-guided repair is best understood as a general design principle rather than a domain-specific technique.

2. Formal and algorithmic structure

A recurring pattern is a staged pipeline in which diagnosis is explicitly represented, localized, and then coupled to repair. In SelfAPR, this takes the form of conditional generation, with diagnostic tokens concatenated to static code context so that the decoder can condition on exception types, compiler messages, assertion messages, and failing test identifiers (Ye et al., 2022). In TraceRepair, the central correctness condition is that a patched program PP' must satisfy both the test suite and a trace-derived constraint set CC, written as PCP' \models C and tT:pass(P,t)\forall t \in T: pass(P', t); runtime facts thus become objective repair constraints rather than additional prompt text (Wu et al., 3 Apr 2026). In Doctor-RAG, a failed trajectory T={(si,ei)}i=1LT=\{(s_i,e_i)\}_{i=1}^L is diagnosed through a coverage gate and a per-step diagnostic score, and the earliest failure point is localized by

k=argmin{i[1,L]:Gi<τ or Si<γ},k=\arg\min \{\, i \in [1,L] : G_i < \tau \text{ or } S_i < \gamma \,\},

after which only the suffix from kk onward is recomputed (Jiao et al., 1 Apr 2026).

The same decomposition appears in telemetry-centered agent recovery. PROBE formalizes a failed run as a telemetry bundle

T={Tmetrics,Tlogs,Ttraces,Tintent,Tenv,Toutcome},\mathcal{T}=\{T_{\text{metrics}},T_{\text{logs}},T_{\text{traces}},T_{\text{intent}},T_{\text{env}},T_{\text{outcome}}\},

and a recovery pipeline

dd0

where dd1 is structured evidence, dd2 is structured diagnosis, and dd3 is bounded recovery guidance (Zhao et al., 9 May 2026). The paper’s guidance gate is noteworthy because it makes grounding, actionability, and scope explicit preconditions for emitting repair instructions.

Formal methods-oriented systems instantiate the same logic with different evidence and verification oracles. Faithful autoformalization via roundtrip verification generates an initial formalization dd4, back-translates to natural language dd5, re-formalizes to dd6, and uses satisfiability of dd7 to diagnose semantic drift and select a stage-local repair operator (Amrollahi et al., 27 Apr 2026). SpecRepair maps formal safety specifications to a satisfaction function dd8 and treats negative values as counterexamples that drive penalized retraining (Bauer-Marquart et al., 2021). CTL-guided program repair encodes CTL properties and programs in stratified Datalog, diagnoses violations through counterexample lassos and missing facts or transitions, and repairs by modifying encoded program facts until the analysis succeeds (Liu et al., 21 Feb 2025).

The common algorithmic loop is therefore not merely diagnose-then-fix, but diagnose, localize, constrain, repair, and re-verify. What changes across domains is the nature of the diagnostic object: traces, conflicts, counterexamples, IIS certificates, telemetry anchors, or probabilistic beliefs.

3. Representative instantiations across domains

The diagnostic object determines both repair search space and validation mechanism. In program repair, dynamic evidence is often used either as a hard filter or as an explicit conditioning variable. TraceRepair combines a Probe Agent with Defensive, Causal, and Semantic repair agents plus a Judge Agent; candidate patches are critiqued against runtime constraints, and proposals that contradict observed branch decisions or state transitions are discarded (Wu et al., 3 Apr 2026). SelfAPR instead learns from project-specific perturbations, compilation diagnostics, and test execution diagnostics, while ROSE uses backward dynamic slicing and comparative execution under the current debugger context to produce quick semantic repairs (Ye et al., 2022, Reiss et al., 2022).

In agentic reasoning systems, the repair granularity shifts from code edits to trajectory edits. Doctor-RAG diagnoses the earliest failing reasoning or retrieval step and preserves the validated prefix and cached evidence, which prevents rerunning the entire retrieval-reasoning pipeline (Jiao et al., 1 Apr 2026). PROBE similarly keeps the failed run intact as evidence, but its output is not a repaired trajectory; it is bounded recovery guidance specifying a target, an operation, a verification signal, and a boundary condition for the next attempt (Zhao et al., 9 May 2026). "Diagnosis Is Not Prescription" adds a cautionary variant: causal diagnosis may identify the Router module as the primary bottleneck, yet patching that module with correction examples can degrade performance because downstream modules have co-adapted to its error distribution (Jeonghun et al., 21 May 2026).

In optimization and synthesis, diagnosis-guided repair is tightly coupled to solver artifacts. OptiRepair uses IIS certificates to localize infeasibility in supply-chain linear programs, then iterates between feasibility repair and a RationalityOracle enforcing five operational checks: base-stock structure, bullwhip bounds, inventory allocation, cost consistency, and order smoothing (Ao et al., 23 Feb 2026). Diagnosis and repair for STL synthesis uses mixed-integer infeasibility explanations to locate conflicting subformulas, windows, and predicates, then computes minimal repairs that restore realizability (Ghosh et al., 2016). In network diagnosis, NetDx formalizes correct forwarding and routing behavior, treats failures as negations of that model, and uses trace bits, counters, table snapshots, and protocol observations to identify the first divergence between observed behavior and model prediction, thereby localizing the faulty switch or link (Wu et al., 29 Jun 2025).

The diversity of domains is usefully summarized as follows.

Domain Diagnostic evidence Repair mechanism
Program repair Execution traces, compiler/test diagnostics, debugger context Constraint-guided patching, conditional generation, quick semantic edits
Agentic reasoning Trajectory coverage, telemetry, module-level causal diagnosis Prefix reuse, bounded recovery guidance, selective module intervention
Optimization and synthesis IIS certificates, MILP infeasibility, formal counterexamples Minimal constraint edits, feasibility repair, stage-local or predicate-level repair
Data, networks, and devices Constraint violations, packet-routing divergences, component failure beliefs VOI-guided updates, root-cause isolation, expected-cost repair sequencing

This suggests that diagnosis-guided repair is less about a single model family than about preserving causal structure between failure evidence and intervention scope.

4. Empirical performance and operational effects

The literature reports substantial gains when diagnosis is used to constrain repair rather than merely describe failure. On Defects4J, TraceRepair correctly fixes 392 defects—217 on v1.2 and 175 on v2.0—and under Method-Level Fault Localization its DeepSeek-V3.2 variant drops only from 177 to 171 correct fixes, a dd9 change (Wu et al., 3 Apr 2026). SelfAPR, evaluated on 818 Defects4J bugs, correctly repairs 110 and outperforms supervised learning repair approaches in that setting (Ye et al., 2022). For deep learning programs, DeepDiagnosis reports 46 identified bugs, 34 localized faults, 37 failure symptoms, and 28 location-specific fixes on the 53-model SGS benchmark, while also covering non-numerical training pathologies that DeepLocalize does not target (Wardat et al., 2021).

In agentic reasoning, Doctor-RAG reports, for Qwen3-8B with ReAct on HotpotQA, PP'0EM PP'1, PP'2F1 PP'3, and PP'4ROUGE-L PP'5 with 5,261 tokens, compared with 8,113 for rerun, 9,927 for step-wise retry, and 15,610 for RAG-Critic (Jiao et al., 1 Apr 2026). PROBE, evaluated on 257 initially unresolved cases across repository-level repair, enterprise workflow recovery, and AIOps mitigation, achieves 65.37% Top-1 diagnosis accuracy and a 21.79% recovery rate, outperforming the strongest non-PROBE baseline by 43.58 and 12.45 percentage points (Zhao et al., 9 May 2026). In autoformalization, diagnosis-guided repair raises formal equivalence from 44.7% to 85.3% for Claude and from 61.3% to 82.7% for GPT, outperforming a random-repair baseline in both cases (Amrollahi et al., 27 Apr 2026).

Optimization and systems diagnosis show the same pattern. OptiRepair’s trained Qwen3-8B pipeline reaches 81.7% Rational Recovery Rate, versus 42.2% for the best API model and 21.3% on average, with the gap concentrated in Phase 1 IIS-guided repair (Ao et al., 23 Feb 2026). NetDx diagnoses 100% of injected faults correctly in its automated fault-injection campaign and diagnoses 30 of 33 cloud-provider faults within its intended scope in seconds instead of hours (Wu et al., 29 Jun 2025). In safety-critical neural networks, SpecRepair achieves 28 successes, 0 fails, 2 unknowns, and 6 timeouts on ACAS Xu while preserving a median post-repair test accuracy of 99.5% (Bauer-Marquart et al., 2021).

These results do not imply a single dominant mechanism. Some gains come from dynamic state information, some from better localization, some from stronger verification, and some from reducing wasted recomputation. The shared empirical pattern is that repair quality improves when the diagnostic channel is specific enough to constrain the intervention.

5. Limits, misconceptions, and failure modes

A central misconception is that accurate diagnosis automatically identifies the correct intervention point. "Diagnosis Is Not Prescription" explicitly rejects that inference: across three multi-module LLM agent families, causal analysis consistently identifies the Router as the primary bottleneck, yet injecting counterfactual correction examples into that module harms or fails to help, whereas patching the upstream Query Rewrite module improves outcomes (Jeonghun et al., 21 May 2026). The paper attributes this asymmetry to linguistic co-adaptation, operationalized through a compensator-rate measure derived from the Natural Indirect Effect.

A related systems-level limitation is the diagnosis–recovery gap. PROBE shows that accurate diagnosis is necessary but insufficient unless converted into bounded guidance that a subsequent attempt can execute and verify under the same tools, evaluator, and budget (Zhao et al., 9 May 2026). This is closely related to stage mislocalization in Doctor-RAG, where threshold sensitivity in PP'6 and PP'7 can misidentify the earliest failure point and thereby make local repair ineffective (Jiao et al., 1 Apr 2026). In TraceRepair, insufficient instrumentation coverage, non-determinism, flakiness, performance overhead from repeated execution, and deep interprocedural dependencies can weaken constraint quality or dominate runtime (Wu et al., 3 Apr 2026).

Formal methods variants have domain-specific limits. Roundtrip autoformalization can converge to an incorrect fixed point, so formal equivalence is necessary but not sufficient for faithfulness; schema gaps and missing predicates remain a primary bottleneck (Amrollahi et al., 27 Apr 2026). OptiRepair distinguishes feasibility from rationality and shows that a solver-feasible fix can still violate supply-chain theory unless checked against explicit rationality predicates (Ao et al., 23 Feb 2026). SelfAPR remains limited by test quality, diagnostic coverage, and the difficulty of multi-location bugs, while CTL-guided repair can return "Unknown" when loop summarization based on linear ranking functions is inconclusive (Ye et al., 2022, Liu et al., 21 Feb 2025).

Older decision-theoretic and hierarchical diagnosis frameworks highlight another enduring limitation: exact optimal repair planning is often intractable without strong structural assumptions such as independence, hierarchy, or bounded branching factor (Srinivas, 2013, Srinivas et al., 2013). Diagnosis-guided repair repeatedly narrows this complexity, but it does not eliminate it.

6. Broader significance and future directions

Across the surveyed work, diagnosis-guided repair shifts reliability engineering from symptom-driven search to evidence-grounded intervention. In software repair, this reduces coincidental correctness by requiring candidate patches to satisfy runtime constraints, behavioral specifications, or richer validation oracles (Wu et al., 3 Apr 2026, Liu et al., 21 Feb 2025). In agentic systems, it reduces wasted recomputation through prefix reuse and bounded guidance (Jiao et al., 1 Apr 2026, Zhao et al., 9 May 2026). In optimization and control, it makes infeasibility or unrealizability interpretable and repairable through certificates and minimal relaxations (Ao et al., 23 Feb 2026, Ghosh et al., 2016). In network and device diagnosis, it turns end-to-end symptoms into root-cause localization fast enough to alter repair service-level objectives (Wu et al., 29 Jun 2025, Breese et al., 2013).

Several trajectories recur in the cited work. One is richer diagnosis: adaptive probing, statistical filtering for flaky traces, solver counterexample integration, hybrid dynamic-static analyses, learned invariant mining, and calibrated confidence for guidance gating are all proposed extensions (Wu et al., 3 Apr 2026, Amrollahi et al., 27 Apr 2026, Zhao et al., 9 May 2026). Another is broader verification: rationality oracles beyond feasibility, independent semantic checks beyond test suites, and stronger equivalence or contract checking continue to appear as safeguards against overfitting and brittle fixes (Ao et al., 23 Feb 2026, Ye et al., 2022). A third is scope expansion: broader repository-level repair, security-oriented traces, MIP and NLP repair, and cross-domain formalism-agnostic verification are identified as natural next steps (Wu et al., 3 Apr 2026, Ao et al., 23 Feb 2026, Amrollahi et al., 27 Apr 2026).

Taken together, the literature portrays diagnosis-guided repair not as a narrow debugging tactic but as a general architecture for trustworthy intervention under uncertainty. The defining move is consistent across domains: failures are first rendered into structured, localized evidence, and only then translated into constrained repair actions whose validity is checked against the same diagnostic object that motivated them.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (18)
8.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Diagnosis-Guided Repair.