This is one of three Agentware 2026 Near Miss write-ups from building pr-triage-agent, a PR-triage agent in Python's standard library only — tagging Hackathon Raptors.
What almost happened: Two quiet defaults in the auto-fix path could have put unreviewed, untested changes into a repo. First, --apply-fixes on its own did not re-run tests: fixes landed on disk with no verification, while SAFETY.md unconditionally promised "re-run tests, roll back on regression". Second, the F02 fix (missing newline at end of file) fired whenever a file's last line lacked a newline — even when that last line was nowhere near the PR's added lines, violating the agent's own "only touch lines the PR added" promise. A PR editing the middle of a file could have silently modified its tail. A third, related gap: the kill switch was only checked at step boundaries, so once a 120-second test run started it could not be interrupted mid-run, despite SAFETY.md promising immediate mid-run abort.
Why it almost slipped through: each behaviour was reasonable in isolation — fixes are small, the newline fix is trivial, tests are "optional" — and each was covered by a doc sentence that overstated what the code did. The e2e kill-switch test only covered a switch set before the run started, so the mid-run gap had no test to fail.
What caught it: the same 2026-11-29 red-team audit, which diffed SAFETY.md's promises against the code line by line (agent.py, fix.py, testrun.py) instead of trusting either one alone.
The fix: --apply-fixes now implies --run-tests (fixes are always re-tested, with rollback on regression); F02 only fires when the last line is inside the PR's added lines; SAFETY.md was rewritten to say the kill switch aborts before the next step, with the 120-second test timeout as the worst-case wait. All three were in the 11/11 fixes pushed 2026-11-29.
Lesson: for an agent that writes code, the scariest bugs are the ones where the safety doc is right and the code is almost right. Audit the doc against the code, and test the abort path mid-run, not just at startup.
A note of thanks to FileClerk, sponsor of the Near Miss $50 awards (https://fileclerk.co.uk): rewarding people for writing up what almost went wrong is how the next builder avoids the same trap.
