Manuscript Offprint

arXiv:2610.21514

Poison Valleys: Diagnosing Path-Dependent Failure in LLM Code Repair

Veljko Skarich

Abstract

When code-repair agents fail, final tests reveal that a patch is wrong but not which earlier commitment caused it or which software obligation failed. Poison Valleys traces this path in 1,844 model requests on two synthetic Python cases: PersistQueue adds atomic batch claiming to a disk-backed queue, while Dijkstra adds source-sensitive filtering to shortest-path search. We define plausible but incorrect software mechanisms, place each in a model's hypothesis, implementation plan, or both, and evaluate the generated code with an Oracle and targeted diagnostic coordinates. Moving the misconception from hypothesis to plan increased failure by 32.2% in PersistQueue and 28.9% in Dijkstra after matching the experimental mix. Different misconceptions produced distinct, model-dependent patterns of violated obligations, although several could converge on the same behavior. This creates a measured connection from upstream misconception to code mechanism and failure form. Code, data, and demo: poisonvalleys.org.

1 Introduction

Figure

Figure 1: From a controlled misconception to executable behavior.

A code-repair agent turns a bug report, test output, and repository context into an explanation of the problem, an implementation plan, and finally a patch. A passing test can confirm that the resulting program meets the tested contract. A failing test, however, usually tells us only that the final patch is wrong. It does not identify which earlier commitment caused the failure, how that commitment became an implementation choice about state or control flow, or why two different misconceptions produce different faulty programs. This missing link limits both scientific explanations of agent behavior and attempts to repair it.

Prior work can localize failures within agent trajectories, perturb particular stages, and test whether changing an earlier step improves the outcome [Wang et al., 2026, Jaiswal et al., 2026, Ma et al., 2026, Lin et al., 2026]. We ask the forward question: when a particular software misconception enters at a particular stage, what code mechanism follows, and which executable software obligations break?

We begin with poison families: specific, plausible but incorrect accounts of how the target software works, together with the implementation commitments and executable predictions that follow. We define these families before generation and place one in the model's hypothesis, implementation plan, or both while holding the repair task fixed. We then trace the path from that misconception to generated code and executable behavior under each model configuration. We call these paths Poison Valleys because the supplied misconception can channel repairs toward a structured region of failures rather than merely lowering a single success rate.

Preprint.

We construct two synthetic repair cases on pinned versions of real Python projects. PersistQueue is a disk-backed queue package [Wang, 2025]; our synthetic case adds an atomic batch-claim operation whose failure must restore durable queue state and remain invisible to other connections. NetworkX is a graph-analysis library [Hagberg et al., 2008]; our synthetic Dijkstra case extends its multi-source shortest-path implementation with a filter whose decision depends on the path's original source. Neither case is a recovered historical upstream bug. Both admit locally plausible repairs that violate a nonlocal obligation. For each reconstructed candidate, an Oracle determines success or failure. Independent diagnostic checks then identify which obligations survived, such as rollback, isolation, record identity, route validity, weight correctness, or API compatibility. These checks describe the form of a failure without replacing the Oracle's decision.

The experiment asks three questions. First, does a poison family become more consequential when it moves from a hypothesis into an implementation plan? Second, do different poison families produce different patterns of violated software obligations? Third, does the model and reasoning-effort setting change how strongly these effects appear? Across 1,844 model requests, placing the poison family in the plan increased failure by about 30% relative to placing it only in the hypothesis in both tasks. Poison families also produced measurably different distributions of failed obligations, and the size of the plan effect varied across model configurations.

Poison Valleys maps agent-level concepts to software behavior:

upstream misconception → implementation commitment

→ code mechanism → violated obligation.

The stage identifies where a safeguard can intervene; the violated obligation identifies what it must protect. A follow-up can return a model's own failed candidate with a repair prompt naming the violated obligations and test whether the second candidate passes more checks. Because the original model responses and downstream executable measurements are preserved, the reported analysis can be inspected and replayed without making another model request.

References (46)