Paper commentary
Done, But Still Working: Anytime Evaluation of When Coding Agents Should Stop
- Problem Coding agents often keep working after their own tests pass, and a final-patch score cannot show whether that later work improved the patch or how much it cost.
- Method Recorded runs are replayed in a sandbox, each distinct intermediate patch is scored with hidden tests, and cumulative inference cost is attached to every command, so stopping rules can be compared on the same runs.
- Results The twice-passed rule saved 22.8% of cost at -1.0 points of resolution on 386 new runs of Qwen3.6-27B in mini-SWE-agent.

Figure 2 : Anytime evaluation turns recorded commands into a patch-and-cost record. We recover intermediate patch states, score distinct patches with hidden tests offline, and align their scores with cumulative costs. The illustrative ledger contains four observations of two patches: repeated states reuse a score while cost continues to accumulate. Hidden-test results never enter the agent’s input; interventions that change its behavior require new runs.
Original paper · CC BY 4.0 · Yang, Zerui, Xue, Quan, Dong, Miaomiao, Zhang, Chaorui, Zheng, Xuanyu, Wang, Xiyuan, Ruan, Haolin, Niu, Xueyan, Song, Guangcheng, Zhang, Weixi, Han, Wei, Bai, Bo · Done, But Still Working: Anytime Evaluation of When Coding Agents Should Stop · Original paper figure · Extracted the figure area from page 5 of the original PDF.Why a final score hides when the work was done
Coding agents do not stop as soon as their first test passes. They may run further tests, revise the patch or clean up, and each of these steps adds inference cost. A score on the final patch shows whether the run ended correctly, but not whether an earlier patch was already correct. It therefore cannot say when the solution appeared or how much work followed it.
The study asks three questions: how much an agent spends after its tests pass, when that spending improves the final patch, and whether an agent can stop earlier without giving up those improvements.
Changes to the agent itself, such as fine-tuning, alter the prefix and still need new runs.
Replaying runs into a per-prefix record
The replay resets the repository to the task's base commit inside the sandbox, then runs the logged commands one after another without any model call, saving the patch after every step. Each distinct non-empty patch is scored once with the task's hidden tests, FAIL_TO_PASS and PASS_TO_PASS, applied as in SWE-bench. The score is then attached to each command that produced that patch.
Repeated states reuse one score while their cost keeps accumulating, so the record aligns every observed state with the spending up to that point.
The cost up to command k adds uncached prompt tokens, cached prompt tokens weighted by c, and output tokens weighted by p, summed over the requests up to the one that issued that command. The study reports c at 0.1 and 1, with p = 4. Cached tokens count only when the run's own previous request could have supplied them, which limits credit for cache reuse coming from concurrent runs.
This end-state agreement does not by itself verify every intermediate patch or test outcome.
The primary reanalysis uses D', a narrow correction of the recorded tracked-file diff D. When D is empty but the full recorded diff contains tracked-file changes, those changes are used and the affected prefixes are replayed against the base commit. Partially staged non-empty diffs stay uncorrected. The earlier official scores were computed from D, and the official mini-SWE-agent protocol grades the patch file the agent writes at submission, which this reanalysis does not reproduce.
When an old run can answer a stopping question
A stop-and-select policy ends a run after command tau and submits one of the patches already produced, sigma no later than tau. It is prefix-measurable when both decisions depend only on the agent's observations up to that point. Running to the end is the special case where tau and sigma both equal T.
Proposition 1 gives the condition under which such a policy can be evaluated exactly. If the record keeps every observation, patch state and token count that the policy and the evaluator use, and the policy changes nothing except when the run ends and which patch is chosen, then the submitted patch and cost have the same joint distribution as values computed from a recorded run.
Population estimates still carry sampling error, and choosing a policy on the same evaluation runs can overfit.
Two oracles that read the hidden tests bound what a prefix-measurable rule can reach. Opass picks, run by run, the earliest passing self-test whose patch passes the hidden tests, falling back to the cheapest option otherwise; Oany extends the same choice to every command. Neither oracle resolves less than running to the end, and any rule that stops or selects at passing self-tests is bounded by Opass.
What the stopping and selection rules see
A command counts as a self-test when it runs the repository's test entry point while the patch is non-empty. It passes when its output reports passed tests and no failure.
The first-pass rule submits at the first passing self-test. The twice-passed rule waits for a passing self-test whose patch equals the patch at the previous passing self-test, so the agent reran its tests without editing. Requiring j passes on one patch defines a family indexed by j.
Step caps, stability rules and a learned policy serve as baselines.
Why stopping loses quality: firing, change and repair
Averaged over runs, this change factors into three quantities, which the authors write as the exact decomposition below.
\[ \Delta Q = -\, r \cdot u \cdot \delta \] The saving cost_T minus cost_tau is never negative, and the identity holds on the scored records; reading it as an online effect requires the assumptions of Proposition 1.
Only delta needs hidden tests, while r, u and the saving can be read from unlabelled runs of a new agent.
For Qwen3-Coder, Gemma-4 and GLM-4.7-Flash the firing share is at most 6%, so the rules have little to act on.
The authors report that this difference is not significant, that the prediction fails for DeepSeek-V4-Flash, and that under D the verdict reverses, so the prediction is exploratory.
How much stopping saves and what it costs in resolution
DeepSeek-V4-Flash and Qwen3.8-27B spend about 40% of their cost after a first pass, in 41% and 46% of runs where one occurs.
Opass, the hindsight bound that reads the hidden tests, saves 57% of cost for Qwen3.6-27B in SWE-agent and 25% in mini-SWE-agent. It saves 17-19% for Qwen3.8-27B and DeepSeek-V4-Flash, 8% for Qwen3.5-9B and at most 5% for models that rarely see their tests pass.
The twice-passed rule captures 68-77% of the Opass bound for Qwen3.6, Qwen3.8 and DeepSeek in mini-SWE-agent, and 95% in SWE-agent, where it sits 4.4 points below the bound.
For Qwen3.6 in mini-SWE-agent, the standard error of the twice-passed effect is 0.40 offline and 2.68 online, a factor of 45.6 in tasks saved.
In the preregistered replication on 386 new runs, the twice-passed rule saved 22.8% of cost at -1.0 points of resolution for Qwen3.6-27B in mini-SWE-agent. First-pass stopping saved 24 to 31% of cost but lost up to 3.9 points across the evaluated sets.
Teaching the agent to stop from its own runs
Stop distillation takes the twice-passed rule as a labelling rule and fine-tunes the agent on its own runs. A stop example pairs the prefix at the rule's stopping point with a fixed submission; continue examples pair earlier prefixes with the agent's own next reply. The objective is written as a negative log-likelihood, minimized over the parameters theta:
\[ L(\theta) = -\sum_{\text{runs}} \Big[ \log p_\theta(a_{\text{stop}} \mid h_{\tau_\ell}) + \sum_{k \in K} \log p_\theta(a_{k+1} \mid h_k) \Big] \] The first term teaches where to stop, and the second term, the self-distillation term, keeps the agent's replies elsewhere close to its original behaviour.
Qwen3.6-27B was fine-tuned with LoRA, rank 16 and two epochs, on its own runs of 115 fresh tasks, giving 215 stop examples and 896 continue examples.
Over six training seeds on 256 tasks the agent saved 30.0% of cost at -1.2 points of resolution, with -3.1 to +1.2 across seeds. Official scoring gave the same qualitative picture on 254 fully paired tasks, with cost changing by -30.1% and resolution by -1.1 points. For Qwen3.8-27B the same recipe saved 43.2% at +0.2 points. The authors state that the cost saving is robust, while the preregistered quality margin is not established.
In SWE-agent the distilled agent saved 56.9% of cost and lost 3.2 points, which the authors tie to the rule's own loss there.
Limitations
Non-inferiority at the 2-point quality margin is not established, and the six-seed results show reliable cost savings without ruling out a meaningful quality loss. Cost here means inference-token cost under the stated prices; sandbox compute, monitoring overhead and wall-clock latency are excluded, so no end-to-end latency saving is established.
Paper info
- Authors
- Yang, Zerui, Xue, Quan, Dong, Miaomiao, Zhang, Chaorui, Zheng, Xuanyu, Wang, Xiyuan, Ruan, Haolin, Niu, Xueyan, Song, Guangcheng, Zhang, Weixi, Han, Wei, Bai, Bo
- Venue
- arXiv · Preprint
- First published
- 2026-11-17
- Added
- 2026-11-20
- Updated
- 2026-11-17
- Version
- v1
- arXiv
- 2611.22901
- Category
- cs.AI
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Abstract
Coding agents often continue working after their own tests pass. Does this additional work improve the patch, and how much could be saved by stopping earlier? We study these questions through anytime evaluation: replaying recorded runs, scoring intermediate patches with hidden tests, and measuring the cost incurred at each step. For policies that only stop a run or select an earlier patch, this allows paired comparisons without generating new trajectories, provided replay preserves the relevant states. Across about 6,000 runs of eight open models in two scaffolds on SWE-bench Verified, we find substantial differences in the value of continued work. The hindsight saving available at passing self-tests ranges from under 1% to 57%, depending on the model and scaffold. A rule that stops after the same patch passes twice saves 23% in a preregistered replication, but the preregistered quality test does not establish non-inferiority. We explain these differences by measuring how often a rule fires, how often the patch changes afterwards, and whether those changes repair or break it. Fine-tuning agents to imitate the rule saves 30% over six seeds, while quality preservation remains uncertain. Our results help identify both the opportunities and the risks of early stopping.
Quote from the paper
Yang, Zerui, Xue, Quan, Dong, Miaomiao, Zhang, Chaorui, Zheng, Xuanyu, Wang, Xiyuan, Ruan, Haolin, Niu, Xueyan, Song, Guangcheng, Zhang, Weixi, Han, Wei, Bai, Bo (2026). Done, But Still Working: Anytime Evaluation of When Coding Agents Should Stop. arXiv:2611.22901v1. https://arxiv.org/abs/2611.22901v1
BibTeX
@misc{zerui2026done,
title = {{Done, But Still Working: Anytime Evaluation of When Coding Agents Should Stop}},
author = {Yang, Zerui and Xue, Quan and Dong, Miaomiao and Zhang, Chaorui and Zheng, Xuanyu and Wang, Xiyuan and Ruan, Haolin and Niu, Xueyan and Song, Guangcheng and Zhang, Weixi and Han, Wei and Bai, Bo},
year = {2026},
eprint = {2611.22901},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2611.22901v1}
}