SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2606.05647 · 2026

Coding with "Enemy": Can Human Developers Detect AI Agent Sabotage?

Weiyan Shi, Simon Yu, Jingheng Ye, Huiqi Zou

arXiv · PDF · Open in the Atlas

Code that ran

6 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 3 failures of our instrument; 4 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2606.05647.json · badge: /api/ran/2606.05647.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
CHATS-lab/coding-agent-safety-monitor canonical (classifier label)
classifier basis: census
6 ran · 4 no recorded run
FunctionStatusWhere it lives
count_trajectory_events Ran
ran, honoured the contract we drafted
CHATS-lab/coding-agent-safety-monitor/monitor/llm_monitor.py
code served (permissive licence) · get_code("f3fcaa199e3471a9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# Construct a simple trajectory string with multiple event lines
trajectory_str = """Event 1: Agent moved to position (5, 10)
Event 2: Agent collected reward +10
Event 3: Agent encountered obstacle
Event 4: Episode terminated"""

ARGS = {
    "trajectory": trajectory_str
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_json_from_response Ran
ran; our contract draft was wrong, not the code
CHATS-lab/coding-agent-safety-monitor/utils/io.py
code served (permissive licence) · get_code("ac02cd42ebd9a047")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import re
from typing import Optional

# Test case 1: Response with markdown code fence
response_text_1 = '''Here is the JSON response:
json
{"key": "value", "number": 42}

Some additional text.'''

# Test case 2: Response with raw JSON
response_text_2 = '{"status": "success", "data": [1, 2, 3]}'

# Test case 3: Response with brace-balanced JSON embedded in text
response_text_3 = 'The result is {"answer": "hello", "count": 10} in the middle of text'

# Test case 4: Response with escaped quotes in JSON string
response_text_4 = '''```json
{"message": "This is a \\"quoted\\" string", "valid": true}
'''

# Test case 5: Response with multiple braces and proper nesting
response_text_5 = 'Some text {"nested": {"inner": "value"}, "array": [1, 2]} more text'

# Test case 6: Empty or invalid response
response_text_6 = 'No JSON here at all'

# Test case 7: Malformed JSON in fence that should fall back
response_text_7 = '''```json
{invalid json}

But here is valid: {"fallback": true}'''

ARGS = {
    "response_text": response_text_1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_bool_env Ran
ran, violated the contract we drafted
CHATS-lab/coding-agent-safety-monitor/utils/env.py
code served (permissive licence) · get_code("6890cc4c38e729d8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os

# Set up environment variables for testing
os.environ['TEST_VAR_TRUE'] = 'true'
os.environ['TEST_VAR_FALSE'] = 'false'
os.environ['TEST_VAR_TRUE_CAPS'] = 'TRUE'
os.environ['TEST_VAR_FALSE_CAPS'] = 'FALSE'

ARGS = {
    'name': 'TEST_VAR_TRUE',
    'default': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_int_env Ran
ran, honoured the contract we drafted
CHATS-lab/coding-agent-safety-monitor/utils/env.py
code served (permissive licence) · get_code("d99b9efdc735877c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os

# The function reads an environment variable and converts it to int
# It takes two parameters: name (str) and default (int)
# We need to set up valid arguments for both parameters

# Set up test environment variables
os.environ['TEST_INT_VAR'] = '42'
os.environ['INVALID_INT_VAR'] = 'not_a_number'

ARGS = {
    'name': 'TEST_INT_VAR',
    'default': 10
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_jsonl Ran
ran; our contract draft was wrong, not the code
CHATS-lab/coding-agent-safety-monitor/utils/io.py
code served (permissive licence) · get_code("8add8881bedf4a28")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
from pathlib import Path

# Create a temporary JSONL file for testing
temp_dir = tempfile.TemporaryDirectory()
temp_file = Path(temp_dir.name) / "test.jsonl"

# Write some test JSONL data
with open(temp_file, 'w', encoding='utf-8') as f:
    f.write('{"id": 1, "text": "hello"}\n')
    f.write('{"id": 2, "text": "world"}\n')
    f.write('{"id": 3, "text": "test"}\n')
    f.write('{"id": 4, "text": "data"}\n')

ARGS = {
    "file_path": temp_file,
    "limit": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_transcript Ran
ran; our contract draft was wrong, not the code
CHATS-lab/coding-agent-safety-monitor/utils/io.py
code served (permissive licence) · get_code("229e4957aa241a89")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import json
from pathlib import Path

# Create temporary test files
temp_dir = tempfile.mkdtemp()

# Create a .jsonl test file
jsonl_path = Path(temp_dir) / "test.jsonl"
with open(jsonl_path, 'w', encoding='utf-8') as f:
    f.write('{"event": "start", "id": 0}\n')
    f.write('{"event": "middle", "id": 1}\n')
    f.write('{"event": "end", "id": 2}\n')

# Create a .json test file with events structure
json_path = Path(temp_dir) / "test.json"
with open(json_path, 'w', encoding='utf-8') as f:
    json.dump({
        "events": {
            "0": {"id": "0", "message": "first"},
            "1": {"id": "1", "message": "second"},
            "2": {"id": "2", "message": "third"}
        }
    }, f)

# Test case 1: read from .jsonl file with limit
ARGS = {
    "transcript_path": str(jsonl_path),
    "limit": 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
format_trajectory Not yet run
unverified (harvested, no recorded run)
CHATS-lab/coding-agent-safety-monitor/monitor/llm_monitor.py
code served (permissive licence) · get_code("06861219c3db3670")
How it ran

no invocation recorded.

get_session_log_dir Not yet run
unverified (harvested, no recorded run)
CHATS-lab/coding-agent-safety-monitor/utils/logging.py
code served (permissive licence) · get_code("fe6875812a147f8c")
How it ran

no invocation recorded.

setup_hook_logger Not yet run
unverified (harvested, no recorded run)
CHATS-lab/coding-agent-safety-monitor/utils/logging.py
code served (permissive licence) · get_code("ae319c3778ecda71")
How it ran

no invocation recorded.

truncate_trajectory Not yet run
unverified (harvested, no recorded run)
CHATS-lab/coding-agent-safety-monitor/monitor/llm_monitor.py
code served (permissive licence) · get_code("336aabf181e1fdd2")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 10 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

AI coding agents are increasingly embedded in real-world software development, collaborating with human developers while gaining broader access to codebases and tools. This creates a new attack surface: an agent can exploit human trust to sabotage development, for instance by inserting malicious code to accomplish a hidden side task. Most prior work studies AI sabotage in AI-only settings, paying limited attention to the role of human oversight in detecting and mitigating such malicious behavior. To address this gap, we conduct the first large-scale study of human oversight in AI coding sabotage. Over 100 participants collaborate with one of four frontier models (Claude-Opus-4.6, GPT-5.4, Gemini-3.1-Pro, and MiniMax-M2.7) on a long-horizon coding task lasting around five hours, designed to mimic real-world workflows. We find that 94% of developers fail to detect sabotage, and our analysis of participant feedback attributes this vulnerability to minimal code review, plausible cover story, and overtrust in agents. We further test the effectiveness of a safety monitor in one condition: while the monitor reduces sabotage success, 56% of participants still accept the malicious code, ignoring its warnings. Drawing on participant feedback, we offer actionable suggestions for better monitor design. This work complements existing AI safety research and highlights an urgent need for human-centric safety mechanisms that account for human factors, particularly in long-horizon, real-world development settings. 2 * Equal contribution. 2 We release the code of the safety monitor at https://github.com/CHATS-lab/coding-agent-safety-monitor.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2606.05647")
get_code_for_paper("2606.05647")
have("2606.05647")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2606.05647.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2606.05647.svg)](https://syntology.ai/paper/2606.05647)

Connect an agent — have() is free.