A Passing Test Can Poison the Next Session
Explore how AI coding sessions can pass tests yet still poison the next session by leaving behind residues like running processes or database states. Understand the importance of clean-state contracts, safe cleanup practices, and verification probes to maintain reliable session handoffs. Learn to classify residues, capture baselines, and enforce idempotent cleanup ensuring each session starts from a reproducible, clean environment.
We'll cover the following...
Wrenfold’s CLIN-530 session ended with a passing provider time-off test. The agent marked the feature passing, updated its checkpoint, and stopped.
The next session ran ./init.sh and received READY, but the first booking request for Dr. Reyes at 3:00 PM returned 409. The new agent opened src/availability/index.ts and began weakening the time-off rule.
The feature code was correct, but its end-to-end run left a 2:30 PM to 4:00 PM time-off block in the shared test database and a server on port 3000. Initialization reached that old process; the leftover row made the seeded slot unavailable.
A passing feature gate still poisoned the next baseline: it verified the outcome, not what the run left behind.
How can a successful run leave a broken handoff?
Agent runs change more than source code: processes, fixtures, local configuration, traces, and control artifacts. Some changes are intended; others only enable the run.
If the harness checks only tests and Git commits, temporary state becomes invisible. The next session treats it as a normal environment, then repairs a bug that does not exist or attaches fresh evidence to stale data.
The model can clean known resources. The harness must define run ownership, the required baseline, and when uncertain state blocks handoff.
Does clean state require a finished feature?
No. Clean state means that the next session can explain every difference from baseline and reproduce the stated starting condition.
Completed work can leak rows despite passing tests and clean commits. Unfinished work can hand off cleanly when its dirty paths and reproducible failure are recorded, while processes and fixtures return to baseline.
Wrenfold allows two handoff modes:
Integrated: Intended changes are committed, required verification passes, and the Feature Ledger contains current evidence.
In progress: The checkpoint ...