Why "Tests Passed" From Your AI Coding Agent Isn't Proof (SHA-256 Digest-Bound Evidence Gate)
After 10+ years running Linux ISP production infrastructure, the scariest line from a coding agent is: "All tests passed. Ready to deploy." In long Claude Code, Codex, or Cursor sessions, two opposite bugs happen con
After 10+ years running Linux ISP production infrastructure, the scariest line from a coding agent is:
"All tests passed. Ready to deploy."
In long Claude Code, Codex, or Cursor sessions, two opposite bugs happen constantly:
- Stale green claims: the agent runs a test, edits another file two turns later, and still treats the earlier pass as valid.
- Rerun & polling burn: the agent burns 30-60% of its context re-running the same green suite or polling unchanged deploy logs in a loop.
A logged run is not proof unless bound to the exact artifact digest.
So I extracted our gate into a zero-dependency Python 3.10+ CLI: integrity-evidence-gate (MIT, 0 telemetry, PyPI).
Install
Always install the scoped PyPI name integrity-evidence-gate, not unscoped evidence-gate (unrelated third party):
pipx install integrity-evidence-gate
evidence-gate run -- pytest
Or zero-install via uvx:
uvx --from integrity-evidence-gate evidence-gate run -- pytest
1. Digest-Bound Test Gate (evidence-gate run)
Hashes watched --artifact paths (symlink-safe SHA-256, ignoring .git/__pycache__/node_modules), OS/Python env, and exact argv (shell=False):
-
Cold run: runs and appends to a local JSONL ledger (
~/.evidence-gate). -
Unchanged rerun: returns
SKIP_CACHED_PASSin milliseconds (command_calls=0). - 1-byte diff: invalidates immediately. Failures never cache.
-
Concurrency: atomic
O_CREAT | O_EXCLfile lease (exit 75on duplicate run). -
Forced rerun:
--forcerequires--force-reason(fails closed,exit 2).
evidence-gate run --kind targeted --suite-id auth-unit --reason "verify fix" \
--artifact src/auth --artifact tests/test_auth.py \
-- python -m unittest tests/test_auth.py
2. Loop-Breaking Monitor (evidence-gate observe)
evidence-gate observe --monitor-id deploy-rollout --reason "watch rollout" \
--min-interval-seconds 60 --max-unchanged 3 --json -- python scripts/check_rollout.py
Caps polling via --min-interval-seconds, --deadline-utc, and --max-unchanged (STOP_UNCHANGED, STOP_DEADLINE, SKIP_TOO_SOON).
Boundary
It only hashes declared paths. Live DB/API tests need --freshness ttl or --freshness volatile.
- Repo (MIT, 0 deps): https://github.com/BlackBadHope/evidence-gate
- Full stack: https://integrityharness.dev
How are you stopping stale passes and test-rerun loops?
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.