fix(search): match Claude transcripts by provider_session_id - #1078
fix(search): match Claude transcripts by provider_session_id#1078SteffeyDev wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughClaude transcript matching now uses provider-level session IDs and maps results back to internal session IDs. Custom names remain associated with provider IDs for summary resolution. ChangesClaude session identity mapping
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
server/modules/providers/services/session-conversations-search.service.ts (1)
790-801: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAdd a regression test for both session identity paths.
Test a transcript whose
entry.sessionIdmatchesprovider_session_idwhilesession_iddiffers. Assert that the result matches and returns the internalsession_id. Also test the fallback whenprovider_session_idis absent or equal tosession_id.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@server/modules/providers/services/session-conversations-search.service.ts` around lines 790 - 801, Add regression coverage for the session mapping around providerToInternalId and targetSessionIds: verify a transcript entry matching a distinct provider_session_id is found and returned with the internal session_id, and verify the fallback path when provider_session_id is absent or equals session_id. Preserve existing custom-name and result attribution behavior in both cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@server/modules/providers/services/session-conversations-search.service.ts`:
- Around line 790-801: Add regression coverage for the session mapping around
providerToInternalId and targetSessionIds: verify a transcript entry matching a
distinct provider_session_id is found and returned with the internal session_id,
and verify the fallback path when provider_session_id is absent or equals
session_id. Preserve existing custom-name and result attribution behavior in
both cases.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9ce5bf63-ddc0-4af6-b0bb-4689e8843b49
📒 Files selected for processing (1)
server/modules/providers/services/session-conversations-search.service.ts
I got this project running today, I had a vibe-coded in house app that was doing the same sort of thing for me, but this is way better. Nice work!
One issue I had was the the search feature wasn't working. Claude pinned down the issue and fixed. I can't claim any understanding of the code or the fix, but I tested and it does fix the conversation search issue. If this is not the correct fix, feel free to close and fix correctly. Here's what claude said:
Full-text conversation search (
/api/providers/search/sessions) returns zeroresults whenever a session's app-facing
session_iddiffers from itsprovider_session_id(Claude's own conversation UUID) — e.g. sessions created through the app/platform flow, resumed sessions, or migrated ones.parseClaudeSessionMatchesreads the transcript JSONL, whose every line istagged with
sessionId= the provider UUID. But it built itstargetSessionIdsgate (and the custom-name map) from the internalsession_id, so every transcript line failed thetargetSessionIds.has(entrySessionId)check and no messages were ever examined. Separately, the per-file results map
was keyed by the provider UUID (the state key) while the final lookup used
session.session_id, so even matches that were collected could not be returned.ripgrep still reported the files as matching, so the search "ran" and returned
donewith no results — silently empty.Fix
Match and attribute by
provider_session_id(falling back tosession_idforrows where they coincide), and map the per-session result back to the internal
session_idso the returnedsessionIdis still what the rest of the app usesto navigate. Two small edits in
parseClaudeSessionMatches, no API changes.Verifying
On an install where
session_id != provider_session_id, searching a common wordreturned 0 results before and real matches after (results reference the internal
session id, so clicking a hit navigates correctly).
Summary by CodeRabbit