Skip to main content

Agent / Code / Evaluation

Fail-Fast, Restart-Smart: Early Failure Prediction and Restart for SWE Agentic Tasks

Chenyu Wang, Yunbo Lyu, Junda He, Zhou Yang, Chenxing Zhong, Yaniv Harel

arXiv:2608.03222

Fail-Fast, Restart-Smart: Early Failure Prediction and Restart for SWE Agentic Tasks

Authors: Chenyu Wang, Yunbo Lyu, Junda He, Zhou Yang, Chenxing Zhong, Yaniv Harel

arXiv ID: 2608.03222

Problem: SWE agents resolve repository-level issues through long trajectories that grow increasingly expensive as context accumulates, and failed runs tend to be longer and full of redundant exploration or looping. Early termination risks interrupting trajectories that would otherwise succeed, while an unsuccessful trajectory may still contain useful repository edits. Is failure predictable from the observable trajectory prefix alone, and can a restart beat both running-to-completion and cold restart?

Key Methodology:

  • FailFast: a lightweight 0.6B monitor trained with terminal plus dense fail-to-pass supervision, predicting failure from observable action prefixes only (no policy logits, no hidden states)
  • RestartSmart: on alarm, launches a fresh same-policy rollout with no prior prompt history, offering the interrupted repository diff as an optional overlay the agent may inspect, apply, or discard
  • A two-stage controller wrapped around a single active trajectory, evaluated on SWE-bench Verified against cold restart and a per-step AgentStop adaptation baseline

Key Results:

  • A monitor trained solely on Qwen3.6-27B trajectories transfers to three other policies, including a closed-API model, saving 14.6%-20.4% of execution tokens at a target 5% false-positive rate
  • On Qwen3.6-27B the 20.4% saving exceeds the 12.5% achieved by the per-step AgentStop adaptation
  • At a target 25% false-positive rate, RestartSmart raises Qwen3.6-27B resolution from 66.6% to 71.8%, whereas cold restart reaches only 66.8%
  • The interrupted-diff overlay is what makes early termination lossless: the partial repository state is offered back rather than discarded

What it means for developers: Failed trajectories can be detected cheaply mid-run and abandoned without losing the partial work. The monitor needs no access to policy internals (no logits, no hidden states) and transfers across models, so one cheap monitor can gate many policies in a fleet; for budget-metered agent runs, the 14.6-20.4% token saving is a placement win with no model changes, and the restart-with-salvage shape is a concrete pattern for harness builders: terminate early, restart fresh, hand the interrupted diff back.

Paper: arXiv:2608.03222