Skip to content
AI.info

Papers

Termination Lag: Coding Agents Solve Early but Stop Late

Coding agents are scored almost entirely by whether their final submitted patch passes the benchmark tests, which hides when the correct fix actually appeared during the run.

The paper’s first page · arXiv:2611.14960
arXiv
2611.14960 · Preprint · not peer-reviewed
Published
2026-11-11
Authors
Musa Cim, Burak Topcu, Mahmut Taylan Kandemir

In plain words

Coding agents are scored almost entirely by whether their final submitted patch passes the benchmark tests, which hides when the correct fix actually appeared during the run. An agent may write a correct patch early and then keep running for dozens of extra steps, or even overwrite its own working solution later.

Key results

  • Correct patches arrive early. On SWE-bench Verified, Qwen3-Coder's very first source-code edit already passes the benchmark tests in 82% of runs that reach a correct patch.
  • Measured cost of the lag. An oracle that stopped every run at its first correct patch — leaving never-solved runs untouched — would remove a median of 35% and 37% of steps for Qwen3-Coder on Verified and Multilingual, 60% and 54% for Laguna-XS.2, and 54% for Haiku on Verified, while preserving every originally solved task.

AI summary

Overview

Research area: Empirical evaluation of LLM-based autonomous software engineering agents (coding agents), specifically the timing of task completion versus run termination.

Technical level: Intermediate — the paper is readable without deep math, but assumes familiarity with coding agents, SWE-bench-style benchmarks, and concepts like agent steps and context windows.

Scope: A measurement study of "termination lag" — the number of steps between an agent's first benchmark-correct repository patch and the end of its run — across five models, two agent frameworks, and three SWE-bench datasets.

What This Paper Is About

Coding agents are scored almost entirely by whether their final submitted patch passes the benchmark tests, which hides when the correct fix actually appeared during the run. An agent may write a correct patch early and then keep running for dozens of extra steps, or even overwrite its own working solution later. The authors record and test every distinct patch an agent produces so they can measure precisely how much work happens after success, what that work consists of, and whether it helps or hurts.

Key Contributions

  1. Definition and measurement of termination lag. The paper formalizes Time to First Correct Patch (TTFCP = F), Termination Lag (TL = S − F), and Normalized Termination Lag (NTL = (S − F)/S), measuring how far an agent's stopping point S trails its first correct step F.

  2. Step-level patch tracking without influencing the agent. A logging proxy between agent and model endpoint saves the repository patch after every agent step using a temporary Git index, and all distinct patches are later evaluated offline with the official benchmark tests inside isolated containers. The agent never sees this evaluation feedback, so the measurement cannot change its behavior.

  3. Large-scale generalization evidence. The core analysis covers Qwen3-Coder-30B-A3B and Laguna-XS.2 on SWE-bench Verified and Multilingual, with additional runs for Claude Haiku 5.5 and GPT-6 Luna on Verified, Seed-OSS-36B on SWE-bench Pro, and Qwen3-Coder under mini-SWE-agent instead of OpenHands.

  4. A taxonomy of post-solution activity and its effect on correctness. Steps after the first correct patch are classified into verification, exploration, source-code editing, wrap-up, and reasoning/other, and each trajectory is tracked to see whether the correct patch survives to the end.

Main Findings

  • Correct patches arrive early: On SWE-bench Verified, Qwen3-Coder's very first source-code edit already passes the benchmark tests in 82% of runs that reach a correct patch. Across all settings, the first edit is already correct in 38–82% of such runs, and agents need a mean of 1.3–3.6 distinct patches to reach correctness.

  • First edits cluster at median step 9–45: Median first-patch steps are 30 (Qwen3-Coder, Verified), 34 (Qwen3-Coder, Multilingual), 36 and 45 (Laguna-XS.2, Verified and Multilingual), 9 (GPT-6 Luna, Verified), and 17 (Seed-OSS, Pro).

  • Large termination lag in successful runs: Median TL is 16 steps for Qwen3-Coder on Verified and 18 on Multilingual, with NTL of 35% and 37%. For Laguna-XS.2 the lag is 57 steps / 60% on Verified and 56 steps / 54% on Multilingual. Claude Haiku 5.5 shows a median TL of 10 and NTL of 54% (median first-correct step 9); GPT-6 Luna shows TL of 6 and NTL of 36%.

  • The pattern holds under a second framework: With mini-SWE-agent, Qwen3-Coder on Verified shows a median TL of 12 steps and NTL of 37%.

  • Solve rates in the core settings: 43.8% on Verified and 22.3% on Multilingual for Qwen3-Coder; 56.0% and 48.0% for Laguna-XS.2.

  • Post-fix work is mostly re-checking: Verification accounts for 48–63% of post-fix steps and exploration for 15–29%. Further source edits are rare (2–6%) except for Seed-OSS on SWE-bench Pro at 19%.

  • Later work sometimes destroys the fix: 61–96% of runs that reach a correct patch keep it to the end. In 1–8% of such runs later edits break the patch and the run finishes unsolved — a failure that stopping at the first correct patch would have avoided. Repair-after-break rates reach 31% for Laguna-XS.2 on Multilingual and 17% for Seed-OSS on Pro.

  • Measured cost of the lag: An oracle that stopped every run at its first correct patch — leaving never-solved runs untouched — would remove a median of 35% and 37% of steps for Qwen3-Coder on Verified and Multilingual, 60% and 54% for Laguna-XS.2, and 54% for Haiku on Verified, while preserving every originally solved task.

  • Context keeps growing after success: Context growth from the first correct patch to the final step is +30% (Qwen3-Coder, Verified), +28% (Multilingual), +78% (Laguna-XS.2, Verified), and +55% (Laguna-XS.2, Multilingual).

  • Framework comparison (Qwen3-Coder, Verified, 500 tasks): OpenHands solves 43.8% versus 32.4% for mini-SWE-agent; median steps per task are 53 versus 52, but median uncached compute tokens per task are 39.0K versus 22.2K and median last-step context is 42.9K versus 20.5K tokens.

