Diffs Are Cheap, Show Me the Trajectory: An Empirical Study of Trajectory-Informed Code Review
- Source
- arxiv.org
- Author
- Zijian Luo, Pengfei Gao, Dayi Lin, Zhiyu Fan, Yongqiang Tian, Alejandro Carderera de Diego, Judge Hiciano, Gemma Garriga, Qingwei Lin, Dongmei Zhang
- Date

Context
Reviewing a pull request usually starts from the final diff, which shows what changed but not the attempts, failed tests and assumptions that led there. Coding agents all of that in a trajectory: the task request, the agent's own messages, every and every result it saw. Researchers from Microsoft, GitHub and Monash University tested whether a separate review agent catches more problems in agent-written code when it can read that trajectory (arXiv). Handing over the raw trajectory helped only a little and not reliably; four other ways of presenting or using it each helped more.
The authors ran three coding setups (GPT-5.5 and GPT-5.6 Sol in Codex CLI, and Gemini 3.8 Flash in Copilot CLI) on 113 tasks from the DeepSWE benchmark, producing 339 implementations with their trajectories. Each was then reviewed through the review modes of Codex CLI and GitHub Copilot CLI, both running GPT-5.6 Sol, giving six coding and review combinations. Public projects with recorded agent sessions had few human review comments, so the answer key is synthetic: GPT-5.6 Sol compared each agent's code with DeepSWE's hidden reference solution and wrote 882 reference review comments describing where the agent's code fell short. The same procedure, tested on 100 human-reviewed open-source PRs, recovered about 81% of 126 human reviewers' comments. The score for each review is recall, the share of those reference comments it raised.
A reviewer with only the diff and repository recovered 23.03% of the reference comments on average; access to the full trajectory raised that to 25.87%, but recall fell in two of the six combinations, and reviewers pulled in only about a tenth of the trajectory text. Four alternative ways of presenting or using the trajectory all beat diff-only review, by 4.05 to 7.32 percentage points. The simplest, called Messages, keeps only the request and the agent's own text and drops tool output; it reached 29.03%. The best, an evidence-linked map, has the reviewer first turn the trajectory into a short list of questions, each citing the step it came from, then check them against the code with at most ten focused tests; it reached 30.35%. In one task, the agent had written that its new code would still call developers' custom conversion hooks, and the reviewer tested that claim and found the hooks were skipped. On the 51 reference comments that explain why an implementation failed the benchmark's own checks, the map lifted recall from 22.90% to 40.40%, and Messages to 30.81%.
The gain costs money and time. The map used 2.81 to 6.18 times the input tokens of diff-only review, took 3.22 to 7.12 minutes against 1.85 to 2.42, and cost an estimated median of USD 1.13 to 2.06 per review against 0.36 to 0.56. Messages stayed close to diff-only cost at USD 0.45 to 0.60. The results also have limits a reader should weigh. Recall is measured against synthetic comments built from a single reference solution, and the paper does not measure precision, so it cannot say whether trajectory-aware reviewers also raised more wrong or irrelevant comments. The paper does not discuss a further limit: by design, the diff-only reviewer received no separate task description, while every trajectory condition included the original request, so the study cannot say how much of the gain comes simply from knowing what was asked. Nearly all of the map's questions (98.7%) did cite steps beyond that request, which shows the map draws on more than the task statement, though not how much that adds.
For teams already merging agent-written PRs, the practical reading is to keep the agent's log and give reviewers the agent's own narrative rather than the whole raw record, since the messages-only view captured most of the average gain at little extra cost, while the costlier map found more of the problems that actually broke the task. That fits a practitioner survey in which 61.1% of 239 developers said they demand more evidence before approving AI-authored pull requests: the trajectory is a ready source of that evidence, as long as a reviewer checks its claims against the code rather than trusting them.
- Giving a review agent the full coding-agent trajectory raised mean reference recall only from 23.03% to 25.87%, and improved recall in just four of six agent and configurations.
- Four alternative ways of presenting or using the trajectory each beat diff-only review, by 4.05 to 7.32 percentage points of mean reference recall.
- The authors report that higher recall can cost more tokens and review time, and that simpler trajectory views stayed competitive with richer ones.
- The trajectory gains also extended to reference review comments that explain why a task verifier failed.
- Record — One unit of data in a file or table, such as one supplier's quote; distinct from a line of text.
- Tool call — Text the model generates in an agreed format that names a tool and gives its inputs.
- Path — A description of a file or folder location, written using directory names and separators.
- Harness — The software that sends a model its context, recognizes tool calls, runs or refuses them, returns results and keeps the record.
articleInterpreting Coding Agents Through Their Behavioral TrajectoriesIbragim Badertdinov, Alexander Golubev
articleGraphectory Viewer: A Tool for Process-Centric Analysis of Agentic Software TrajectoriesCharlie Jyu, Shuyang Liu, Reyhaneh Jabbarvand
articletrajectory-judge: What Outcome-Only LLM Judges Miss on Agent TrajectoriesHadi Mohammadi