A long local run was generating captions for a fashion image site, one image at a time, under a rules file. One rule said a person should visually inspect a sample: every tenth result, plus exceptions. Partway through, the decision changed. Manual inspection would no longer be required; automatic checks and rule compliance would be the release standard. The rules file was updated to say so, with the sample interval set to 0.

Zero meant off. The old runner divided by it.

Before switching, the 52 results already produced, along with the earlier settings, state and release gate, were saved to a migration folder. Then the old runner was stopped. While it was shutting down, its report function read the sample interval again from the rules file, got the new value, and raised ZeroDivisionError. Nothing generated was lost: all 52 results were intact. But the crash skipped cleanup, and the runner's lock file was left behind. After confirming the process had exited, the stale lock was moved into the history folder rather than deleted.

Two assumptions had failed together. The report code treated the interval as a divisor, so zero had no meaning there except a crash. And the runner read rules whenever it needed them, so a value changed on disk could reach code that had started under the old one.

Read once, release always

The fix had three parts. The report function now treats a zero interval as sampling turned off. Rule values are frozen when a run starts, so editing the file affects only the next run. The lock is released in a finally block, so a crash cannot leave it behind. Five tests, including regression tests for this case, passed. The run was then resumed under the new rules, reusing the completed results, with the change recorded as an approved migration between the old and new rule hashes.

A setting that means "off" should be handled as off, not passed to arithmetic. And a running process should not discover its rules again halfway through.