Methodology in Plain English

The researchers let each agent run normally inside OpenHands (or mini-SWE-agent for the cross-framework check) against real SWE-bench tasks. The key trick is a logging proxy sitting between the agent and the model endpoint: whenever the agent is idle waiting for the next model response, the proxy snapshots the current repository diff against the task's base commit, using a throwaway Git index so the agent's working copy is untouched. After the run finishes, those saved patches are replayed in isolated containers and graded with the official benchmark test suites, with duplicate patches graded only once. Because this grading happens after the fact and is never fed back, the agent's decisions are unaffected. The authors then find F, the earliest step whose patch passes, compare it to S, the step where the agent stopped on its own, and classify each post-F step by which tools were invoked — running tests, searching files, editing code, or wrapping up.

Why This Matters

Impact on research: Final-patch accuracy conflates two distinct abilities — writing a correct fix and recognizing that the fix is complete. This paper shows the second ability is a separate, measurable axis of agent performance, and it provides reference numbers that any proposed stopping rule can be benchmarked against.

Real-world applications:

  • Cost control in CI and coding assistants: Post-solution steps drive additional model calls over growing context; the reported context growth of +28% to +78% and token figures (39.0K vs 22.2K per task) show where savings sit.
  • Latency-sensitive developer tooling: Median termination lag of 16–57 steps translates directly into wall-clock time before a fix is returned to a user.
  • Guardrails against self-inflicted regressions: The 1–8% of runs that break a working patch motivate checkpointing or freezing a verified patch.
  • Agent and prompt design: Knowing that verification dominates post-fix effort (48–63%) points to where to intervene.

Industry relevance: Teams deploying coding agents pay per token and per step; an oracle stopping at the first correct patch would cut a median 35–60% of steps in the core settings without losing a single solved task. That is a direct, measurable efficiency lever rather than a modeling improvement.

Future Directions

  1. Build a stopping rule from in-run evidence only. The paper frames termination lag as an upper bound on what stopping at the right moment could save, but notes that any practical rule must decide using only signals available during execution — since benchmark tests are hidden.

  2. Detect and preserve verified patches. Given that 1–8% of runs break a correct patch and end unsolved, a mechanism that snapshots or locks in a patch once the agent's own evidence supports it could convert those losses into successes.

  3. Separate useful verification from redundant verification. Verification is the largest post-fix category (48–63%), but some checking is necessary because the agent cannot see the tests; the open question is how much is enough.

  4. Extend beyond the current coverage. The authors list as limitations that each task was run once, that only three benchmarks, five models, and two frameworks are covered, that 1–4% of solved runs hit the step or context limit, that steps approximate rather than measure computational cost, and that Seed-OSS on SWE-bench Pro solves few tasks, so its statistics rest on a small sample.

Target Audience

Researchers and engineers working on LLM coding agents and agent evaluation; practitioners deploying SWE-bench-style agents who care about cost, latency, and reliability; and anyone designing stopping criteria, budgets, or restart policies for autonomous agents. Readers without background in agent benchmarks will still follow the argument, but will get the most from the paper with some familiarity with tool-use agents and patch-based evaluation.

Authors’ abstract

Coding agents can solve a task well before they stop working on it. We characterize \emph{termination lag}--the number of steps between an agent's first correct patch and the end of its run--across five models, two agent frameworks, and three SWE-bench datasets by recording and testing every distinct repository patch generated during execution. Our analysis reveals that 38--82% of successful runs achieve a correct solution on their initial source-code edit. However, agents…

The full abstract on arXiv
Read the original paper

Related papers