Rust in Everything
← Papers

Termination Lag: Coding Agents Solve Early but Stop Late

Musa Cim, Burak Topcu, Mahmut Taylan Kandemir

2026-11-17▲ 5arXiv 2611.14960v1Hugging FaceCode

AI-generated from the full paper (deepseek-flash). It may contain mistakes; check the original.

TL;DR

Coding agents often produce a correct patch on their first source-code edit yet keep working for a median of 35–60% of their remaining steps, and in 1–8% of cases later edits break the fix.

Problem

Coding agents are scored only on whether their final submitted patch passes the benchmark tests, which hides when the correct solution was actually obtained and how much work followed it. Two agents that apply the same correct edit at step 10 get identical credit even if one submits immediately and the other runs 40 more steps of testing and review. Final-patch evaluation conflates producing a correct fix with recognizing that the fix is complete, and a run that corrupts an earlier correct patch looks like a failure. The paper argues that knowing when to terminate is as critical to agent performance as generating the fix, since every extra step adds tokens, latency and compute and risks breaking working code.

Method

The authors record and test every distinct repository patch generated during execution, so correctness can be tracked without influencing the agent. A logging proxy between agent and model endpoint saves the current patch (diff against the task's base commit) after each agent step while the agent waits for the next response, building patches with a temporary Git index so the working repository is untouched. Recorded patches are then evaluated offline in isolated containers using the official benchmark procedure, with identical patches evaluated only once; the agent never sees this feedback. Metrics are time to first correct patch (TTFCP = F), termination lag (TL = S − F) and normalized termination lag (NTL = (S − F)/S). The core evaluation runs Qwen3-Coder-30B-A3B and Laguna-XS.2 on SWE-bench Verified and Multilingual under OpenHands, with generalization 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. Post-fix steps are classified by rules over the recorded tools and arguments into verification, exploration, source-code editing, wrap-up, and reasoning or other.

Results

  • For most models the first source-code edit already passes the benchmark tests in a large share of runs that reach a correct patch. §4.2
  • Qwen3-Coder keeps working for a median of 16 steps after its first correct patch on Verified and 18 on Multilingual. §4.2
  • Laguna-XS.2 shows the largest termination lag, with more than half of solved trajectories occurring after the first correct patch. §4.2
  • The separation also appears in commercial models: Claude Haiku 5.5 has a median first-correct-patch step of 9 with a median lag of 10 steps, and GPT-6 Luna a median lag of 6 steps. §4.2
  • An oracle that stops each run at its first correct patch would remove a median share of each solved trajectory's steps while preserving every originally solved task. §4.2
  • Post-fix steps are dominated by verification and exploration, and in a small fraction of runs the patch is broken and ends unsolved. §Abstract

Limitations

  • The evaluation covers three benchmarks, five models and two agent frameworks with each task run once, and may not transfer to other settings (stated in Limitations).
  • The few solved runs that reach the step or context limit (1–4% per setting) are counted at their final step, and execution is measured in steps, which approximates but does not directly measure computational cost (stated in Limitations).
  • Step categories are assigned by rules over the recorded tools and their arguments, and Seed-OSS on SWE-bench Pro solves few tasks, so its statistics rest on a small sample (stated in Limitations).
  • No stopping rule is proposed or evaluated: the paper states only that a practical rule would need to decide when to submit using evidence available during the run, leaving the design and testing of such a rule open.

Key points

  • Patches are recorded after every agent step by a logging proxy and scored offline with official benchmark tests, so measurement never influences agent behavior. §3.5
  • TTFCP = F, TL = S − F, and NTL = (S − F)/S, where S is the step at which the agent stops on its own and F the earliest step whose patch passes evaluation. §3.6
  • In the core settings, solved rates are 43.8% for Qwen3-Coder on Verified and 22.3% on Multilingual, 56.0% for Laguna-XS.2 on Verified and 48.0% on Multilingual. §4.2
  • Context grows from the first correct patch to the final step by +30% and +28% for Qwen3-Coder and +78% and +55% for Laguna-XS.2 on Verified and Multilingual. §4.2
  • Mean distinct patch attempts until the first correct one range from 1.3 (Qwen3-Coder Verified) to 3.6 (Seed-OSS Pro). §4.2
  • After the fix, agents mostly verify (running repo tests, writing test scripts, building) and explore (inspecting files, searching, Git inspection), while further source-code edits are rare in most settings. §5
  • The patch stays correct to the end in 61–96% of runs; it breaks and the run ends unsolved in 1–8% of runs, and breaks then recovers in up to 31%. §4.2
  • mini-SWE-agent on Qwen3-Coder/Verified gives a median lag of 12 steps and 37% share of trajectory after the fix, with solved 32.4% versus 43.8% for OpenHands. §A.3.1

Mind map

Termination Lag
Problem
Final-patch score hides when fix appeared
Conflates solving with recognizing completion
Extra steps cost tokens, latency, risk
Method
Record patch after every agent step
Logging proxy, temporary Git index
Offline scoring in isolated containers
Metrics TTFCP, TL, NTL
Rule-based step classification
Setup
5 models: Qwen3-Coder, Laguna-XS.2, Seed-OSS, Haiku, Luna
2 frameworks: OpenHands, mini-SWE-agent
Benchmarks: Verified, Multilingual, Pro
Findings
First edit already correct in 38-82%
Median 35-60% of steps after fix
Post-fix work mostly verify and explore
1-8% break the correct patch
Implications
Oracle stop saves 35-60% of steps
Stopping behavior is distinct ability
Limitations
One run per task, may not transfer
Steps approximate compute cost
Rule-based categories, small Seed-OSS sample