Manuscript Offprint

arXiv:2611.06863

Rethinking Self-Repair in Code-as-Policy Agents: What Drives Retry Success?

Siddharth Aphale, Ayushman Singh

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Siddharth Aphale

Stanford University

saphale@stanford.edu

Ayushman Singh

Sesame AI

ayushman@sesame.com

Abstract: Code-as-policy agents often use execution feedback to retry failed programs. Additional sampling and task guidance can also improve success, leaving the contribution of failure-specific feedback unclear. We study this question in simulated robot manipulation. A fixed lookup selects feedback templates using failure labels and the API variant. A frozen code model generates a fresh program after each scene reset. On the same 252 initial failures, Qwen2.5-Coder-7B recovers 85.3% within five retries, compared with 68.3% for resampling with the same retry cap. The advantage persists under fixed total-token budgets. Feedback from other episodes and fixed task guidance yield similar recovery point estimates, with no detected benefit from matching the coarse failure label. In a separate study, a fixed guided prompt used from the first attempt achieves an observed overall success rate similar to that of template-based feedback. Template-based feedback also lowers recovery on a nut-insertion task requiring a rim grasp, consistent with an incompatible center-grasp instruction. Evaluations of robot self-repair should include resampling, mismatched feedback, and concise, task-compatible static guidance as baselines.

Keywords: Code-as-policy agents, Self-repair, Execution feedback, Test-time evaluation

1 Introduction

Code-as-policy agents translate language instructions into executable robot programs [1]. Their failures often follow clear patterns: a program may skip the grasp, release an object after lifting, or place it away from the target. A common response is iterative self-reflection. The model reads its failed program and execution trace, writes a critique, and tries again [2, 3, 4]. Retry success can reflect additional sampling, concise task instructions, feedback about the current failure, or editing the previous program. We ask whether feedback after failure improves recovery over guidance available from the first attempt.

We study this question with frozen Qwen2.5-Coder-3B/7B models in a reset-and-retry setting. Each retry starts from the original scene. Our main conditions generate a fresh program with the failed program omitted from the prompt. We use template-based feedback to study which information improves retry success. A fixed lookup selects instructions using the failure label and API variant, such as “MUST grasp the object before lifting.” We call this condition Compiled. The lookup lets us replace matched feedback with another episode’s feedback, hold the guidance fixed, or remove it while keeping the retry loop unchanged (Figure 1). Separate editing conditions expose the previous program and request a revision. All conditions restart the original scene. We do not test recovery from the physical state left by failure.

Compiled recovers 85.3% of the 252 initial failures within five retries, compared with 68.3% for resampling with the same retry cap. The gain persists under fixed total-token budgets. Feedback from other episodes and one fixed template per task produce similar point estimates. We detect no benefit

Workshop on Robot Learning at Deployment (Learn@Deploy), CoRL 2026.

Figure

Figure 1: Template-based feedback improves recovery over resampling. (a) Reset-and-retry loop and feedback methods. (b) Recovery on 252 initial failures, with similar outcomes for Compiled, Different-Label Feedback, and Fixed Task Template.

from matching the coarse failure label to the current episode. The confidence intervals still allow differences between conditions. In a separate study, a fixed guided prompt used from the first attempt achieves an observed overall success rate similar to Compiled's, with fewer tokens per solved episode. That comparison changes initial guidance and the generation instruction together. Their individual contributions remain unresolved.

We compare feedback content and program-generation strategies under matched retry budgets to test how additional sampling, reusable task guidance, and failure-label matching affect recovery. Evaluations of robot self-repair should include static guidance as a baseline for adaptive feedback.

References (24)