arXiv:2610.18206cs.SEOct 2026

Manuscript Offprint

arXiv:2610.18206

SWE-MISBEHAVIOR: Benchmarking and Mitigating Boundary Violations in Software Coding Agents

Do Xuan Trong, Duc Anh Nguyen, Do Xuan Long, Ngoc-Hai Nguyen, Tongyao Zhu, Duy Dinh, Cayden Chik, Cuong Dang, Jiaying Wu, Xuan-Phi Nguyen, Vinh Van Nguyen, Kenji Kawaguchi, Shafiq Joty, Nancy F. Chen, Min-Yen Kan

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

Do Xuan Trong ∗1,5^{*1,5}, Duc Anh Nguyen ∗1,2^{*1,2}, Do Xuan Long †1,3^{\dagger1,3}, Ngoc-Hai Nguyen 1,4^{1,4}, Tongyao Zhu 1^{1}, Duy Dinh 1^{1}, Cayden Chik 1^{1}, Cuong Dang 6^{6}, Jiaying Wu 1^{1}, Xuan-Phi Nguyen 7^{7}, Vinh Van Nguyen 5^{5}, Kenji Kawaguchi 1^{1}, Shafiq Joty 7^{7}, Nancy F. Chen 3^{3}, Min-Yen Kan 1^{1}

1^{1}National University of Singapore, 2^{2}University of Virginia, USA,

3^{3}Agency for Science, Technology and Research (A*STAR), Singapore, 4^{4}Tufts University, USA,

5^{5}Vietnam National University, Hanoi, 6^{6}Virginia Tech, USA, 7^{7}Salesforce AI Research, USA

Abstract

We present SWE-MISBEHAVIOR, the first taxonomy and evaluation framework for diagnosing boundary-violating misbehaviors in coding agents. It contains 7.4K human-in-the-loop synthesized samples spanning three layers of agent action space: (i) Code Generation, (ii) File Management, and (iii) System Interaction. Across these categories, SWE-MISBEHAVIOR covers 11 distinct misbehaviors with a fully automated evaluation protocol, including coding-action violations, Create/Read/Update/Delete (CRUD) file misbehaviors, system integrity and abuse violations, and task-goal misalignment. Experiments on state-of-the-art open-source coding agents (e.g., OpenHands, smolagents) reveal substantial misaligned behaviors, including dependency misinterpretation (up to 98.5% of cases), unintended modification of user inputs (50.5%), and silent compromise of environment integrity (53%). Motivated by these findings, we further propose CODE-KIT, a lightweight adaptive framework that combines misbehavior-aware guidelines with novel tools to help agents avoid such failures. CODE-KIT reduces misbehaviors by 52% for smolagents and 32% for OpenHands, while simultaneously improving task completion performance. Our code and data are available at this url.

1 Introduction

LLM-based coding agents such as Codex (Chen et al., 2021), Copilot (Microsoft Corporation, 2026), and Claude Code (Anthropic, 2026) have transitioned rapidly from research prototypes to production tools used by millions. Originally conceived as code generators, they have evolved into autonomous agents capable of interacting directly with complex coding environments: they navigate repositories, modify codes, invoke shell commands, and execute tests to achieve natural-language objectives. By automating routine engineering tasks, they substantially accelerate software development while alleviating the cognitive burden on human developers (Dong et al., 2025).

However, such autonomy introduces a new class of threats that are both severe and often irreversible. A coding agent with write and execute access can silently corrupt working code, break downstream dependencies, and degrade repository integrity (Loker, 2025). In extreme cases, agents have been reported to delete entire production databases and their backups in seconds, causing serious organizational consequences (Business Insider, 2026). As agents gain broader action spaces and tool access, the risk of such misbehavior escalates accordingly.

Despite such consequences, no existing benchmark evaluates these misbehaviors. Existing software engineering ones like SWE-bench (Jimenez et al., 2024) and BigCodeBench (Zhuo et al., 2025) focus on end-task success (see Appendix Table 8), leaving a critical blind spot: agents may complete, partially complete, or attempt a task while silently violating operational boundaries. With write and execute privileges, an agent can unknowingly corrupt working code, break downstream dependencies, and degrade repository integrity. Recent work examines pull-request rejections (Ehsani et al., 2026; Ferdous et al., 2026), but is confined to CI failures and API-breaking changes. It misses the broader spectrum of misbehavior—silent corruption of unrelated files, abuse of system privileges, unintended alteration of user inputs—and the trajectory-level signals (execution logs, environment state, resource use) that surface them.

We introduce SWE-MISBEHAVIOR, the first taxonomy, benchmark, and evaluation protocol for coding-agent misbehavior. SWE-MISBEHAVIOR comprises 7.4K samples drawn from 115 real-world repositories and 1,384 scripts with human-curated prompts, spanning three layers of a cod-

∗^{*}Equal contribution. Works done during the internship at WING, NUS.

†^{\dagger}Project lead. Correspond to xuanlong.do@u.nus.edu.

Figure

(a) Data construction pipeline

Figure

(b) Data analysis

Figure

(c) Representative examples of SWE-MISBEHAVIOR

Figure 1: Overview of SWE-MISBEHAVIOR. (a) Data construction pipeline: from source data, we perform dependency analysis to categorize into file-context and repository-context samples, construct task families, and generate prompt variants via template-based diversification. (b) Benchmark composition across three task families. (c) Representative samples from our dataset.

ing agent’s action space: Code Generation (function, file, repo), File Management (deletion, irrelevant deletion, addition, appending), and System Interaction (execution, testing). It benchmarks 11 misbehaviors (see Table 1) with a fully automatic evaluation protocol, covering four code-level, four CRUD-level, two system-level, and one task-goal metric. Our comprehensive experiments reveal important findings about agent misalignment: state-of-the-art ones such as OpenHands (Wang et al., 2025a), smolagents (Roucher et al., 2025b) and Claude Code (Anthropic, 2026) fail to correctly read dependencies in up to 98.5% of cases, inadvertently modify user input in 50.5%, and silently compromise environment integrity in 53% cases.

Crucially, we find that these are not knowledge failures that better prompting could resolve; they are action-control failures where agents misuse their available tools. Mitigation therefore requires intervening at the action space rather than at the prompt level, providing a tool interface that mitigates such misbehaviors. Building on this principle, we introduce CODE-KIT, an adaptive approach that equips agents with misbehavior-aware guidelines and skills-purpose-built tools designed to enhance the agents. CODE-KIT reduces misbehaviors by up to 52% while simultaneously improving overall task performance. Our contributions are summarized as follows:

• We frame coding-agent reliability as an action-boundary problem across code edits, file-system operations, and system interactions.

• We introduce SWE-Misbehavior, a 7.4K-instance benchmark with automatic metrics for diagnosing boundary violations and diagnostic failures across real repositories.

• We show that state-of-the-art coding agents exhibit pervasive hidden misbehaviors beyond task failure, and that mitigation requires action-space support: CODE-KIT reduces average misbehavior by up to 52% while preserving task performance.