Manuscript Offprint

arXiv:2610.35971

Continue or Restart? The Limits of Early Failure Prediction in Coding Agents

Srinath Srinivasan, Lunxiao Li, Tim Menzies, Wesley Assunção

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

Srinath Srinivasan

NC State University

Raleigh, NC, USA

ssrini27@ncsu.edu

Lunxiao Li

NC State University

Raleigh, NC, USA

lli66@ncsu.edu

Tim Menzies

NC State University

Raleigh, NC, USA

timm@ieee.org

Wesley Assunção

NC State University

Raleigh, NC, USA

wguezas@ncsu.edu

Abstract—Early stopping promises to reduce the computational cost of autonomous coding agents by terminating unpromising runs before completion. Evaluating when to abandon an active run, however, requires separating the baseline difficulty of a software issue from the trajectory of an individual attempt. We study this distinction across 147,002 execution traces from two public corpora spanning four model-framework settings. Comparing pre-execution issue context against early execution prefixes, we evaluate linear count models, initial-turn text embeddings, task-conditional rankers, and a fine-tuned Qwen3-0.6B monitor. Although early prefixes modestly improve cross-task outcome ranking, within-task discrimination remains near chance across early landmarks (5k-20k tokens): initial-turn embeddings and 20k-token task-conditional models yield AUCs around 0.50, and three-seed neural evaluations across 32,406 attempts at 20k tokens achieve a mean within-task AUC of 0.50 [0.48, 0.51] across tasks of varying solve rates. To evaluate how these predictions translate into stopping decisions, we replay score-guided and matched random restarts under shared token budgets alongside uninterrupted continuation. Under a 75k-token cap, learned restarting improves resolution over matched random restarting by up to 1.98 percentage points. An exact algebraic decomposition resolves this paradox: the gain over random restarting stems almost entirely from between-task stopping allocation (avoiding stops on easy issues), whereas attempt-level selection within a task contributes near zero (-0.11 to +0.24 percentage points). Across all four settings at the 75k cap (and 216 of 224 tested budget-threshold configurations overall), uninterrupted continuation achieves higher solve rates at lower mean token cost than both restart policies. Practical evaluations of early stopping must therefore establish attempt-level discrimination and demonstrate net compute savings relative to continuation.

Index Terms—coding agents, early failure prediction, early stopping, restart policies, mining execution traces, empirical study

I. INTRODUCTION

Consider a coding agent that has consumed 20,000 (20k) transcript tokens investigating a repository issue. By this point, the agent has inspected repository files and invoked initial test or edit commands, yet whether its trajectory will ultimately resolve the issue remains unknown. Suppose a failure monitor assigns the active attempt a low probability of success. Under a 75,000 (75k) token budget, aborting the run to start a fresh attempt leaves only 55k tokens for the replacement and discards all prior repository exploration. Whenever an aborted run would have succeeded within the full budget, or whenever its replacement exhausts the residual 55k budget before finishing, restarting degrades overall resolution. Evaluating early stopping therefore requires determining whether early trajectory signals justify abandoning an active attempt.

Autonomous coding agents pair language models with execution scaffolds to navigate codebases, modify source files, and run verification tests [1]–[3]. Throughout this study, a task denotes a repository issue, and a run (or attempt) denotes a single execution trajectory on that task. At any decision landmark, the prefix comprises the interaction sequence of assistant turns and tool observations recorded up to that transcript-token count, prior to final patch evaluation.

Evaluating early failure predictors presents two methodological challenges. First, baseline task solvability confounds attempt-level progress. If an agent consistently resolves one issue and fails another, a monitor that estimates static task difficulty will achieve strong corpus-wide ranking even if it assigns identical scores to every attempt on the same issue. We therefore separate pooled prediction, which ranks outcomes across all eligible runs, from within-task discrimination, which compares successful and failed attempts on the exact same task using area under the ROC curve (AUC within_{within}, where 0.50 indicates random ranking).

Second, predictive ranking does not directly establish the resource efficiency of a stopping policy. Mid-execution interventions can follow two distinct regimes: abort-only termination, which abandons low-scoring runs without replacement to save tokens at the expense of forfeiting any late resolutions, and restart-based stopping, which terminates a stalled attempt to reallocate the remaining budget to a fresh attempt on the same issue. If an early monitor captures only static issue difficulty (AUC within_{within} ≈\approx 0.50), abort-only termination at 20k tokens merely executes a delayed task filter after burning 20k tokens (which is strictly dominated by pre-execution filtering at zero token cost), so we focus our policy evaluation on whether trajectory-based stopping improves resolution via cold restarts. Aborting an active run to restart improves outcomes only when a replacement attempt is more likely to solve the task within the residual budget than the original run is via continuation. Stopping rules must therefore be evaluated against both matched random restarting (aborting the same fraction of active runs without using predictions) and uninterrupted continuation under a shared token cap.

While prior work proposes monitors based on token prob-abilities, behavioral states, internal activations, and state-preserving recovery [4]–[7], recent studies show that task identity confounds pooled trajectory metrics [8], [9] and that continuation often outperforms cold restarts in mathematical reasoning [10]. However, prior work has not tested whether task-conditional training or end-to-end neural monitors recover attempt-level signal, nor explained why score-guided policies still beat random restarts in replay. We mine 147,002 released execution traces from Nebius SWE-rebench and NVIDIA Open-SWE-Traces [11], [12] across four model-framework combinations (settings). Across landmarks from 5k to 60k tokens (focusing on 20k, where nearly all runs remain active), we compare pre-execution issue features against early prefixes using action-count regressions, frozen text embeddings, task-conditional rankers, and a fine-tuned Qwen3-0.6B monitor adapted from prior work [7]. Using recorded-attempt replay under shared token caps, we answer three research questions:

RQ1. How much does observing an early execution prefix improve outcome prediction beyond pre-execution task context?

RQ2. Do early execution prefixes distinguish successful from failed attempts on the same task?

RQ3. What drives the performance difference between learned and random restarting, and how do both policies compare with uninterrupted continuation under a shared token budget?

Across all four settings, we make three main contributions. First, we show via unseen-repository cross-validation, permutation controls, and equivalence testing (TOST) that while static context supports cross-task ranking, early prefixes yield near-chance within-task discrimination (AUC within_{within} ≈\approx 0.50) across 5k embeddings as well as 20k count models, task-conditional rankers, and the three-seed neural monitor, even though 87.51% of primary-corpus runs have already invoked tests and 32.80% have edited code by 20k tokens. Second, in budget-constrained replay under a 75k cap, we derive an exact decomposition proving that learned stopping's gain over matched random restarting (up to 1.98 percentage points) stems from between-task stopping allocation rather than within-task attempt selection. Third, we show across 224 budget-threshold configurations that uninterrupted continuation achieves higher solve rates at lower mean token cost than both restart policies across the 75k and 100k frontiers (111 of 112 configurations, and 216 of 224 overall).

References (40)