arXiv(opens in a new tab)cs.SEOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.36346

Your Wish Is My Commit: Over-Compliant Refactoring in AI Coding Agents

Haocong Jiang, Sadra Sabouri, Sepand Haghighi, Souti Chattopadhyay

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Haocong Jiang 1,∗^{1,*}, Sadra Sabouri 1,∗^{1,*}, Sepand Haghighi 2^{2}, Souti Chattopadhyay 1^{1}

1^{1}University of Southern California, Los Angeles, CA, USA

2^{2}Open Science Lab

{allenjia, sabourih, schattop}@usc.edu, sepand@openscilab.com

Abstract—Large language models are known to be sycophantic, over-complying with users even when doing so is unproductive. When these models act as coding agents, this can be costly: an agent that keeps editing after no edit improves the code writes churn, technical debt, and review burden into the codebase. Yet the consequences of sycophancy in software engineering remain largely understudied. To understand them, we run a controlled study of iterative refactoring, an open-ended task with no stopping criterion, where any edit an agent makes once the code is already clean reflects compliance rather than improvement. Across algorithmic (n=50) and object-oriented (n=10) suites, we repeatedly ask two widely used agents, Codex and Claude Code, to refactor further across five models. Over 3,000 turns, we define six behavioral signals of over-compliance. We hypothesized that a capable agent would stop once it recognized an optimized codebase; none did. Every model kept editing, rewriting up to 31x the original codebase before first stopping and resuming edits even after declaring the task complete. Over-compliance is a costly, multi-turn behavior that compounds with every turn, and our six signals give developers and tool builders a way to detect and curb it.

Index Terms—Coding Agents, Sycophancy, Over-Compliance, AI for Software Engineering

I. INTRODUCTION

Large language models often adapt to a user's apparent preferences rather than to the task at hand. Prior work calls this sycophancy: models agree with stated views, praise weak arguments, and revise correct answers after pushback [1]–[3]. The behavior appears across question answering, advice, and reasoning, which marks it as a property of how models are trained and aligned, not an artifact of any one prompt [1], [2], [4]. A model that optimizes for approval over correctness reinforces mistaken assumptions, suppresses useful disagreement, and weakens the user's reliance on its judgment [5]–[7].

A coding agent is the same model placed in a development harness [8], [9]. Because sycophancy is a model-level behavior, it should carry over into software engineering, where developers now rely heavily on these models: a large majority already use or plan to use AI coding tools [10], [11]. A coding agent does not return text to read; it edits artifacts that are committed, reviewed, and maintained. An agent that keeps editing to fulfill the user's wishes, after the edits stop improving the code, writes that compliance into the codebase as unnecessary code, technical debt, wasted generation, and added review burden [12]–[14].

Two lines of work bear on this behavior but miss it. Studies on natural-language benchmarks show that sycophancy is real and systematic, but observe it only where the artifact is the model's reply [1], [2], [4]. Benchmarks for coding agents measure whether agents resolve issues and pass tests [8], [9], [15], rewarding a correct change but never the absence of one. Whether coding agents are over-compliant, editing code to satisfy a request rather than improve it, remains unmeasured.

The process of refactoring uniquely isolates this behavior. A refactoring request is open-ended: “clean this up” admits many responses and rarely carries a stopping criterion [16]. When further editing is no longer warranted, a calibrated agent should decline; any edit it then makes reflects compliance, not improvement. Such edits are not free: code churn is a known predictor of defects [17], AI-assisted coding has been linked to rising churn and quality decline [13], and larger changes are harder to review effectively [18], [19], with a deployed LLM reviewer shown to slow pull requests and introduce unnecessary corrections [20], [21]. This gap matters most for novice and vibe coders, who drive agents through natural-language prompts without a clear sense of where the refactoring boundary lies [10], [11].

We study iterative refactoring under these conditions and ask four questions. RQ1: How many turns does an agent take to stop editing? A calibrated agent completes refactoring after one warranted pass. RQ2: How much code does it change before stopping? The volume of unnecessary change measures the direct cost of this phenomenon. RQ3: Once an agent stops, does it stay stopped? Editing after stating that no change is needed is a stronger failure than stopping late, because the agent acts against its own stated judgment. RQ4: What kind of changes do the extra turns produce? Disciplined refactoring and incidental churn carry different maintenance costs.

To answer these questions, we run our experiments on two suites of controlled codebases: canonical solutions to algorithmic problems (n=50) and object-oriented Java from [22] course assignments (n=10). We drive two widely used agents, Codex and Claude Code, across five models (GPT-5.4, GPT-5.4-mini, GPT-5.5, Claude Sonnet 4.6, and Claude Opus 4.8) through their command-line interfaces. At each of 10 turns, a simulated developer agent asks the coding agent to

∗^{*}Equal contribution.

refactor further without naming a file, a target, or a reason, so any change between turns is the agent's own choice. We record every line-level and structural change and define six signals, built on differences in lines and Code Structure Tree [23], that turn “the agent kept editing” into measured quantities.

Our results show that over-compliant refactoring is not a rare case, but a persistent multi-turn behavior. Rather than reliably stopping when the code is already adequate, every model continues editing. The resulting changes produce substantial churn, introduce and remove structure across turns, and continued editing even after the agent indicates that no further refactoring is needed. These findings show that coding-agent sycophancy can manifest as operational compliance in code, not just agreement in language. By characterizing this behavior and measuring it with concrete signals, our work provides a basis for evaluating over-compliance in coding agents.

References (45)