- The paper finds that agent-authored code reduces downstream resolution rates by up to 13.1% compared to human-authored code due to subtle behavioral drift.
- It employs the CodeThread framework to simulate two-step code evolution, comparing agents’ performance on tasks like bug fixes and feature implementations.
- Traditional maintainability metrics fail to capture issues, highlighting the need for metrics sensitive to input validation, error handling, and behavioral differences.
Assessing the Maintainability of Agent-Authored Code Versus Human Code
Introduction
This paper investigates the maintainability of code produced by coding agents, specifically examining whether code authored by agents is more difficult for subsequent agent modifications compared to human-written code. The study addresses a critical gap in the deployment and evaluation of AI coding systems: while agents achieve high correctness rates for isolated tasks, their impact on longer-term maintainability remains understudied. To systematically analyze this, the authors introduce the CodeThread framework, which enables controlled experiments on downstream task resolution when agents build on agent versus human code bases.
The CodeThread Framework
The CodeThread framework extends conventional single-issue software engineering benchmarks into two-step chains, consisting of an initial implementation task and a downstream follow-on issue.
Figure 1: CodeThread framework transforms benchmark instances into two-step chains, allowing comparison of three authorship scenarios (AA, HA, HH) and isolating maintainability effects.
For each instance, authorship scenarios are constructed:
- HA: Human implementation for the initial task followed by agent resolution of the downstream issue.
- AA: Agent for both initial implementation and follow-on issue.
- HH: Human for both steps (serves as baseline).
This setup isolates the effect of initial code authorship on downstream agent performance, holding the task and evaluation fixed. Notably, the study focuses on HA vs AA, reflecting real-world usage where agents extend codebases of mixed provenance.
Experimental Design
CodeThread was applied to four state-of-the-art coding agents (Claude 4.5 Sonnet, GPT-5, GLM 4.7, MiniMax 2.5) and four diverse software engineering benchmarks (SWE-Bench Verified, SWE-Bench Multilingual, SWE-Bench Pro, FeatBench), covering bug fixes, feature implementations, and refactorings across multiple languages.
Rigorous filtering ensured that initial agent code (PR1​) did not already solve the downstream issue, maintaining task separation. Resolution rates after both steps (PR2​) served as the quantitative proxy for maintainability: whether the agent could successfully resolve the downstream issue, depending on whether it built on agent or human code.
Empirical Results
Across 1,377 instances and all model-benchmark pairs, agents consistently exhibited lower downstream resolve rates when building on agent-authored code versus human-authored code. The largest observed drop reached 13.1% (GLM 4.7 on SWE-Bench Pro). Refactoring and feature implementation tasks exhibited the greatest declines, supporting the claim that maintainability costs are most pronounced for complex, multi-file operations.
Figure 2: An instance where both human and agent code initially pass tests, but a subsequent agent edit fails on agent code and succeeds on human code, highlighting maintainability divergence.
Figure 3: Distributional comparison shows that HA wins are driven by behavioral drift, increased code size in AA, and task difficulty, while static metrics do not separate outcomes.
Statistical analysis demonstrated that traditional software maintainability metrics (e.g., cyclomatic complexity, Halstead volume, cognitive complexity, logical lines of code) failed to explain the observed performance gap. Instead, the most significant predictors were:
- Behavioral drift in input validation and error handling: Agents often introduce subtle changes in exception handling or input gating undetected by static metrics, which propagate silent bugs or maintenance friction.
- Downstream code size difference: Larger edit volumes in AA PR2​ relative to HA correlate with failure.
- Task difficulty: Easier tasks amplify the gap in maintainability between agent and human code.
Per-instance attribution using LLM-as-a-judge confirmed that behavioral drift surviving downstream edits directly causes task failure in 20.6% of discordant cases; in 85.9% of cases, agent-introduced drift persists uncorrected, compounding over successive agent modifications.
Analysis of Maintainability Metrics
The authors performed logistic regression on discordant cases (where HA and AA chains produced different outcomes), extracting features from static maintainability proxies, patch localization overlaps, behavioral drift labels, and task difficulty controls. Only subtle behavioral differences (not captured by traditional metrics) significantly predicted maintainability failures.
Regression results showed:
- Traditional metrics (cyclomatic complexity, Halstead volume, lines of code) are insufficient for maintainability prediction in this agent-centric setting.
- Input validation/error contract drift and downstream code size change exert the strongest effect on resolution odds.
Practical and Theoretical Implications
The findings have critical implications for both benchmark design and agent deployment:
- Code authored by agents is not equivalently maintainable as human code, even when both satisfy immediate correctness.
- Static proxies are inadequate; maintainability evaluations must consider behavioral compatibility, input contracts, and exception semantics.
- Maintainability costs induced by agent code are likely to compound over longer edit chains, suggesting that technical debt from agent patches may present growing risks as agent contribution increases in real-world repositories.
From a theoretical perspective, this challenges the current paradigm of agent evaluation, which prioritizes functional correctness over evolution-driven metrics.
Limitations and Directions for Future Research
The study is limited to two-step chains; future work should extend to longer-horizon trajectories to examine compounding effects empirically. The setting in which humans build on agent code (the AH scenario) was not explored due to the high cost of scaling up human contributions. Further research should develop scalable methods for capturing behavioral drift, error compounding, and agent co-evolution in multi-developer, multi-agent environments.
Conclusion
Building on agent code reliably lowers downstream resolution rates compared to building on human code, with the maintainability gap driven by subtle behavioral drift and task complexity rather than conventional structural or verbosity metrics. As agent contributions increase, long-term maintainability assessments must become central to agent evaluation, focusing not just on immediate patch correctness but on behavioral compatibility and downstream impact. This necessitates new benchmarks and metrics sensitive to behavioral drift, input contract integrity, and code evolution dynamics.