Moving the writability preflight under the quarantine lock (previous commit)
meant a missing/zeroed state.db in a read-only directory under HERMES_HOME
failed creating state.db.quarantine.lock before the preflight could chmod the
directory back to writable. Check (and repair) the directory first: it never
vanishes mid-quarantine, so this unlocked check is race-free; the file and
sidecar checks stay under the lock. Found by Greptile on #140511.