feat: add chat debug retention purge (#24943)

> Mux is acting on Mike's behalf.

Adds configurable retention for chat debug data, including the purge
query, updated_at index, site config, experimental API, SDK types,
frontend lifecycle setting, and docs.

The purge deletes debug runs older than the configured retention window
and relies on existing cascades to delete steps. The default retention
is 30 days, and setting the value to 0 disables the purge.
This commit is contained in:
Michael Suchacz
2026-05-05 22:37:13 +02:00
committed by GitHub
parent 57a6421670
commit 2874d4b4cd
27 changed files with 1298 additions and 24 deletions
+14
View File
@@ -358,6 +358,20 @@ VALUES ('agents_chat_retention_days', CAST(@retention_days AS integer)::text)
ON CONFLICT (key) DO UPDATE SET value = CAST(@retention_days AS integer)::text
WHERE site_configs.key = 'agents_chat_retention_days';
-- name: GetChatDebugRetentionDays :one
-- Chat debug run retention window in days. 0 disables.
SELECT COALESCE(
(SELECT value::integer FROM site_configs
WHERE key = 'agents_chat_debug_retention_days'),
@default_debug_retention_days::integer
) :: integer AS debug_retention_days;
-- name: UpsertChatDebugRetentionDays :exec
INSERT INTO site_configs (key, value)
VALUES ('agents_chat_debug_retention_days', CAST(@debug_retention_days AS integer)::text)
ON CONFLICT (key) DO UPDATE SET value = CAST(@debug_retention_days AS integer)::text
WHERE site_configs.key = 'agents_chat_debug_retention_days';
-- name: GetChatAutoArchiveDays :one
-- Auto-archive window in days. 0 disables.
SELECT COALESCE(