Repository navigation
Description
Summary
#1644 shipped the retention blast-radius guard with FLOOR_AGENTS = 0 — "every purge destroys Docker volumes. Always ack." — so every agent hard-purge, even a single one, exceeds the threshold and is refused until an admin acknowledgement exists.
The only way to record that acknowledgement is POST /api/settings/retention/acknowledge. That endpoint has no frontend caller and no MCP tool: src/frontend/src/views/Settings.vue wires only the read-only GET /api/settings/retention.
Net effect: no operator can approve, the guard always refuses, the #834 agent purge sweep never completes — and #1581's Docker-volume reclaim, which shipped in the same release, can never run. Volumes still leak forever, now for a different reason.
Context
Found by /release-plan during the v0.8.5 pre-freeze coherence review (2026-07-20).
The guard's design is correct and should not change: destroying agent data volumes is irreversible, so a human gate is right, and FLOOR_AGENTS = 0 is a deliberate "always ask". This issue is only about the missing approval surface — the guard is fail-safe (nothing is wrongly deleted), but it makes a shipped fix inert and the release cannot honestly claim #1581 without it.
Design decision to settle first
GET /api/settings/retention currently reports the effective windows plus guard.max_rows — it does not report that a prune is pending approval, so the UI has nothing to render a prompt from. Two options:
- Extend the GET to report pending refusals (setting key, window in force, candidate count, last-refused timestamp).
- Read the existing alarm — the guard already raises an operator-queue item on the reserved
_retention-guardsentinel with counts and identifiers.
Option 1 keeps the Settings panel self-contained and avoids coupling a settings surface to the operator queue; option 2 adds no endpoint surface. Pick one before building.
Acceptance Criteria
- An admin can approve a pending retention prune from Settings → Retention without leaving the UI
- The confirmation names what will be deleted: the setting key, the window in force, and the candidate count — approving blind is not acceptable for an irreversible volume deletion
- The action is admin-only and human-only — it must reject an agent-scoped principal (
reject_agent_principal), since an agent key resolves to its owner carrying the owner's role and the default install is admin-owned - The window sent matches the window in force; a mismatch surfaces the existing 409 as a named, readable error rather than a generic failure
- Acknowledgement remains single-use — after the prune runs the guard re-arms and the UI reflects that (no stale "approved" state)
- When nothing is pending, the panel shows an honest empty state with a next action — not a dead control or a permanently-enabled button
- With
#1581in place, an approved purge demonstrably removes the agent'sworkspace/public/sharedvolumes - The approval is audit-logged (it already is server-side — confirm it surfaces with the acting admin)
- Guarded by a test that fails if the ack endpoint loses its UI caller again
Technical Notes
- Guard + floors:
src/backend/services/retention_guard.py(FLOOR_AGENTS = 0,MAX_ROWS_PER_SWEEP = 1000,is_acknowledged/record_acknowledgement/consume_acknowledgement) - Endpoint:
POST /api/settings/retention/acknowledgeinsrc/backend/routers/settings.py— already admin + human-gated, window-bound (409 on mismatch), single-use, audit-logged. No backend auth work needed; this is a surface gap. - Consumer:
src/backend/services/cleanup_service.pycalls the guard before each of the 7 window-driven prunes - Panel:
src/frontend/src/views/Settings.vue(already renders the read-only retention section) - Open-core boundary: the ack capability is OSS-core. The enterprise
retentionmodule sells the managed panel (audit trail,updated_by, hot-reload) — do not build that here. Keep this to the plain approval control. - Do not raise
MAX_ROWS_PER_SWEEPorFLOOR_AGENTSto work around the missing UI. The threshold is deliberately a fixed constant, not a setting, and lowering-is-safe/raising-is-not is pinned bytests/unit/test_1644_retention_guard.py.
Related
#1644— the guard that introduced the gate#1581— the volume reclaim this blocks#834— the soft-delete/purge lifecycle the sweep belongs to
Activity
test(retention): fix brittle window_days proximity check (#1709)
fix(retention): in-product approval path for the blast-radius guard (#…
feat(a2a): call_a2a_agent — outbound A2A calls to external agents (#736…