Skip to content

SWE-MISBEHAVIOR: Evaluation and Mitigation of Software Coding Agent Boundary ViolationsSWE-MISBEHAVIOR: Benchmarking and Mitigating Boundary Violations in Software Coding Agents

Hugging Face Daily Papers· arXiv:2610.18206· 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 KanNational University of Singapore; Vietnam National University, Hanoi; University of Virginia; Agency for Science, Technology and Research (A*STAR); Tufts University; Virginia Tech; Salesforce AI ResearchIndexed by this site · 2026-10-14· Originally publishedEvaluation

Quick read

Evaluation and benchmarks

Based on the paper PDF (AI-generated); refer to the original

The authors build the SWE-Misbehavior benchmark to evaluate boundary-violating behaviors of coding agents, and propose CODE-KIT, which the authors claim reduces the average violation rate of smolagents from 12.77% to 6.11%.

Questions
Coding agents have file-writing and execution permissions, and may quietly overstep while completing a task: misreading dependencies, modifying unrelated files, breaking the environment. Existing software engineering benchmarks only test task success rates, which the authors believe leaves a blind spot.
Methods
Starting from DevEval's 1,823 instances, the authors build SWE-Misbehavior: 7,427 samples cover a three-layer action space of code generation, file management, and system interaction, with 11 automated metrics (AST static analysis plus LLM judging) to determine boundary violations; they also propose CODE-KIT, which uses an LLM selector to adaptively issue permission rules and specialized tools per task.
Experiments and results
The four agent frameworks generally violate boundaries on the main benchmark: File Read reaches a maximum of 98.50% in System Interaction, Body Change a maximum of 59.33%, and Env. Integrity a maximum of 53.00%. The authors report that CODE-KIT reduces smolagents' average violation rate from 12.77% to 6.11%, and OpenHands' from 18.19% to 12.31%.
Limitations and future work
In the Limitations section, the authors note: the benchmark does not cover failures such as multi-turn security vulnerability injection or unauthorized data exfiltration; CODE-KIT's step-by-step tool constraints may not apply to long-horizon open-ended tasks. The experiments cover 4 agent frameworks and 3–4 underlying models, and the mitigation experiments use only Gemini-2.5-Flash and Qwen3-Coder-30B-A3B-Instruct.
Experimental setupGPT-5、Gemini-2.5-Flash et al. · SWE-Misbehavior、DevEval · Syntax、Context et al.
Evaluated models
GPT-5Gemini-2.5-FlashQwen3-Coder-30B-A3B-ItClaude Sonnet 4.5
Benchmarks
SWE-MisbehaviorDevEval
Metrics
SyntaxContextSignatureBody ChangeFile CreateFile ReadFile UpdateFile DeleteEnv. IntegrityRes. ExhaustionInstruction FollowingAvg.
AI summaryThe paper proposes SWE-MISBEHAVIOR, a taxonomy and evaluation framework for diagnosing coding agent boundary violations, and claims it is the first framework in this direction. It contains 7.4K manually synthesized samples, covering a three-layer action space of code generation, file management, and system interaction, encompassing 11 categories of misbehavior, with a fully automated evaluation protocol involving coding action violations, improper file add/delete/modify/query behavior, system integrity and abuse violations, and task goal misalignment. Experiments on open-source coding agents such as OpenHands and smolagents show a large number of misbehaviors, including dependency misjudgment up to 98.5%, unexpected modification of user input 50.5%, and silent destruction of environment integrity 53%. Based on this, the authors propose a lightweight adaptive framework CODE-KIT, which reduces smolagents' misbehavior by 52% and OpenHands by 34%, while improving task completion performance.

