From c1eceb8f9810efed25995b399c6f53b89740a34f Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Tue, 30 Jun 2026 16:31:46 +0530 Subject: [PATCH] fix: count time-based captain resolves in overview reopen rate --- enterprise/app/builders/captain/assistant_stats_builder.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/enterprise/app/builders/captain/assistant_stats_builder.rb b/enterprise/app/builders/captain/assistant_stats_builder.rb index 7b4ce4d47..12531dbb1 100644 --- a/enterprise/app/builders/captain/assistant_stats_builder.rb +++ b/enterprise/app/builders/captain/assistant_stats_builder.rb @@ -182,8 +182,10 @@ class Captain::AssistantStatsBuilder end # Of the conversations Captain auto-resolved (inbox-based), the share reopened afterwards. + # Covers both the evaluated (inference) and time-based (bot) resolve paths so the + # denominator matches auto_resolution_rate. def reopen_rate(range) - resolved_scope = account.reporting_events.where(name: 'conversation_captain_inference_resolved', + resolved_scope = account.reporting_events.where(name: RESOLVED_EVENT_NAMES, inbox_id: assistant_inbox_ids, created_at: range) resolved = resolved_scope.distinct.count(:conversation_id) reopened = account.reporting_events