Manuscript Offprint

arXiv:2610.24949

Over-Defense in Coding Agents Begins at Silent Forks

Hanjun Luo, Xuecheng Liu, Xiucheng Zhang, Zhuoning Xu, Yingbin Jin, Yankai Chen, Xue Liu, Hanan Salam

Abstract

Language models behind coding agents are post-trained with outcome rewards, and recent methods concentrate credit on the turns that decide the outcome. We find that defensive actions beyond what a task requires escape both. They begin at silent forks, the turns where every next action leads to the same outcome. Such actions leave the success rate unchanged, and frontier models take the disproportionate branch there in up to 91% of decisive actions under implicit budgets. The most direct fix, a checker in the trajectory reward, reaches these forks only through fully proportionate trajectories, leaving 74% of GRPO groups with identical rewards and behavior unchanged. This motivates a rethink of where learning signals belong, namely where behavior diverges, which a behavioral checker can locate and the outcome cannot. Our method, ForkDPO, contrasts a proportionate and a disproportionate action at the same prefix, at silent forks on both sides of the required behavior. On a test set of unseen repositories, it lowers a 4B model's disproportionate behavior from 70.3% to 58.9%, against 67.7% for DPO at randomly chosen turns, establishing behavioral divergence as a learning signal for how agents act beyond whether they finish. The code is publicly available. 1^{1}

1 Introduction

Coding agents now resolve repository-level tasks with little human supervision (Jimenez et al., 2024; Wang et al., 2025c), and the language models behind them are increasingly post-trained with task success as the reward (Wei et al., 2025; Pan et al., 2025). While working on a task, the agent also decides how many defensive actions to take, such as which tests to run, how often to rerun them, and what to check before submitting. Language models often do more than a task needs (Chen et al., 2025; Qian et al., 2025), and in coding much of this excess is defensive. For example, agents rerun the same test on unchanged code (Bouzenia and Pradel, 2025). Defensive actions beyond what a task requires are known as over-defense, and even when the task rules such an action out, frontier models take it in 11.2–58.7% of runs (Luo et al., 2026).

Current post-training locates learning signals by the outcome. An outcome reward only tells the model whether the task succeeded, and recent methods go further by concentrating credit on the turns that decide the outcome (Zhang, 2026; Zheng et al., 2025; Lin et al., 2025). For instance, process verifiers score each step by the change in the chance of success before and after it (Setlur et al., 2025), and tree-search RL branches at the most uncertain tokens and credits each step by how much it raises the success rate (Hou et al., 2025). These methods share the premise that the turns worth learning from are those where the choice changes the outcome, so a turn whose outcome is already settled receives no signal (Lei et al., 2026).

To find where over-defense begins, we replay the commands of successful trajectories with a behavioral checker and mark the first action beyond what the task requires. We find that over-defense begins at forks whose outcome is already settled. Prior work calls a point a fork when resampling there leads to very different outcomes (Bigelow et al., 2025), and over-defense arises in the opposite case. As shown in Figure 1, once the requested test has passed, submitting and running the test again both pass the task oracle. We call such a turn a Silent Fork, one at which the agent's next actions differ in proportionality while all of them lead to the same outcome. In our experiments, almost every fork where over-defense begins leaves the repository unchanged on both branches, and over-defensive runs succeed as often as the rest. When the instruction leaves the checking budget implicit, four frontier

†^{\dagger}Corresponding author: Hanan Salam. Contact: Hanjun Luo, h16266@nyu.edu.

1^{1}https://github.com/Astarojth/silent-forks

Figure

Figure 1: Over-defense begins at silent forks. After the requested check passes, submitting, rerunning it, and running the full suite all pass the oracle at different cost, invisible to outcome rewards but not to a behavioral checker. The right panel shows frontier models over-defend too, and on implicit-budget test tasks ForkDPO, which places pairs at silent forks, cuts disproportionate behavior and median run time (143 to 90 s) more than GRPO and DPO.

models given the prefixes of these forks take the disproportionate branch in up to 91% of their decisive actions, those that test, check, or submit.

Silent forks explain why outcome signals cannot reach over-defense. Every action at a silent fork has the same value under an outcome reward, so the policy gradient there vanishes. The most direct fix adds the checker to the trajectory reward, much as length-controlled RL penalizes overly long reasoning (Aggarwal and Welleck, 2025). Such a signal reaches a fork only through trajectories that are proportionate at every fork, and these become rare as tasks grow longer. We train with this reward using GRPO (Shao et al., 2024), a common outcome-based RL algorithm that learns only from reward differences within a group of rollouts (Yu et al., 2025). In 71% of implicit-budget groups every rollout receives the same reward, and after 12 rounds the disproportionate rate is no lower.

These observations motivate a rethink of where learning signals for agent behavior belong. Current methods learn at the turns where the outcome changes, whereas over-defense is decided at turns where it does not, so the signal has to be located by behavior and placed where behavior diverges. Locating the signal by behavior also removes the per-turn Monte Carlo rollouts (Wang et al., 2024; Kazemnejad et al., 2025) that estimate a success probability constant at silent forks. We let the behavioral checker decide where to learn. It marks the first turn at which a successful trajectory departs from proportionate behavior, and the model, resampled from the same prefix, supplies the proportionate alternative. To teach the model to check as much as the task requires, we also pair silent forks at which submitting would skip a required check, constraining the other side of the required behavior. Our method, ForkDPO (fork-level DPO), applies preference optimization (Rafailov et al., 2023) to both pair sets. On 48 test tasks from unseen repositories, it lowers the implicit-budget disproportion rate of a 4B model from 70.3% to 58.9% and, by removing repeated runs and extra checks, cuts the median run time from 143 to 90 seconds, whereas DPO with pairs at random turns leaves the rate at 67.7%.

Our contributions are summarized as follows:

① Silent-Fork Diagnosis. We identify silent forks as the turns where over-defense begins in coding agents, from a 4B model to 4 frontier models, and show that outcome signals vanish while a checker in the trajectory reward reaches them only through fully proportionate trajectories.

② Rethinking Where to Learn. We show learning signals for agent behavior belong at the turns where behavior diverges, which a behavioral checker can locate and the outcome cannot. We instantiate this as ForkDPO, which learns from fork-level pairs on both sides of the required behavior, so that post-training shapes how agents act beyond whether they finish.

③ Experimental Validation. On 48 test tasks from unseen repositories, signals at silent forks cut disproportion by 11.4 points and run time by 37%, which GRPO and DPO at random turns do not, and pairs on both sides of the required behavior are necessary.

References (19)