# CodeHealth Predicts the Token Cost of Agentic Code Review: A Pre-Registered Study of 465 Agent-Authored Pull Requests

arXiv: https://arxiv.org/abs/2610.21914 · HTML: https://mlsanity.com/paper/2610.21914/

## Key facts

- Cited by 1 papers in the map (data through 24 Nov 2026).
- Placed in Software engineering coding agents, one of 16 directions in LLM agents and tool use.
- Builds on 20 of its 59 references that are in the map.
- Submitted 15 Oct 2026.

## Placed in

- LLM agents and tool use / [Software engineering coding agents](https://mlsanity.com/agents/software-engineering-coding-agents/)

## Builds on (most cited first, 20 of 20)

- [ChatDev: Communicative Agents for Software Development](https://mlsanity.com/paper/2307.07924/) (2023)
- [SWE-Bench+: Enhanced Coding Benchmark for LLMs](https://mlsanity.com/paper/2410.06992/) (2024)
- [Using Pre-Trained Models to Boost Code Review Automation](https://mlsanity.com/paper/2201.06850/) (2022)
- [Guidelines for Empirical Studies in Software Engineering involving Large Language Models](https://mlsanity.com/paper/2508.15503/) (2025)
- [AIDev: Studying AI Coding Agents on GitHub](https://mlsanity.com/paper/2602.09185/) (2026)
- [BitsAI-CR: Automated Code Review via LLM in Practice](https://mlsanity.com/paper/2501.15134/) (2025)
- [Concerned with Data Contamination? Assessing Countermeasures in Code Language Model](https://mlsanity.com/paper/2403.16898/) (2024)
- [United Minds or Isolated Agents? Exploring Coordination of LLMs under Cognitive Load Theory](https://mlsanity.com/paper/2506.06843/) (2025)
- [From Technical Debt to Cognitive and Intent Debt: Rethinking Software Health in the Age of AI](https://mlsanity.com/paper/2603.22106/) (2026)
- [Mining Code Review Data to Understand Waiting Times Between Acceptance and Merging: An Empirical Analysis](https://mlsanity.com/paper/2203.05048/) (2022)
- [A Roadmap on Modern Code Review: Challenges and Opportunities](https://mlsanity.com/paper/2405.18216/) (2024)
- [Triage: Routing Software Engineering Tasks to Cost-Effective LLM Tiers via Code Quality Signals](https://mlsanity.com/paper/2604.07494/) (2026)
- [Code for Machines, Not Just Humans: Quantifying AI-Friendliness with Code Health Metrics](https://mlsanity.com/paper/2601.02200/) (2026)
- [AI Writes Faster Than Humans Can Review: A Longitudinal Study of an Enterprise 2x Mandate](https://mlsanity.com/paper/2607.01904/) (2026)
- [Increasing, not Diminishing: Investigating the Returns of Highly Maintainable Code](https://mlsanity.com/paper/2401.13407/) (2024)
- [Code Review as Decision-Making -- Building a Cognitive Model from the Questions Asked During Code Review](https://mlsanity.com/paper/2507.09637/) (2025)
- [U Owns the Code That Changes and How Marginal Owners Resolve Issues Slower in Low-Quality Source Code](https://mlsanity.com/paper/2304.11636/) (2023)
- [The Upper Bound of Information Diffusion in Code Review](https://mlsanity.com/paper/2306.08980/) (2023)
- [Code Health in LLM-Based Test Generation: Effectiveness and Token Efficiency](https://mlsanity.com/paper/2608.18645/) (2026)
- [Using Agentic AI for contextualized and multifaceted code review at Ericsson](https://mlsanity.com/paper/2609.15877/) (2026)

## Built on by (most cited first, 1 of 1)

- [Admitted Is Not Effective: Lessons from a Notary-Gated Retrospective Loop in an Agentic Pipeline](https://mlsanity.com/paper/2611.29727/) (2026)

## Abstract (arXiv)

Context: Organizations increasingly delegate code review to multi-agent large language model (LLM) pipelines billed per token. Low code quality raises human maintenance effort, but its effect on agent review cost has not been measured. Objective: We test whether baseline CodeHealth predicts the token cost of agentic review and fix beyond pull request (PR) footprint. Method: In a pre-registered observational study, we sampled 465 agent-authored PRs from 246 repositories in AIDev, jointly stratified by CodeHealth and footprint under repository caps. A frozen five-agent review-and-fix pipeline processed every PR with three different LLMs. Per LLM, we fitted a mixed model of log tokens on CodeHealth and log PR footprint, with a repository random intercept. Results: For all three LLMs the CodeHealth coefficient was negative, with 95% CI excluding zero; each CodeHealth point was associated with 3.5% to 6.1% lower token cost. CodeHealth was unrelated to PR footprint, so PR size does not explain the association. Two of three registered smells predicted fix cost; batch fixing left median CodeHealth unchanged. Exploratory analyses located the association in the review stage, where agents iterated more on unhealthy code without writing more comments. Adjusting for the size of the scored files absorbed the association, which we interpret as mediation by file size. Conclusions: A quality metric calibrated against human maintainability also predicts the inference cost of multi-agent review and fix. The effect is modest per point and not carried by PR size, so the refactoring case extends to agent-reviewed code when it changes structure and file size, not only the score. Data Availability: https://doi.org/10.5281/zenodo.22127920