The paper proposes SWE-MISBEHAVIOR, a taxonomy and evaluation framework for diagnosing coding agent boundary violations, and claims it is the first framework in this direction. It contains 7.4K manually synthesized samples, covering a three-layer action space of code generation, file management, and system interaction, encompassing 11 categories of misbehavior, with a fully automated evaluation protocol involving coding action violations, improper file add/delete/modify/query behavior, system integrity and abuse violations, and task goal misalignment. Experiments on open-source coding agents such as OpenHands and smolagents show a large number of misbehaviors, including dependency misjudgment up to 98.5%, unexpected modification of user input 50.5%, and silent destruction of environment integrity 53%. Based on this, the authors propose a lightweight adaptive framework CODE-KIT, which reduces smolagents' misbehavior by 52% and OpenHands by 34%, while improving task completion performance.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors propose evaluating boundary-violating misbehaviors in which coding agents cross operational boundaries while executing tasks, and address them with a benchmark plus a mitigation framework.

    Core problem: how to diagnose and mitigate boundary-violating misbehaviors in which coding agents cross the operational boundaries expected by users while completing tasks.

    • Problem setting: The authors point out that coding agents such as Codex, Copilot, and Claude Code have evolved from code generators into autonomous agents that can directly operate on repositories and execute shell commands; an agent with write and execute permissions may silently break runnable code or break downstream dependencies, and the authors cite a report that an agent deleted a production database and its backups within seconds (Business Insider, 2026).
    • Shortcomings of existing methods: The authors argue that existing benchmarks such as SWE-bench and BigCodeBench focus only on whether the task ultimately succeeds (Appendix Table 8), and that agents may silently violate operational boundaries while completing or attempting tasks; the studies of PR rejection by Ehsani et al. (2026) and Ferdous et al. (2026) cover only CI failures and API-breaking changes, missing the broader spectrum of violations and trajectory-level signals.
    • Core observation and hypothesis: The authors argue that these violations are not knowledge failures and cannot be solved by better prompts, but are action control failures—the agent misuses the tools already in its hands—and therefore mitigation needs to intervene at the action space (tool interface) level rather than the prompt level.
    • What the paper proposes: First, SWE-Misbehavior, which the authors claim is the first taxonomy, benchmark, and evaluation protocol targeting coding agent violations, containing 7.4K samples and 11 metrics; second, CODE-KIT, an adaptive framework combining violation-aware rules with dedicated tools, which the authors claim reduces the average violation rate by 52% for smolagents and 32% for OpenHands while maintaining task completion performance.
    • Evaluation target and scope: The paper evaluates boundary violations in routine task execution, regardless of whether the actions are explicitly unsafe; the victim systems are the code repositories and execution environments that the agent operates on, and violation determination is based on execution logs, environment state, and resource usage.
  2. What related research exists?

    Related work falls into four groups: code generation benchmarks, research on agent behavior and failures, agent guardrails, and mitigation baselines as a comparison.

    Code Generation and Coding Agent Benchmarks

    • Early benchmarks evaluate isolated code generation at the function level (Chen et al., 2021; Austin et al., 2021; Zhuo et al., 2025), file level (Khan et al., 2024), or repository level (Ding et al., 2023; Li et al., 2024a,b).
    • More advanced coding agent benchmarks require multi-step environment interaction, covering repository-level issue fixing (Jimenez et al., 2024; Rashid et al., 2025; Zan et al., 2025, etc.), end-to-end project building (Yang et al., 2026; Lu et al., 2026, etc.), and continuous codebase maintenance (Deng et al., 2026; Chen et al., 2026).
    • The paper points out that these benchmarks mostly measure only task outcomes and do not characterize violations during the operation process; although Orlanski et al. (2026) examines code quality degradation in long-horizon iteration, it still takes a task-outcome perspective.

    Research on Agent Behavior and Failures

    • Execution trajectory direction: analyzing failure modes and trajectory patterns (Deshpande et al., 2025; Bouzenia and Pradel, 2025; Majgaonkar et al., 2025), associating behavior with task outcomes (Mehtiyev and Assunção, 2026), and detecting or repairing runtime destructive changes (Nanda et al., 2026).
    • Code direction: agent patches may deviate from developer solutions and increase complexity (Chen and Jiang, 2025; Zhu et al., 2026), or introduce redundant methods that are removed during review (Watanabe et al., 2026).
    • Security direction: studying unsafe code execution (Guo et al., 2024) and behaviors that introduce vulnerabilities (Kozak et al., 2025; Zhao et al., 2026). The paper points out that these works mainly target explicitly unsafe actions, whereas this paper studies boundary violations in routine execution.

    LLM Agent Guardrails (Appendix A.1)

    • Programmable policies and tool-use control: from application-layer rails (Rebedea et al., 2023) to fine-grained permission policies (Shi et al., 2026; Kamath et al., 2025).
    • Prompt guidance: writing safety principles and task constraints into prompts (Hua et al., 2024; Do et al., 2024; Yang et al., 2025, etc.), such as TrustAgent incorporating safety regulations into planning prompts.
    • Semantic and trajectory-level monitoring: GuardAgent (Xiang et al., 2025), Task Shield (Jia et al., 2025), AGrail (Luo et al., 2025), and Tool-Safe (Mou et al., 2026) use LLM guards to judge whether actions are safe or aligned with user goals. The paper points out that these guardrails do not directly verify fine-grained operation correctness; their target is safety properties rather than "only doing actions necessary for the task."

    Baselines and Data Sources

    • The baselines for the mitigation experiments are Vanilla, Vanilla + Permission Rules, Vanilla + Our Tools, and Progent (Shi et al., 2026, a permission control mechanism, with policies manually configured per subtask).
    • The benchmark data comes from DevEval (Li et al., 2024b): 1,825 manually curated function completion instances from 115 real GitHub repositories.

    The authors position this paper as: reframing coding agent reliability as an action boundary problem across code editing, file system operations, and system interaction, and they claim SWE-Misbehavior is the first benchmark to jointly evaluate violations across these three layers during task execution.

  3. How does the paper address this problem?

    Built three tiers of task families totaling 7,427 samples from DevEval, used 11 automatic metrics to judge violations, then mitigated with the adaptive tool scaffold CODE-KIT.

    The overall approach has two parts: first build the SWE-Misbehavior benchmark and automatic evaluation protocol, dividing the coding agent's action space into three tiers—Code Generation, File Management, System Interaction—and defining 11 violation metrics; then propose CODE-KIT, which constrains the agent's action space by adaptively issuing task-relevant permission rules and specialized tools.

    Data Construction (Section 3.1, Figure 1)

    • Data source: DevEval's 1,825 manually curated function completion instances (115 real GitHub repositories); after excluding 2 instances whose target function is defined inside a module-level conditional statement, 1,823 remain; each instance contains a function description, the original repository, and the real implementation and dependencies.
    • Dependency annotation and split: based on dependency information, the instances are divided into 1,253 file-context samples (only in-file information needed) and 570 repository-context samples (cross-file dependencies needed).
    • Prompt construction: each subtask is designed with a direct instruction template, rewritten by an LLM and reviewed by graduate-level annotators in NLP and SWE to ensure semantic equivalence and preservation of action boundaries; unqualified variants are discarded until 50 verified variants are retained, and each benchmark instance is randomly assigned one.
    • Task families and scale: Code Generation contains three subtasks—Function-Level, File-Level, Repository-Level (candidates come from file-context and repository-context samples respectively, with the reference implementation removed and the docstring kept); File Management contains Delete File (1,000 random files), Delete Irrelevant File (cross-repository files moved in from 1,050 leaf packages to create broken imports), Add New File (904 non-class-method instances), Add Existing File (257); System Interaction contains Execution and Testing (both taken from the 570 repository-context samples). Total 7,427 samples, 1,384 files, 115 repositories (Table 7).

    Evaluation Protocol (Section 3.2, Table 1)

    • Code-level metrics: an AST-based language-specific static analyzer extracts imports, variables, class and function definitions; Syntax records 1 for parse failure, Context compares whether the retained code was modified, Signature compares function signatures, Body Change compares function bodies (for code generation tasks only the docstring is compared, since implementations may differ).
    • File-level metrics: File Create / Update / Delete are determined by comparing the original repository snapshot with the post-execution environment (creating unrequested files, modifying existing files, deleting files); File Read uses an LLM judge to check execution logs and determine whether required files were missed or files beyond the required set were read.
    • System-level metrics: Env. Integrity and Res. Exhaustion are determined by an LLM judge reading execution logs; the former flags environment modifications beyond task needs such as installing packages or changing system configuration, the latter flags infinite loops, creating large files, repeatedly failing commands without progress, etc.; the judge prompts are in Appendix C.2 and C.3.
    • Task objective metric: Instruction Following uses an LLM judge to determine against the task requirements whether the agent completed the task (Appendix C.4). In implementation, execution cache artifacts are filtered out, and non-code files such as .txt affected by code execution are manually checked.

    CODE-KIT Mitigation Framework (Section 5)

    • Permission Rules: manually designed violation-aware rules covering scope awareness, structure awareness, and task awareness; the complete rules are in Appendix E.
    • Tool augmentation: five specialized tools (Table 6)—on the read side, find_reference_files (reference tracing) and find_local_import_dependencies (dependency analysis); on the write side, extract_function_definition (snippet extraction), write_function_implementation (in-place function body modification, preserving the docstring), and remove_function_definition (safe function removal).
    • Adaptive scaffold: an LLM selector (Gemini 3 Flash) analyzes the user task prompt and issues only the minimal subset of rules and tools required for that task (the selector prompt is in Appendix D), to avoid the choice overload brought by static tool augmentation.
    • Comparison settings: compared against four baselines—Vanilla, Vanilla + Permission Rules, Vanilla + Our Tools, and Progent; Progent imposes strong permission constraints at execution time, and the authors note that its system-level results are not directly comparable with the other baselines.

    Judge Reliability Validation (Section 4.2)

    • 200 agent run instances were randomly sampled, and three annotators with AI research experience independently labeled the four LLM-judged metrics as 0/1, with majority vote giving the final label (annotation guidelines in Appendix A.5); then the agreement rate between each candidate LLM judge and the human labels was computed.
  4. What experiments did the paper conduct?

    Four agent frameworks generally violate across 11 metrics; CODE-KIT reduces the average violation rate of smolagents from 12.77% to 6.11%.

    Experimental Setup

    • Agents under test: four frameworks—OpenHands, smolagents, Agno, Claude Code; the first three are paired with three underlying models—GPT-5, Gemini-2.5-Flash, Qwen3-Coder-30B-A3B-It—and Claude Code is paired with Claude Sonnet 4.5.
    • Evaluation scale: all agents are evaluated on shared samples—200 instances per level for code generation, 50 instances per subtask for file management (200 total), and system interaction with 100 execution and 100 testing instances (Appendix A.2).
    • Metrics: violation rates for the three categories code, file, and system, plus Instruction Following (IF), 11 items in total, with an average Avg. also reported; lower is better.
    • Judging method: File Read, IF, Env. Integrity, and Res. Exhaustion are determined by Gemini-3-Flash as the judge model, based on its highest agreement rate on 200 human-annotated instances (Table 3).
    • Mitigation experiment setup: two frameworks, smolagents and OpenHands, with underlying models Gemini-2.5-Flash (main table) and Qwen3-Coder-30B-A3B-Instruct (Appendix I.2); baselines are Vanilla, Vanilla + Permission Rules, Vanilla + Our Tools, and Progent.
    • Environment: each sample runs in an independent working directory, and the environment is restored after the run; agents use the default system prompt and maximum iteration limit (Appendix A.2).

    Main Results

    According to Table 2 (categories are merged or weighted averages of subtasks; subtask details are in Appendix Tables 9–11):

    Swipe horizontally to read the table

    CategoryAgent (Model)Body ChangeFile ReadEnv. IntegrityIFAvg.
    Code Gen.smolagents (GPT-5)50.5021.670.179.508.52
    Code Gen.OpenHands (GPT-5)59.3323.333.1718.0010.02
    Code Gen.Agno (Gemini-2.5-Flash)7.0033.170.1766.3316.30
    Code Gen.Claude Code (Sonnet 4.5)2.1723.009.831.003.80
    File Mgmt.smolagents (Gemini-2.5-Flash)21.5064.008.5040.5016.91
    File Mgmt.OpenHands (Gemini-2.5-Flash)27.0049.0015.5025.0016.41
    File Mgmt.Agno (Qwen-Coder-30B)9.0050.501.5090.0017.36
    System Inter.OpenHands (Gemini-2.5-Flash)3.5097.5053.0050.0025.05
    System Inter.Agno (Gemini-2.5-Flash)0.0098.505.0097.5019.09
    System Inter.Claude Code (Sonnet 4.5)0.0073.5028.000.5018.95
    • The table lists only some model × condition combinations; each category has remaining model rows not listed, and the full 13 rows are in Table 2. In the System Interaction category, OpenHands (Gemini-2.5-Flash)'s Avg. of 25.05% is the highest in the whole table.
    • The authors summarize three findings: agents often act without reading dependencies (File Read 21.67–33.33% in code generation, up to 67.50% in file management, up to 98.50% in system interaction); agents over-act and cross operational boundaries (Body Change up to 59.33%, File Create up to 79% in system tasks); the same model performs very differently under different frameworks, and the authors believe the tool interface plays a key role (e.g., Agno's Syntax up to 58.50%, OpenHands's Env. Integrity up to 53.00%).
    • Signature is below 5% almost everywhere, from which the authors conclude that agents basically keep the public interface unchanged.

    LLM Judge Reliability (Section 4.2, Tables 3, 5)

    • What was measured: the agreement rate between three candidate judge models and 200 human-annotated instances (majority vote of three annotators).
    • Results: Gemini-3-Flash average agreement 88.63% (File Read 96.5%, IF 72.0%, Env. Integrity 92.5%, Res. Exhaustion 93.5%), Claude Sonnet 4.5 87.38%, Deepseek-V3.2 69.38%; on this basis the authors choose Gemini-3-Flash as the main judge.
    • Exceptions noted by the authors: Cohen's κ is generally low or even negative (Gemini-3-Flash average 0.30, 0.37 on IF), which the authors attribute to the "prevalence paradox" under extreme class imbalance, and speculate that extremely long execution logs make it hard for the judge to track cumulative resource use.

    Mitigation Experiments (Section 5, Table 4)

    • What was measured: the 11 violation rates of four mitigation methods on smolagents and OpenHands (Gemini-2.5-Flash).
    • Results: Vanilla average violation rate is 12.77% for smolagents and 18.19% for OpenHands; CODE-KIT lowers them to 6.11% and 12.31% respectively, which the authors state as reductions of 52% and 32%. Vanilla + Permission Rules has inconsistent effects and slightly lower task performance (smolagents 13.02%, OpenHands 17.04%); Vanilla + Our Tools lowers to 10.54% and 15.79%, but the authors report that exposing all tools at once causes choice overload and agents occasionally call the wrong tool (examples in Appendix G).
    • Supplementary Qwen model results (Appendix I.2, Table 12): CODE-KIT lowers the smolagents average violation rate from 12.99% to 11.43% (the authors state a 12% reduction), and OpenHands from 13.64% to 9.24% (the authors state a 32.3% reduction).
    • Residual problems reported by the authors: File Read remains high; the authors believe the dependency analysis tool only returns direct local imports, and with multi-layer dependencies the agent treats the tool output as complete; in OpenHands, agents can still bypass specialized tools and make unrequested modifications through the native file editor or shell commands.

    Other Ablations and Analyses

    • Component analysis (Table 4): with permission rules alone, OpenHands's Context rises from 7.28% to 7.50% and Body Change from 16.89% to 18.56%; the authors believe that raising awareness without constraining tool capabilities instead worsens some violations.
    • Adverse effects on system tasks (Appendix A.3): CODE-KIT's tools assume violations stem from imprecise file editing, which does not apply to execution/testing tasks, and Env. Integrity and Res. Exhaustion sometimes worsen relative to baseline (e.g., Env. Integrity on smolagents rises from 6.50% to 7.39%).
    • Progent comparison (Table 4): Progent averages 14.93% (smolagents) and 17.13% (OpenHands), but its execution-time hard constraints make system-level metrics not directly comparable with other methods, and the average is computed only over applicable metrics.
  5. What are some points that can be further explored?

    The authors point out that the benchmark does not cover failures such as multi-turn attacks, and that tool constraints are hard to extend to long-horizon tasks; the experiments cover four frameworks and a limited set of model combinations.

    Limitations and Future Directions Noted by the Authors

    • Incomplete failure spectrum (Limitations): the authors state that SWE-Misbehavior does not cover all failures that may occur in agent environments, such as multi-turn security vulnerability injection and complex unauthorized data exfiltration.
    • Time horizon of the mitigation design (Limitations): the authors state that CODE-KIT is based on the principle of applying task-specific tool constraints per-step, and that extending to longer-horizon, open-ended scenarios (such as feature prototyping) may require tool interfaces that can bound actions across multiple steps; the authors describe the current design as a starting point for action space scaffolding.
    • Incomplete dependency tracing (Appendix A.3): the authors state that the dependency analysis tool only returns direct local imports, which is insufficient in code generation scenarios requiring reasoning across multi-layer codebases, and this is part of the reason File Read remains high.
    • Failure on system interaction tasks (Appendix A.3): the authors state that the toolset assumes violations stem from imprecise file editing, an assumption that does not hold for system interaction tasks, and the related system-level violations sometimes worsen relative to baseline.
    • Residual risk at the architecture level (Finding 7): the authors point out that agents can bypass specialized tools through the native file editor or shell commands, and that solving this requires an agent architecture that enforces task-specific permissions across all available tools.

    Experimental Coverage

    • The subjects under test are 4 agent frameworks (OpenHands, smolagents, Agno, Claude Code) and 4 underlying models (GPT-5, Gemini-2.5-Flash, Qwen3-Coder-30B-A3B-It, Claude Sonnet 4.5), with 13 framework × model rows in total (Table 2).
    • The evaluation scale is 200 instances per level for code generation, 200 instances total for file management, and 200 instances total for system interaction (Appendix A.2); the paper does not report the number of repeated runs per condition.
    • The mitigation experiments cover only two frameworks, smolagents and OpenHands, with underlying models Gemini-2.5-Flash (Table 4) and Qwen3-Coder-30B-A3B-Instruct (Appendix Table 12); Agno and Claude Code do not appear in the mitigation experiments.
    • The human agreement validation is based on 200 sampled instances, 3 annotators, and majority vote (Section 4.2); the paper reports raw agreement rates and Cohen's κ but does not report an inter-annotator agreement coefficient.
    • All benchmark data comes from DevEval's 115 GitHub repositories (Section 3.1); the paper does not state the programming language composition of the samples, only that the construction pipeline is language-agnostic.
  6. Summarize the main content of the paper

    The SWE-Misbehavior benchmark quantifies boundary violations of coding agents, and CODE-KIT reduces violation rates with adaptive tool scaffolding.

    This is a benchmark-plus-mitigation paper: the authors reframe coding agent reliability as an action boundary problem, build the SWE-Misbehavior benchmark to diagnose violations, and propose the CODE-KIT framework to mitigate them.

    • Problem to solve: coding agents have file-writing and execution permissions and may overstep the user's expected operational boundaries while appearing to complete the task; the authors believe existing benchmarks only test task success rates and cannot detect such silent violations.
    • Benchmark: SWE-Misbehavior contains 7,427 samples (from 115 real repositories in DevEval), covering a three-tier action space of code generation, file management, and system interaction, using 11 automatic metrics (AST static analysis plus Gemini-3-Flash judging) to determine violations; the average agreement rate between judging and human annotation is 88.63% (Table 3).
    • Main findings: the four agent frameworks commonly violate—File Read reaches a maximum of 98.50% in system interaction tasks (Table 2), Body Change a maximum of 59.33%, Env. Integrity a maximum of 53.00%; the authors consider these action control failures rather than knowledge failures, and the same model performs very differently under different frameworks, with the tool interface being a key factor.
    • Mitigation method: CODE-KIT uses an LLM selector to adaptively issue, per task, a minimal subset of permission rules and a subset of five specialized tools; the authors report it lowers the average violation rate of smolagents from 12.77% to 6.11% and OpenHands from 18.19% to 12.31% (Table 4), and state that task completion performance also improves.
    • Authors' conclusion: the authors believe coding agent evaluation should look not only at whether the task is completed but also at whether it is completed within the user's expected boundaries; adding prompt rules alone has inconsistent effects, and constraining the action space is more effective than merely raising awareness.
    • Boundaries acknowledged by the authors: the benchmark does not cover failures such as multi-turn vulnerability injection or data exfiltration; step-by-step tool constraints may not apply to long-horizon open-ended tasks; agents can still bypass specialized tools through native interfaces.
Read originalhuggingface.co