KB-56EC
Fix 5 — TTL / Cleanup Honesty
2 min read Revision 1
c1stagingcodex-r1-fixttlcleanup2026-06-23
07 — FIX 5: TTL / CLEANUP POLICY (truthful)
Root cause (Codex A7)
Rev-1 stored TTL as free text and docs implied "after TTL it retires"; no cron/scanner exists, so
expiry was manual. P2 also logged a sandbox_drop ledger entry BEFORE the drop succeeded.
Fix — honest model
- Stated truthfully in
README.mdandROLLBACK.md:"TTL is advisory/manual fallback. Cleanup is performed by P2 — invoked by the dry-run plan's EXIT trap (primary) or run manually — NOT by an automatic timer. No cron/systemd/timer is installed."
- Typed
expires_at:p1b-meta.sqlnow storesexpires_at timestamptz NOT NULLin bothsbx_meta.birth_certificateandsbx_meta.sandbox_registry, derived from the validated TTL:now() + (substring(:'ttl' from '^[0-9]+') || (CASE WHEN :'ttl' ~ 'h$' THEN ' hours' ELSE ' days' END))::interval. Verified read-only:24h→ +1 day,7d→ +7 days. This makes a future scanner POSSIBLE, but no scanner is claimed to exist. - Primary cleanup is the dry-run plan's
trap cleanup EXITwhich always runs P2 (even on failure). - P2 ledger ordering (
bin/dot-staging-sandbox-drop): recordssandbox_drop_attemptBEFORE the drop, thenDROP DATABASE … WITH (FORCE), then a fail-closed readback (stg_dieif still present), and only thensandbox_drop_success. No completed-sounding evidence before success.
No overclaim
There is NO automatic TTL timer. Do not rely on TTL to remove a sandbox. This is the explicitly "acceptable model" from Codex review §Fix 5.