fix: Filter out archived Agentic Chat workflows
What does this MR do?
Fixes a UX issue where users continue to see inactive Agentic Chat workflows in their workflow history even after the underlying conversation data has been automatically deleted.
| before | after |
|---|---|
![]() |
![]() |
Problem Statement
We have two separate cleanup mechanisms for Agentic Chat data:
-
Conversation threads cleanup: The
Ai::Conversation::CleanupServiceautomatically deletes conversation threads (ai_conversation_threadstable) after 30 days to comply with data retention policies -
Workflow records: The corresponding workflow records (
duo_workflows_workflowstable) withworkflow_definition: 'chat'were not being cleaned up
This created a frustrating user experience where:
- Users would see chat workflows in their history via the
getUserWorkflowsGraphQL query - When they tried to access these workflows, they would fail because the underlying conversation data was already deleted
- Users had no way to distinguish between active and inactive chat sessions
Implementation Details
-
Added
not_archivedscope toAi::DuoWorkflows::Workflowmodel that filters out workflows older than 30 days -
Applied scope to user queries in
WorkflowsResolver- only affects personal workflow lists, not project-level queries - Added comprehensive tests to ensure the scope works correctly
The solution is surgical - it only affects the specific query path where users see their personal chat history, leaving all other workflow functionality unchanged.
Edited by Jannik Lehmann

