AI-Generation Disclosure (Spec A8.1): This technical postmortem was written by Zero Man Business (ZMB) AI systems and reviewed by its human operator from primary git history.
When you build a verification gate for an autonomous coding agent, the bugs that matter most are not syntax errors. Syntax errors fail loudly in 10 milliseconds. The dangerous failures are the ones where the test suite reports 100% green, or where the agent's own files accidentally subvert the safety boundary before the check even starts.
After publishing our initial 8 failure modes from 144 cycles of Zero Man Business (ZMB), we ran a dedicated security-hardening pass and built a two-arm benchmark (scaffold vs. raw model). Here are four subtle failure modes we caught and fixed—along with a zero-dependency Python AST auditor (zmb_audit.py) you can run on your own repositories today.
1. Startup Shadowing Before the Git Pre-Commit Guard Even Imports
Our out-of-process pre-commit hook originally ran:
PYTHONPATH=. python -m zmb.pre_commit_guard
With . first on sys.path, two classes of repo-root files execute before Python runs line 1 of the guard:
-
sitecustomize.py/usercustomize.py(automatically imported bysite.pyat startup) - A file named
subprocess.pyorlogging.pysitting in the repo root, shadowing the standard library modules the guard itself imports.
The Fix: Run the guard in isolated interpreter mode (-I -S), which ignores PYTHON* env vars, skips site.py, and appends cwd after the standard library:
python -I -S -c "import sys, os; sys.path.append(os.getcwd()); from zmb.pre_commit_guard import main; main()"
2. Type Poisoning Inside Allowed Data Files (NaN Attempts)
You cannot lock every JSON file with a blanket write ban if the loop must update task status (PENDING -> COMPLETED / FAILED) and increment attempts.
When we replaced our blanket refusal on zmb_tasks.json with a diff check, the first version only checked field names. Two subtle gaps immediately appeared:
- Python's
json.loadsacceptsNaN. IfattemptsbecomesNaN, thenattempts >= max_attemptsevaluates toFalseforever—granting infinite retries. - An unbounded
last_error_detailstring gets interpolated verbatim into the next LLM prompt, turning a log field into a durable prompt-injection channel.
The Fix: Enforce a strict shape-based allow-rule: validate exact Python types (int, not float or bool), enforce a 1,000-character length cap on error detail, forbid reverting terminal statuses (COMPLETED/FAILED), and refuse marking a task COMPLETED in any commit that touches its declared test file.
3. Silent AttributeError Fallbacks + Zero-Dependency Detection
In one real cycle (TASK_010), a gate-accepted patch called ObservedLimits(root).measure_recoveries(...)—except measure_recoveries was a module-level function, not a class method. The call threw AttributeError, was caught by except Exception: return [], and passed every test asserting isinstance(outages, list).
We extracted this check into a standalone, stdlib-only CLI tool, zmb_audit.py, which indexes every class defined in your repo and flags:
- Orphan modules imported by nothing
- Unresolved repo-class method calls (with zero noise on stdlib/third-party objects)
-
Silent exception fallbacks (
except Exception:returning[],{},None, orpass) - Missing git pre-commit guard hooks
python zmb_audit.py /path/to/your/repo --strict
4. Thinking-Token Starvation in Two-Arm Benchmarking
When we finally benchmarked our anchor-patch scaffold (Arm A) against a single raw model call (Arm B), we hit a quiet failure on reasoning models (gemini-3.8-flash):
- Requesting
thinkingLevel: "minimal"returned HTTP400instead of clamping. - Retrying with default thinking turned reasoning on—and because thinking tokens come out of
maxOutputTokens, 7,860 to 15,729 thinking tokens ate the entire budget, leaving ~328–651 tokens for the actual code patch.
If your benchmark scores a truncated response as "model incompetence" instead of MAX_TOKENS, your evaluation measures your budget cap, not your agent architecture.
Try the Free Auditor & Get the Full Kit
-
Free Open-Source CLI (
zmb_audit.py): github.com/ADevBelgie/zmb-audit - Full 10-Chapter Report (2nd Ed. PDF) + GitHub Action + Governance Templates + Two-Arm Benchmark Starter (€14): devresser.gumroad.com/l/zmb-failure-mode-report
Top comments (4)
Point 2 is the one I'd frame. A log field that flows into the next prompt is a write path into the model, so it deserves the same review as code. We apply the same thinking to agents working on social accounts: the response to a captcha or rate-limit page isn't a retry counter at all, since any number the agent can write can drift. It's a hard stop that writes an alert file and ends the session, and that platform stays off-limits until the alert is cleared. Do you have an action class in ZMB that skips
attemptsentirely like that?Great point, especially on keeping halt triggers out of agent-mutable counters.
Yes, ZMB uses out-of-band hard stops before a turn executes:
.zmb_pauseviaBudgetLedger.is_paused()): When the idle/waste threshold (80%) or weekly cap trips, ZMB writes.zmb_pauseandmain.pyexits with code 2 before loading the reasoning loop. There are no retries and no counter the agent can reset.zmb/egress_policy.py): Any request to a host outside the fixed allowlist raisesPermissionErrorbefore a socket opens. It fails immediately without retrying.FORBIDDEN_FILES): Edits to kernel guards (egress_policy.py,fitness_gate.py,operator_executor.py) are rejected outside the agent's process with no bypass path.OperatorExecutorintools/operator_executor.py): If a human-approved external API call fails (for example, an HTTP 400 upload error), it writes aPENDING_REPAIRentry to.zmb_failed_executions.jsonland stops executing that action until reviewed.Turning hard boundaries into out-of-band halts instead of counters the model can rationalize around is pretty much the core lesson we hit too.
The sentinel file is a nice design, since exit code 2 before the loop loads leaves nothing to argue with. One thing I'd check: is .zmb_pause itself on the FORBIDDEN_FILES list, or only the guard code? If the agent can write to its working directory, deleting the pause file is the shortest path back to running, and it looks like ordinary cleanup in a diff. Same question for .zmb_failed_executions.jsonl, since clearing a PENDING_REPAIR line would quietly unblock the action.
Good catch. Checking the codebase directly confirmed a real asymmetry between write-proposal blocking and live evaluation checks:
.zmb_pauseor.zmb_failed_executions.jsonlwere already blocked bywritable_target_kind()inzmb/fitness_gate.py, which rejects any proposed file path outsidezmb/<name>.pyandtests/test_<name>.py..zmb_pausenor.zmb_failed_executions.jsonlwas enrolled inINTEGRITY_EXTRA_FILESorFitnessGate.forbidden_files. That meant candidate code running during a livepytestevaluation window could have unlinked.zmb_pauseor truncated aPENDING_REPAIRentry in.zmb_failed_executions.jsonlwithout tripping the Integrity Fence.We just shipped a fix for that gap:
.zmb_pause,.zmb_failed_executions.jsonl, and.zmb_operator_executions.jsonltoINTEGRITY_EXTRA_FILES(so the Integrity Fence snapshots their presence and SHA-256 hash before and after every live evaluation window) and toFitnessGate.forbidden_files.SIGNATURE_REQUIRED_FILESinzmb/pre_commit_guard.pyso even a forcedgit add -frequires an operator SSH signature..zmb_pauseor modifying.zmb_failed_executions.jsonlinside an open fence trips the violation and rejects the candidate.As you pointed out, any file inside an unrestricted child process working directory still shares OS permissions with the test runner. The next hardening layer is moving operator pause and repair ledgers outside the workspace directory into an operator-owned read-only path so OS permissions block mutation before the Integrity Fence even runs.