Manuscript Offprint

arXiv:2610.31276

RIPPLE: Recovery Internalization through Process-Level Policy Learning and Effect-Aware Credit for Long-Horizon Agentic Coding

Jingxuan Xu, Zihang Xu, Yuechen Luo, Ziqi Miao, Wenqiang Zhu, Weihao Li, Junhao Fan, Xinshun Feng, Zhiyi Lai, Yanan Wu, Haoyang Huang, Ken Deng

Abstract

Long-horizon coding agents can observe a failure and generate a plausible critique yet continue along the same incorrect trajectory. We call this the Critique-to-Action Handoff Gap. We introduce RIPPLE, a recovery-oriented training framework that internalizes process-level guidance into a single self-recovering policy. A prefix-only teacher provides evidence-grounded recovery supervision without access to future actions or terminal outcomes. After lightweight distillation, reinforcement learning assigns stage-specific credit to reflection triggering, diagnosis, and corrective action. Local validity signals gate trajectory advantages so that intermediate recovery decisions do not indiscriminately inherit terminal outcomes. Across four repository-level software-engineering benchmarks, RIPPLE improves the base policy by an arithmetic mean of 4.8 score points, with no auxiliary critic at deployment. Controlled ablations isolate the benefits of local, stage-aligned credit, and matched-prefix interventions show that critique semantics affect subsequent correction. Recovery gains concentrate where the prefix contains sufficient diagnostic evidence and the repository state remains reversible within the remaining budget.

1 Introduction

Large language model-based coding agents now explore repositories, edit files, execute tests, and revise their behavior using environmental feedback. Repository-level benchmarks and agent frameworks enable these capabilities over long trajectories in realistic software environments (Jimenez

Figure

Figure 1: The critique-to-action handoff gap. Failure feedback may elicit an evidence-grounded critique without changing subsequent behavior (left). RIPPLE learns a recovery policy over reflection triggering, diagnosis, and corrective action (right).

et al., 2024; Yang et al., 2024; Pan et al., 2024; Wei et al., 2025; Golubev et al., 2025; Ding and Zhang, 2026). However, observing feedback does not necessarily imply using it effectively. When a test invalidates an earlier assumption, an agent may continue editing in the same incorrect direction, repeatedly inspect irrelevant files, or fail to revise its plan (Zhao et al., 2026; Li et al., 2026a). Although modern agents can close the action–observation loop, reliable recovery from trajectory deviations remains challenging.

Reflection and critique provide a natural mechanism for addressing these failures. Self-generated feedback, verbal memory, tool-assisted critique, and execution-based debugging can improve model outputs (Madaan et al., 2023; Shinn et al., 2023; Gou et al., 2024; Chen et al., 2023). Recent approaches further train self-correction through supervised learning and reinforcement learning (RL) (Kumar et al., 2024; Yuan et al., 2025; Jin et al.,

  • Equal contribution.

†^{\dagger} Corresponding author.

2025; Jiang et al., 2026; Lin et al., 2026). However, improved task performance does not establish that a critique guides the next action (Shinn et al., 2023; Zhao et al., 2026). As Figure 1 illustrates, an agent may correctly identify a failure yet take a follow-up action inconsistent with its diagnosis. We refer to this discrepancy as the Critique-to-Action Handoff Gap: an evidence-grounded critique remains behaviorally inert instead of inducing an effective corrective change.

This gap exposes a mismatch between the functional structure of recovery and existing training objectives. Critique imitation supervises what the model says about a failure, without establishing whether subsequent actions implement its diagnosis. Terminal rewards supervise trajectory success, but cannot isolate whether reflection was triggered appropriately, the diagnosis was correct, or the corrective action was effective. Process supervision and credit-assignment methods provide finer-grained signals (Lightman et al., 2023; Ekbote et al., 2025; Guo et al., 2026), but generally assess intermediate reasoning or redistribute trajectory outcomes rather than separately optimize the functional stages of recovery. Addressing the handoff gap requires jointly learning when to initiate recovery, which diagnosis the evidence supports, and how it should alter subsequent behavior.

We propose RIPPLE, a recovery-oriented training framework for long-horizon coding agents. A trajectory-prefix-conditioned teacher supplies recovery boundaries and reference critiques using only information available at each decision point. Lightweight distillation initializes task execution and interleaved reflection. Recovery-oriented RL then decomposes recovery into reflection triggering, evidence-grounded diagnosis, and corrective action, assigning a distinct process signal to each stage. An executable verifier supervises task correctness, while local validity gates determine whether each recovery span inherits positive or negative trajectory advantage. This design targets the functional contribution of intermediate decisions rather than their co-occurrence with successful trajectories. All auxiliary supervision is confined to training, leaving a single self-recovering policy at inference.

Experiments show an arithmetic mean improvement of 4.8 points across four software-engineering benchmarks without an online critic. Ablations and matched-prefix interventions assess the functional contribution of recovery. Our contributions are:

• Critique-to-action recovery formulation. We identify the handoff gap and formulate recovery as an interleaved policy that coordinates when to reflect, what to diagnose, and how to correct subsequent behavior.

• Stage-specific recovery optimization. We combine prefix-only supervision with effect-aware credit for triggering, diagnosis, and corrective action while retaining terminal supervision over task completion.

• Mechanism-grounded empirical evaluation. End-to-end comparisons, credit-assignment ablations, and matched-prefix interventions assess issue resolution and the functional contribution of critiques, including the evidence and repository-state conditions under which recovery remains effective.

References (47)