From 76c18efa92b7cfd6316834e33102bc6ea6591473 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Wed, 3 Jun 2026 08:24:12 -0700 Subject: [PATCH] FN-5939: expose operational log retention setting Expose operational log retention as a project setting in the dashboard. - add an Operational log retention selector to the Project General settings section with supported retention options - validate operationalLogRetentionDays in the settings API and cover accepted and rejected values in tests - document the constrained retention values and assert project-scope/default parity for the setting Files changed: docs/settings-reference.md | 2 +- packages/core/src/__tests__/settings-parity.test.ts | 7 ++++ packages/dashboard/app/components/SettingsModal.tsx | 47 ++++++++++------------ packages/dashboard/app/components/__tests__/SettingsModal.test.tsx | 8 ++++ packages/dashboard/src/__tests__/routes-settings.test.ts | 21 ++++++++++ packages/dashboard/src/routes/register-settings-memory-routes.ts | 10 +++++ 6 files changed, 69 insertions(+), 26 deletions(-) Fusion-Task-Id: FN-5939 Fusion-Task-Lineage: 2148dd88-1cef-4c6d-9696-31148fce97d3 --- docs/settings-reference.md | 2 +- .../src/__tests__/settings-parity.test.ts | 7 +++ .../app/components/SettingsModal.tsx | 47 +++++++++---------- .../__tests__/SettingsModal.test.tsx | 8 ++++ .../src/__tests__/routes-settings.test.ts | 21 +++++++++ .../routes/register-settings-memory-routes.ts | 10 ++++ 6 files changed, 69 insertions(+), 26 deletions(-) diff --git a/docs/settings-reference.md b/docs/settings-reference.md index 08dcf82ad7..179225d0b2 100644 --- a/docs/settings-reference.md +++ b/docs/settings-reference.md @@ -430,7 +430,7 @@ Default notes: | `showQuickChatFAB` | `boolean` | `false` | Show floating quick-chat button (chat remains available via More menu). | | `chatAutoCleanupDays` | `0 \| 7 \| 14 \| 30 \| 60 \| 90` | `0` | Auto-cleanup retention window for idle chat sessions and chat rooms. `0` is off (default). When enabled, periodic self-healing maintenance deletes rows with `updatedAt` older than the configured day window. | | `mailAutoCleanupDays` | `0 \| 7 \| 14 \| 30 \| 60 \| 90` | `0` | Auto-prune retention window for inbox/outbox mail messages. `0` is off (default). When enabled, periodic self-healing maintenance deletes `messages` rows where `updatedAt < cutoff` for the configured day window. Suggested setting: `7`. | -| `operationalLogRetentionDays` | `number` | `30` | Retention window for SQLite operational-log tables (`activityLog`, `runAuditEvents`, `agentHeartbeats`). Periodic maintenance prunes rows older than this many days using each row's `timestamp`. Set `0` to disable pruning. | +| `operationalLogRetentionDays` | `0 \| 7 \| 14 \| 30 \| 60 \| 90` | `30` | Retention window for SQLite operational-log tables (`activityLog`, `runAuditEvents`, `agentHeartbeats`). `0` is off. Lower values mean Reliability metrics/charts and the Activity feed will not show history older than the configured window; per-task task detail history is unaffected. Periodic maintenance prunes rows older than this many days using each row's `timestamp`. | | `agentLogFileRetentionDays` | `number` | `0` | Retention window for per-task `.fusion/tasks/{ID}/agent-log.jsonl` files after a task is soft-deleted or archived. Periodic maintenance removes JSONL entries older than this many days; active tasks are never pruned. Set `0` to disable pruning. | | `chatRoomRecentVerbatimMessages` | `number` | `25` | Number of newest chat-room messages kept verbatim in responder context before older entries are compacted (about 2× prior default history). | | `chatRoomCompactionFetchLimit` | `number` | `200` | Upper bound on room messages fetched for transcript compaction per responder turn (raised to support larger retained context windows). | diff --git a/packages/core/src/__tests__/settings-parity.test.ts b/packages/core/src/__tests__/settings-parity.test.ts index 8c314969f8..a2e13b78b9 100644 --- a/packages/core/src/__tests__/settings-parity.test.ts +++ b/packages/core/src/__tests__/settings-parity.test.ts @@ -117,6 +117,13 @@ describe("settings key parity", () => { expect(PROJECT_SETTINGS_KEYS).toContain("mailAutoCleanupDays"); }); + it("defaults operationalLogRetentionDays to 30 and keeps it project-scoped", () => { + expect(DEFAULT_PROJECT_SETTINGS.operationalLogRetentionDays).toBe(30); + expect(isProjectSettingsKey("operationalLogRetentionDays")).toBe(true); + expect(isGlobalSettingsKey("operationalLogRetentionDays")).toBe(false); + expect(PROJECT_SETTINGS_KEYS).toContain("operationalLogRetentionDays"); + }); + it("keeps heartbeatScopeDiscipline project-scoped with strict default", () => { expect(DEFAULT_PROJECT_SETTINGS.heartbeatScopeDiscipline).toBe("strict"); expect(isProjectSettingsKey("heartbeatScopeDiscipline")).toBe(true); diff --git a/packages/dashboard/app/components/SettingsModal.tsx b/packages/dashboard/app/components/SettingsModal.tsx index fcdd2df02b..3e891f7af7 100644 --- a/packages/dashboard/app/components/SettingsModal.tsx +++ b/packages/dashboard/app/components/SettingsModal.tsx @@ -2451,6 +2451,28 @@ export function SettingsModal({ Delete inbox/outbox messages older than this many days. Default: Off. 7 days is the suggested setting. +
+ + + + Lowering this window means Reliability metrics/charts and the Activity feed will not show history older + than the selected range. Per-task task detail history is unaffected. Default: 30 days. + +

Chat Rooms

@@ -6108,31 +6130,6 @@ export function SettingsModal({ )}
-

Database Maintenance

-
- - - - Prune append-only operational logs (activity log, agent logs, run audit, heartbeats) older than this - many days during periodic maintenance. Keeps the database from growing without bound — large databases - are slower to checkpoint and more prone to corruption. Default: 30 days. - -
-

Memory Backups