Code agents resolve 65-70% of SWE-bench Verified issues, but Pass@1 cannot tell us why the rest fail, and, as we show, capable-model failures are systematically misdiagnosed without trajectory data. We introduce TRAJEVAL, a training-free decomposition of agent trajectories into reference-patch-aligned search, read, and edit stages, and apply it across 16,758 trajectories spanning three architectures and seven models. The dominant failure of capable models is not localization: 60-69% of failures on SWE-Agent and OpenHands reach and edit the correct functions yet still produce incorrect patches, and the pattern persists for most models on the bash-only LiveSWEAgent. Within this Edit-Quality residual, we identify Coherence Collapse, where the agent reaches correct code and then overwrites or thrashes it, as the largest theme, replicating across SWE-bench Verified and the multilingual PolyBench Verified. In 5 cases, the agent produces a patch bit-identical to the gold reference mid-trajectory and destroys it later; an edit-commit checkpoint recovers all 5 against the SWE-bench Docker harness. A reference-free consensus-driven variant yields a directional +3.0 pp Pass@1 measurement on GPT-5 (p=0.08).
Figures & tables
Figure 1: Overview of TrajEval . Each agent execution trace is automatically decomposed into three stages— search (file-level), read (function-level), and edit (function-level)—and compared against the reference patch to yield stage-wise precision and recall.
Model
n
Search
Read
E.-Tgt.
E.-Qual.
SWE-bench Verified
GPT-5
163
6.7
4.3
20.9
68.1
GPT-5-mini
162
8.6
8.0
14.2
69.1
Qwen3-Coder-480B
187
9.1
10.7
13.4
66.8
Qwen3-Coder-30B
231
11.7
10.8
10.8
66.7
Qwen3-235B
249
17.7
7.2
10.4
64.7
Table 1: Failure-mode distribution among failed trajectories (Pass@1 = 0), SWE-Agent. Buckets are mutually exclusive and exhaustive; each row sums to 100%. n counts failed trajectories for which all six stage features could be extracted; trajectories where the agent terminated before producing parseable observations or edits are excluded, most strongly affecting weaker models.
Theme
Sub-type
n
%
Coherence
Confused Thrashing
266
29.1
Collapse
Near-Correct Corrupted
97
10.6
Semantic
Wrong Branch Point
170
18.6
Error
Partial Understanding
67
7.3
Wrong API Call
37
4.0
Right Loc., Wrong Logic
28
3.1
Table 2: Taxonomy of Edit-Quality failures (n=914, SWE-Agent on SWE-bench Verified). Sub-types are mutually exclusive (cascading precedence; Appendix A.18 ).
Classification
Count
%
EXACT
5
5.2
NEAR
25
25.8
PARTIAL
66
68.0
DIFFERENT
1
1.0
Total
97
100.0
Table 3: Diff-hunk validation of the 97 Near-Correct Corrupted trajectories. The 5 EXACT cases ground the existence proof in Section 4.3 ; 30 strong-match (EXACT + NEAR) bound the recovery ceiling.
Benchmark
Overall
Py
Java
JS
TS
SWE-bench (n=914)
39.7
39.7
—
—
—
PolyBench (n=455)
32.3
26.4
36.3
42.1
32.1
Table 4: Cross-benchmark and per-language Coherence Collapse rate (% of Edit-Quality failures), SWE-Agent. JavaScript on PolyBench (42.1%) exceeds the SWE-bench Python baseline and Java (36.3%) is comparable, indicating the pattern is not Python- or benchmark-specific. Full taxonomy in Appendix A.4 .
Condition
Pass@1
Δ
Baseline
66.0% (330)
—
Oracle
70.6% (353)
+4.6 ( p<.001 )
\textscCons3
69.0% (345)
+3.0 ( p=.08 )
Table 5: Consensus measurement on GPT-5, SWE-Agent + SWE-bench (n=500). Oracle uses gold patch; \textscCons3 uses ≥3 -of-6 non-GPT-5 model agreement (no reference-patch access).
Appendix figures & tables31 assets
Supplementary material from the paper’s appendix.
Appendix
Table 6: Behavioral patterns and efficiency metrics on SWE-bench Verified.
Model
Coh.
Sem.
Loc.
Scope
Gap
GPT-5
33.3
34.2
20.7
10.8
0.9
GPT-5-mini
31.2
32.1
22.3
13.4
0.9
Qwen3-Coder-480B
44.0
32.0
15.2
7.2
1.6
Qwen3-Coder-30B
38.3
36.4
17.5
6.5
1.3
Qwen3-235B
39.1
37.3
14.9
6.8
1.9
Qwen3-32B
48.5
27.2
14.7
5.1
4.4
Appendix
Table 7: Edit-Quality failure themes by model (% of each model’s Edit-Quality failures). Coh. = Coherence Collapse; Sem. = Semantic Error; Loc. = Intra-File Mislocalization; Scope = Scope/Completeness; Gap = Execution Gap.
Theme
SWE-bench
PolyBench
Δ
(n=914)
(n=455)
(pp)
Coherence Collapse
39.7%
32.3%
−7.4
Semantic Error
33.0%
33.9%
+0.9
Intra-File Mislocalization
17.6%
16.9%
−0.7
Scope/Completeness
7.9%
8.3%
+0.4
Execution Gap
1.8%
8.6%
+6.8
Appendix
Table 8: Edit-Quality theme distribution: SWE-bench Verified vs. PolyBench Verified (SWE-Agent scaffold). Coherence Collapse remains the largest single theme on both benchmarks; Semantic Error and Intra-File Mislocalization are within ±1 pp across benchmarks. The cross-benchmark drop in Coherence Collapse is driven by PolyBench Python (Table 9 ) rather than by a multilingual effect.
Language
n
Coh.
Sem.
Loc.
Scope
Gap
Java
135
36.3
36.3
17.8
4.4
5.2
JavaScript
76
42.1
39.5
11.8
3.9
2.6
Python
216
26.4
31.0
18.1
12.5
12.0
TypeScript
28
32.1
28.6
17.9
7.1
14.3
All
455
32.3
33.9
16.9
8.3
8.6
Appendix
Table 9: PolyBench Edit-Quality taxonomy by language (SWE-Agent). JavaScript (42.1%) exceeds and Java (36.3%) is comparable to the SWE-bench Python baseline (39.7%), contradicting the “monolingual vs. multilingual” hypothesis. The aggregate cross-benchmark drop is concentrated in PolyBench Python (26.4%).
Agent
μtool
μLLM
μbash
Ppipe
Loc.
Loc.%
GPT-5
30.71
30.71
15.36
0.22
2558
33.3
GPT-5-mini
32.16
32.16
16.84
0.24
3493
41.5
Qwen3-235B
42.53
42.53
15.25
0.20
1682
22.1
Qwen3-Coder-30B
50.45
50.45
27.44
0.42
2815
20.5
Qwen3-32B
48.59
48.59
13.62
0.23
2469
36.2
Qwen3-Coder-480B
50.30
50.30
24.80
0.36
2900
23.4
Appendix
Table 10: Complete Efficiency Metrics (SWE-bench Verified). Columns: μtool mean tool calls per trajectory; μLLM mean LLM invocations per trajectory; μbash mean bash invocations per trajectory; Ppipe mean pipe ( | ) operators per bash command (a count, not a probability; values >1 indicate multi-pipe chains); Loc. total localization-class commands across all trajectories; Loc.% fraction of bash commands classified as localization. Qwen3-8B was run on SWE-Agent + SWE-bench (n=500 trajectories, included in the failure-mode partition Table 1 ) but is excluded from per-tool aggregate tables due to its shorter average trajectories (7–10 tool calls vs. 20–40 for other models), which yield insufficient per-tool-type samples for reliable aggregation.
Tool
GPT-5
GPT-5-mini
Q-235B
Q-30B
Q-32B
Q-480B
bash
In
76.0
96.8
41.8
87.0
44.7
54.2
Out
5210
1497
906
315
1301
593
view
In
25.7
27.1
27.4
26.6
29.0
27.2
Out
1682
1406
902
776
448
715
str_replace
In
322
327
560
616
190
555
Out
316
379
418
457
132
432
Appendix
Table 11: Complete Token Consumption (SWE-bench Verified). Qwen3-8B excluded from per-tool aggregates; see Table 10 caption.
Tool
GPT-5
GPT-5-mini
Q-235B
Q-30B
Q-32B
Q-480B
bash
96.2%
96.4%
96.3%
97.3%
94.5%
97.7%
(7213)
(7953)
(7149)
(13225)
(6417)
(11905)
view
99.7%
99.9%
99.9%
99.8%
99.2%
99.7%
(4549)
(4200)
(4843)
(5970)
(7521)
(6165)
str_replace
98.8%
98.9%
97.2%
99.5%
92.6%
98.4%
(1467)
(1656)
(4665)
(2086)
(8137)
(2748)
Appendix
Table 12: Complete Tool Success Rates (SWE-bench Verified). Qwen3-8B excluded from per-tool aggregates; see Table 10 caption.
Table 22: LiveSWEAgent Efficiency Metrics (SWE-bench Verified). Qwen3-8B and Qwen3-32B excluded due to OpenRouter API errors (Section 3 , coverage note).
Tool
GPT-5
GPT-5-mini
Q-235B
Q-30B
Q-480B
executeBash
In
158.8
96.7
122.3
79.8
97.5
Out
528
430
14688
817
152
Appendix
Table 23: LiveSWEAgent Token Consumption (SWE-bench Verified). Qwen3-8B and Qwen3-32B excluded due to OpenRouter API errors.
Tool
GPT-5
GPT-5-mini
Q-235B
Q-30B
Q-480B
executeBash
94.3%
95.8%
97.8%
92.9%
98.2%
(5434)
(6010)
(20880)
(17701)
(24474)
Appendix
Table 24: LiveSWEAgent Tool Success Rates (SWE-bench Verified). Qwen3-8B and Qwen3-32B excluded due to OpenRouter API errors.
Agent
μtool
μLLM
μbash
Ppipe
Loc.
Loc.%
GPT-5
15.23
15.23
15.23
0.89
3906
67.1
GPT-5-mini
14.28
14.28
14.28
0.86
3674
67.3
Qwen3-235B
25.10
25.10
25.10
0.31
6299
65.7
Qwen3-Coder-30B
42.33
42.33
42.33
0.46
7703
47.6
Qwen3-Coder-480B
46.78
46.78
46.78
0.26
12311
68.9
Appendix
Table 25: LiveSWEAgent Efficiency Metrics (PolyBench Verified). Qwen3-8B and Qwen3-32B excluded due to OpenRouter API errors.
Tool
GPT-5
GPT-5-mini
Q-235B
Q-30B
Q-480B
executeBash
In
148.8
95.5
143.6
89.3
101.1
Out
501
466
230
131
191
Appendix
Table 26: LiveSWEAgent Token Consumption (PolyBench Verified). Qwen3-8B and Qwen3-32B excluded due to OpenRouter API errors.
Tool
GPT-5
GPT-5-mini
Q-235B
Q-30B
Q-480B
executeBash
94.5%
93.3%
95.3%
97.9%
97.6%
(4653)
(4235)
(8657)
(14358)
(17184)
Appendix
Table 27: LiveSWEAgent Tool Success Rates (PolyBench Verified). Qwen3-8B and Qwen3-32B excluded due to OpenRouter API errors.
Model
τ
n
Search
Read
E.-Tgt.
E.-Qual.
GPT-5
0.3
163
5.5
4.9
19.6
69.9
0.5
163
6.7
4.3
20.9
68.1
0.7
163
18.4
4.9
20.9
55.8
GPT-5-mini
0.3
162
6.8
7.4
14.2
71.6
0.5
162
8.6
8.0
14.2
69.1
0.7
162
16.7
8.6
16.0
58.6
Appendix
Table 28: Failure-mode distribution under varying recall thresholds τ , SWE-Agent on SWE-bench Verified. Each row sums to 100%. Bold entries mark the modal bucket per row. Edit-Quality remains the modal bucket for all five capable models at every threshold (53–72%); Qwen3-32B and Qwen3-8B move between Search-modal and Edit-Quality-modal but stay in the upstream-failure regime (Search + Read ≥ 50% at τ=0.7 ).
Model
n
Search
Read
E.-Tgt.
E.-Qual.
GPT-5
158
11.4
3.2
17.7
67.7
GPT-5-mini
204
10.3
4.4
24.5
60.8
Qwen3-Coder-480B
196
9.7
10.2
15.3
64.8
Qwen3-Coder-30B
278
8.6
12.2
14.7
64.4
Qwen3-235B
276
14.9
9.8
10.9
64.5
Qwen3-32B
445
41.8
18.9
17.5
21.8
Appendix
Table 29: OpenHands on SWE-bench Verified.
Model
n
Search
Read
E.-Tgt.
E.-Qual.
GPT-5
176
5.1
11.9
15.3
67.6
GPT-5-mini
214
8.4
13.1
15.4
63.1
Qwen3-Coder-480B
238
15.5
40.3
4.6
39.5
Qwen3-Coder-30B
386
33.4
30.3
3.1
33.2
Qwen3-235B
363
12.1
19.8
10.5
57.6
Weighted avg.
1377
17.2
24.3
8.8
49.7
Appendix
Table 30: LiveSWEAgent on SWE-bench Verified. Qwen3-8B and Qwen3-32B were excluded due to OpenRouter API errors with the bash-only LiveSWEAgent harness (Section 3 , coverage note).
Model
n
Search
Read
E.-Tgt.
E.-Qual.
GPT-5
208
18.8
41.3
8.7
31.2
GPT-5-mini
216
27.8
30.1
8.8
33.3
Qwen3-Coder-480B
261
28.0
39.8
11.1
21.1
Qwen3-Coder-30B
287
26.8
36.6
11.5
25.1
Qwen3-235B
295
38.3
25.8
11.2
24.7
Qwen3-32B
339
61.4
15.3
10.9
12.4
Appendix
Table 31: SWE-Agent on PolyBench Verified (also reproduced inline as Table 1 , bottom).
Model
n
Search
Read
E.-Tgt.
E.-Qual.
GPT-5
202
19.8
36.6
9.9
33.7
GPT-5-mini
233
27.5
33.5
10.7
28.3
Qwen3-Coder-480B
244
24.2
39.8
5.7
30.3
Qwen3-Coder-30B
293
25.6
38.9
6.1
29.4
Qwen3-235B
301
30.9
33.6
7.6
27.9
Qwen3-32B
348
52.9
25.9
2.9
18.4
Appendix
Table 32: OpenHands on PolyBench Verified.
Model
n
Search
Read
E.-Tgt.
E.-Qual.
GPT-5
239
16.7
54.8
4.6
23.8
GPT-5-mini
279
20.8
53.8
6.1
19.4
Qwen3-Coder-480B
297
31.0
59.9
1.3
7.7
Qwen3-Coder-30B
348
50.6
42.5
1.1
5.7
Qwen3-235B
329
24.0
55.0
3.0
17.9
Weighted avg.
1492
29.8
52.8
3.1
14.3
Appendix
Table 33: LiveSWEAgent on PolyBench Verified. Qwen3-8B and Qwen3-32B were excluded due to OpenRouter API errors with the bash-only LiveSWEAgent harness (Section 3 , coverage note).
Metric
SWE-bench
PolyBench
Total instances
500
382
Languages
1 (Python)
4 (Py/Java/TS/JS)
Unique repositories
12
20
Avg files per patch
1.4
1.6
Avg functions per patch
2.1
2.4
Avg lines changed
42
38
Appendix
Table 34: Complete dataset statistics.
N
Precision
Recall
Oracle recovered
Analytical ceiling
2
35.2%
95.5%
99.0% (485/490)
+4.6 pp
3
52.4%
94.2%
97.3% (477/490)
+4.5 pp
4
66.8%
91.5%
92.4% (453/490)
+4.3 pp
5
75.6%
86.2%
82.4% (398/483)
+3.8 pp
Appendix
Table 35: Consensus signal validation. For each threshold N , we compute the set of files viewed by ≥N of the 6 non-GPT-5 models on each instance. Precision/recall are against gold edit locations. “Oracle recovered” is the fraction of the 490 instances where the oracle would fire that consensus also covers at least one gold file. Analytical ceiling = recovery rate × 4.6 pp (the oracle gain), achieved only under perfect-precision triggering.
Figure 2: Relationship between trajectory length and Coherence Collapse. (a) Failure theme composition by trajectory-length quartile; Coherence Collapse (red+orange) grows from 22% to 64% (aggregate ρ=0.32 ). (b) Dissociation: Confused Thrashing (red) scales with length ( ρ=0.34 ) while Near-Correct Corrupted (orange) is flat ( ρ=0.001 ).
Autonomous coding agents solve repository issues by reading code, running commands, editing files, and submitting patches. Extra inference-time compute yields gains only when it produces a useful repair and supplies reliable evidence for choosing one. Three behaviors decide both, and we argue they are teachable rather than byproducts of scale, so a policy can carry them instead of a scaffold. Location diversity remains narrow, since attempts return to the same site and extra samples add no coverage. Edit diversity is left unexploited, since methodologies that differ resolve complementary issues no single run reaches. Verification misleads, since a test the agent writes for its own patch accepts many incorrect ones. Directing search by execution feedback and scoring each patch against its own reverted tree resolves 52.8% of SWE-bench Verified using 48.1% of the agent-steps an eight-sample baseline spends. Training moves these behaviors into the policy. On the 270 issues held out from SFT and RL training, weighted supervised fine-tuning raises pass@1 from 31.9% to 35.2% and pass@8 from 46.7% to 51.1%. A reinforcement objective then trains the verifier against gold-labeled repairs and incorrect variants, crediting the assertions that detect them. It raises pass@1 to 43.0% and pass@8 to 60.7%, lifts verifier precision from 26.8% to 41.7%, and more than halves false acceptance. Resolution improves on two of three out-of-distribution suites and verifier precision on all three, and the gains hold at 7B, 14B, and 30B against published coder baselines.
Muhammad Ahmed Mohsin, Myeongsoo Kim, Kangrui Ruan +3
Rejection sampling fine-tuning (RFT) is widely used to train code agents by generating trajectories on verifiable software engineering tasks, retaining those that pass the tests, and fine-tuning on the successful rollouts. However, even strong code agents repeatedly fail on a substantial fraction of such tasks, and standard RFT simply discards these failures. The discarded samples are precisely the hardest and most informative ones, drawn from verifiable instances that are costly to curate. Stronger base models may reduce the number of failures, but the remaining hard cases still define the frontier for further improvement. We propose FailForge, an agentic framework that converts failed rollouts into training signal. For each failed instance, an agent diagnoses the failure from error feedback and execution traces, distills the diagnosis into a concise and actionable skill, and injects the skill into the agent context for a guided second attempt. Trajectories that succeed under skill guidance are folded back into the RFT corpus. Crucially, the skill is removed at training time, so the model internalizes the recovered behavior rather than relying on external hints at inference. FailForge recovers over 26% of previously failed instances at marginal additional cost, and training Qwen3.5-4B on the augmented corpus improves the SWE-bench Verified resolve rate by 6.6 points over a strong RFT baseline, with gains concentrated on the hardest problems.
Dongyi Lv, Fushun E, Aichen Cai +8
Xi’an Jiaotong University · Joy Future Academy, JD
Code agents are advancing rapidly, but debugging them is becoming increasingly difficult. As frameworks orchestrate parallel tool calls and multi-stage workflows over complex tasks, making the agent's state transitions and error propagation hard to observe. In these runs, an early misstep can trap the agent in unproductive loops or even cascade into fundamental errors, forming hidden error chains that make it hard to tell when the agent goes off track and why. Existing agent tracing analyses either focus on simple interaction or rely on small-scale manual inspection, which limits their scalability and usefulness for real coding workflows. We present CodeTracer, a tracing architecture that parses heterogeneous run artifacts through evolving extractors, reconstructs the full state transition history as a hierarchical trace tree with persistent memory, and performs failure onset localization to pinpoint the failure origin and its downstream chain. To enable systematic evaluation, we construct CodeTraceBench from a large collection of executed trajectories generated by four widely used code agent frameworks on diverse code tasks (e.g., bug fixing, refactoring, and terminal interaction), with supervision at both the stage and step levels for failure localization. Experiments show that CodeTracer substantially outperforms direct prompting and lightweight baselines, and that replaying its diagnostic signals consistently recovers originally failed runs under matched budgets. Our code and data are publicly available.
Han Li, Yifan Yao, Letian Zhu +13
Nanjing University · Alibaba Group · Renmin University of China +3