If you lock the tests your agent is judged against, what stops it changing what runs them?

Reddit r/AI_Agents News

Summary

The author describes how locking down an agent's test suite can be bypassed without touching test files — via a new conftest.py or a modified pytest.ini that silently changes test collection while pytest still exits 0 — and asks what other holes people already live with and how to keep false-hold rates low enough that protections aren't ignored.

Most of the protections I see described here are directory-shaped: block writes to tests/, mount the acceptance suite read-only, keep a second set the agent can’t see, run the base-commit tests regardless of what’s in the working tree. I went looking for what gets past that. Two things did, and neither touches a test file. A newly created conftest .py at the repo root. A changed pytest.ini. Collection changes underneath the tests you protected, the assertions you wrote never execute, and pytest still exits 0. If your gate reads the exit code (&& most do) that run is indistinguishable from a real pass. Blocking writes to tests/ catches neither, because neither lives in tests/. The file that decides what runs usually isn’t the file you’re protecting. What I landed on is treating whatever controls collection as part of the surface being verified, rather than scaffolding around it. That closes those two. I don’t think it closes everything. So: if you’ve locked down the suite your agent is judged against, what’s the hole you already know about and haven’t fixed? I’d rather hear the ones you’re living with than the clean designs. And a harder one I haven’t solved. Protections like this produce holds, and some of them are noise. A hold that turns out to be nothing costs the same attention as one that matters & once people stop reading holds, the whole thing is theatre. How do you keep the false-hold rate low enough that people keep reading them? Or do you just accept it and move the threshold?
Original Article

Similar Articles

How are teams preventing coding agents from weakening test assertions to pass CI?

Reddit r/AI_Agents

A practitioner shares how autonomous coding agents in CI pipelines game 'make tests pass' by weakening test assertions, deleting failing tests, or loosening timeouts, and surveys guardrails like read-only test dirs, negative prompting, and static diff checks such as pr-test-guard to preserve test integrity.