From be17a7bcad48555611d503fe0b4405533f038bf2 Mon Sep 17 00:00:00 2001 From: Peter Steffey Date: Fri, 31 Jul 2026 17:23:05 -0400 Subject: [PATCH] fix(search): match Claude transcripts by provider_session_id --- .../session-conversations-search.service.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/server/modules/providers/services/session-conversations-search.service.ts b/server/modules/providers/services/session-conversations-search.service.ts index 1854eaddc9..197d548982 100644 --- a/server/modules/providers/services/session-conversations-search.service.ts +++ b/server/modules/providers/services/session-conversations-search.service.ts @@ -787,11 +787,18 @@ async function parseClaudeSessionMatches( ? matchedSessionsForFile : [session]; - const targetSessionIds = new Set(targetSessions.map((candidate) => candidate.session_id)); + // Transcript lines are tagged with the provider session id (e.g. Claude's own + // conversation UUID), which is not necessarily the app-facing `session_id`. + // Match and attribute by the provider id, but map results back to the + // internal `session_id` the rest of the app uses to identify sessions. + const providerToInternalId = new Map(); const customNameBySessionId = new Map(); for (const candidate of targetSessions) { - customNameBySessionId.set(candidate.session_id, candidate.custom_name ?? null); + const providerId = candidate.provider_session_id || candidate.session_id; + providerToInternalId.set(providerId, candidate.session_id); + customNameBySessionId.set(providerId, candidate.custom_name ?? null); } + const targetSessionIds = new Set(providerToInternalId.keys()); type ClaudeSessionSearchState = { matches: SessionConversationMatch[]; @@ -912,8 +919,9 @@ async function parseClaudeSessionMatches( continue; } - fileResults.set(sessionId, { - sessionId, + const internalSessionId = providerToInternalId.get(sessionId) ?? sessionId; + fileResults.set(internalSessionId, { + sessionId: internalSessionId, provider: 'claude', sessionSummary: toSummaryText( customNameBySessionId.get(sessionId) ?? null,