Your Agent Didn't Edit the Tests—It Edited pytest.ini: Inside ag_ops v2.4.0 A developer released ag_ops v2.4.0, a 4,573-line zero-dependency Python standard-library CLI that closes root-surface test bypasses in autonomous agent governance, passing 12/12 adversarial scenarios while cutting median latency across seven core operations by 1.16x to 119.12x. The release adds root config manifest hashing (conftest.py, pytest.ini, pyproject.toml), addopts and environment-variable sanitization, executed-test-count checks, merge-base history anchoring, k-cycle oscillation detection, branch scope separation and batched renegotiation. The developer notes five adversarial scenarios still escape the tool and that a local agent running under the user's UID retains write access, with six upgrades planned for v3.0. Antigravity Field Notes 4 In the previous installment Goodhart's Law Has Root Access https://dev.to/fgrandon/goodharts-law-has-root-access-hardening-autonomous-agent-governance-from-agops-v21-to-v23-203o , I felt pretty good about ag ops v2.3 . I had pinned Git HEAD during Red phases, streamed SCAR-PROC-150 witnesses my git-backed proof of why a failing test legitimately needs renegotiating directly from git show so an agent couldn't forge alibis in the working tree, and sealed CLI --ignore flags inside the Red receipt. Then I tried to break my own tool. It took less than five minutes to turn guard verify-green into a theater prop without modifying a single byte inside tests/ : tests/ completely untouched. pytest.ini at the repository root and set addopts = --collect-only or export PYTEST ADDOPTS=--collect-only in the shell, or drop an @pytest.fixture autouse=True hook into a brand-new root conftest.py . import os; os. exit 0 in the production module so the test process exits cleanly with status 0 after running In v2.3, compute merkle tree hashed only --test-dir . Anything living one directory above tests/ or inside environment variables, pytest INI tables, or premature interpreter exits could hand the agent a sparkling green exit code 0 and an intact Merkle hash. Today I shipped ag ops v2.4.0 GitHub Release v2.4.0 https://github.com/FranciscoGrandon/ag-ops/releases/tag/v2.4.0 · PR 6 https://www.google.com/search?q=https://github.com/FranciscoGrandon/ag-ops/pull/6 : a 4,573 -line, zero-dependency Python standard-library CLI engine sys.stdlib module names enforced by AST test that closes every known root-surface test bypass 12/12 in my adversarial benchmark , cuts median latencies across all seven core operations by 1.16x to 119.12x , adds merge-base history anchoring, k -cycle oscillation detection, mechanical branch scope separation guard check-scope , atomic batched renegotiation --batch , and sub-millisecond hidden-mutation sensing MUT001 . Several of the sharpest mechanisms in this release from ancestor-anchored renegotiation to k -cycle ping-pong detection and batched refactors came directly out of adversarial review comments from DEV.to readers full community credits at the end . Just as importantly: this post won't pretend v2.4.0 solved local security. Five adversarial scenarios still escape it, a local agent running under your OS user account UID still holds write keys to the kingdom, and every limitation is documented in the open below, along with six concrete, buildable upgrades targeted for v3.0 . Autonomous Agent / Developer CLI └── ag ops.py v2.4.0 4,573 lines · Python stdlib only ├── P0 & P2 Test & Git Integrity guard │ ├── witness-red / verify-green │ │ ├── root config manifest conftest.py, pytest.ini, pyproject.toml, sitecustomize.py... │ │ ├── tomllib & configparser addopts inspection │ │ ├── PYTEST ADDOPTS & PYTHONSTARTUP sanitization │ │ └── Executed test count check ZERO TESTS EXECUTED │ ├── --base-ref / merge-base & SPEC MODIFIED SINCE BASE │ ├── guard check-scope RULES ONLY vs MIXED SCOPE VIOLATION │ └── guard renegotiate --batch 1 shared SCAR-PROC-150 witness │ └── P1 & P3 Performance Engine, Cycles & AST Sensors ├── ast-lint SinglePassVisitor + MUT001 + DOT │ └── .ag state/stat cache.json disabled on --strict / --no-cache ├── state write / status + oscillation history.json k <= 16 cycles └── regret-mine GitBatchReader git cat-file --batch + AST scrubber I organized v2.4.0 in strict priority order: close the known exploits first P0 , pay for the extra safety by optimizing the core engine P1 , fold in the community's history/cycle/scope controls P2 , and reduce legitimate refactor friction while adding MUT001 P3 . Everything lives inside a single file with zero third-party imports including ast , collections , configparser , hashlib , json , os , pathlib , re , shlex , subprocess , sys , tempfile , and tomllib . Let's open the hood on each layer. os. exit 0 root config manifest If your guard seals tests/ with SHA-256, pytest doesn't stop reading configuration at tests/ . It walks upward looking for root conftest.py , pytest.ini , pyproject.toml , setup.cfg , and tox.ini , and Python itself checks sitecustomize.py and usercustomize.py . In collect root config manifest https://www.google.com/search?q=https://github.com/FranciscoGrandon/ag-ops/blob/v2.4.0/ag ops.py%23L735 , witness-red walks upward from test path.parent to the Git repository root or cwd boundary , rejecting symlinks/NTFS junctions in any ancestor or config file, and sealing every canonical config slot into root config manifest : { "schema version": "2.4", "root config base": "D:/repo", "root config manifest": { "conftest.py": "ABSENT", "pyproject.toml": "ABSENT", "pytest.ini": "9f8c...SHA256...", "setup.cfg": "ABSENT", "sitecustomize.py": "ABSENT", "tox.ini": "ABSENT", "usercustomize.py": "ABSENT" } } Why record "ABSENT" explicitly? Because negative presence is part of the invariant . If conftest.py did not exist during the Red run and suddenly materializes before verify-green , verify root config manifest emits ADDED:conftest.py and aborts with exit code 2 ROOT CONFIG DRIFT . Meanwhile, receipts from v2.3 lacking schema version , root config manifest , or env policy still parse cleanly through parse guard receipt https://www.google.com/search?q=https://github.com/FranciscoGrandon/ag-ops/blob/v2.4.0/ag ops.py%23L1260 so existing historical audits don't break. addopts , Sanitizing Env Vars, and Counting Real Executed Tests Sealing files stops post-Red edits , not configs that were already sabotaged before Red ran: tomllib for pyproject.toml and configparser for tox.ini , and setup.cfg tool:pytest , guard always blocks --collect-only , --co , --setup-only , and --setup-plan . Undeclared -k , --ignore , and --ignore-glob filters not present in the sealed --cmd are rejected, while custom bans like -p no:cov can be enforced via --forbid-addopts . Benign options like -p no:cacheprovider remain allowed. Both raise exit code 2 UNSAFE PYTEST ADDOPTS . PYTEST ADDOPTS and PYTHONSTARTUP to forbidden by default ENV TAINT DETECTED , exit --allow-env-passthrough is declared at Red time. Crucially, if Red sealed "passthrough allowed": false , passing app.py before assertions execute, pytest terminates with exit code verify-green parses test runner summaries witnessed test count , fails with exit code ZERO TESTS EXECUTED when 0 tests ran or no summary appears for pytest/unittest commands when witnessed test count 0 , and fails with TEST COUNT REGRESSION if dynamic parametrization shrinks test execution count between Red and Green e.g., 2 - 1 . Adding config manifests, Git ancestry checks, and extra AST rules usually makes a CLI slower. Instead, P1 refactored the entire engine so v2.4.0 beats v2.3 on all seven benchmarked commands : DEFAULT LINT DISPATCH: Dict Type ast.AST , List RuleFn and a pre-scanned LintFileContext holding module-level tkinter / ttk aliases. Adding rule MUT001 cost essentially zero extra traversal overhead. hashlib.file digest + Boundary-Safe 64 KB CRLF Streaming \x00 and non-CRLF-normalized reads delegate straight to C via hashlib.file digest f, "sha256" . Text reads with normalize eol=True stream in 65,536 -byte chunks carrying a trailing \r across chunk boundaries: if carry cr: if chunk.startswith b"\n" : h.update b"\n" chunk = chunk 1: else: h.update b"\r" carry cr = False if chunk.endswith b"\r" : carry cr = True chunk = chunk :-1 if b"\r" in chunk: chunk = chunk.replace b"\r\n", b"\n" Wait: can I actually verify that boundary case? Yes: tests/test ag ops v2 4.py explicitly puts \r at byte index 65535 and \n at byte index 65536 and asserts hash equality against LF bytes. GitBatchReader git cat-file --batch , git show once per file across 12 commits on Windows costs tens of milliseconds stdin / stdout , parses