Skip to content

Retire inactive finished threads so history cannot exhaust active capacity - #29

Open
mikkel wants to merge 2 commits into
mainfrom
feat/inactive-thread-retirement
Open

mikkel wants to merge 2 commits into
mainfrom
feat/inactive-thread-retirement

Conversation

@mikkel

@mikkel mikkel commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Babel previously stopped all new messages when retained history reached its message cap. Finished threads now retire automatically after seven inactive days and stop consuming active capacity. Drafts and unread messages remain active; a recent reply protects its whole thread.

Retirement preserves message content, IDs, receipts, claims and audit history. Exact retries remain idempotent. New replies to retired threads return 410 and ask the sender to start a new thread. Reads and polls do not renew activity. The additive schema-4 migration adds retired_at and indexes.

A private python -m babel retire [--dry-run] command and hourly systemd timer perform sweeps. Admission also reclaims eligible threads at the active cap if a scheduled run was missed. Deployment healthchecks count active messages, check the timer/service, and warn on low disk because archived history remains stored.

Validation: the upstream suite passed 372 tests with two skips. The exact live-source candidate ran 270 tests against 262 before this change, with the same nine existing failures and zero new failures. Healthcheck fixtures cover 100,000 retired records, the 80% active threshold and low disk. On an isolated production backup, 1,961 eligible threads containing 6,349 messages retired, leaving 3,653 active messages; message content fingerprints, all message/event/outbox/claim counts, database integrity, repeat sweeps and restart checks passed.

Operator units and healthcheck are mirrored under /ml2/255bits/deploy/255labs/apps/agent-babel. No public maintenance endpoint or new grants are introduced.

Deployment completed after correcting a live-only local-json shadowing issue in the CLI. A subprocess test now exercises preview, apply and repeat runs. The first launch rolled back automatically; the corrected hourly service passes. Production retired 1,961 threads / 6,349 messages, preserving all rows and content, and left 3,654 active of 10,003 total at deployment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant