Skip to content

fix(search): match Claude transcripts by provider_session_id - #1078

Open
SteffeyDev wants to merge 2 commits into
siteboon:mainfrom
SteffeyDev:main
Open

fix(search): match Claude transcripts by provider_session_id#1078
SteffeyDev wants to merge 2 commits into
siteboon:mainfrom
SteffeyDev:main

Conversation

@SteffeyDev

@SteffeyDev SteffeyDev commented Jul 31, 2026

Copy link
Copy Markdown

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 zero
results whenever a session's app-facing session_id differs from its
provider_session_id (Claude's own conversation UUID) — e.g. sessions created through the app/platform flow, resumed sessions, or migrated ones.

parseClaudeSessionMatches reads the transcript JSONL, whose every line is
tagged with sessionId = the provider UUID. But it built its
targetSessionIds gate (and the custom-name map) from the internal
session_id, so every transcript line failed the targetSessionIds.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
done with no results — silently empty.

Fix

Match and attribute by provider_session_id (falling back to session_id for
rows where they coincide), and map the per-session result back to the internal
session_id so the returned sessionId is still what the rest of the app uses
to navigate. Two small edits in parseClaudeSessionMatches, no API changes.

Verifying

On an install where session_id != provider_session_id, searching a common word
returned 0 results before and real matches after (results reference the internal
session id, so clicking a hit navigates correctly).

Summary by CodeRabbit

  • Bug Fixes
    • Improved Claude transcript matching by correctly associating logs with provider session IDs.
    • Preserved custom conversation names and summaries when searching across sessions.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Claude 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.

Changes

Claude session identity mapping

Layer / File(s) Summary
Map provider IDs for matching and results
server/modules/providers/services/session-conversations-search.service.ts
Claude transcript targeting uses provider_session_id, with session_id as fallback. Result records return the mapped internal session ID.

Possibly related PRs

Suggested reviewers: blackmammoth

Poem

A rabbit maps each session trail,
Provider IDs guide the mail.
Internal names return in view,
Claude’s records now match true.
Hop, hop—identity is clear!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the Claude transcript search fix and the use of provider_session_id.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
server/modules/providers/services/session-conversations-search.service.ts (1)

790-801: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Add a regression test for both session identity paths.

Test a transcript whose entry.sessionId matches provider_session_id while session_id differs. Assert that the result matches and returns the internal session_id. Also test the fallback when provider_session_id is absent or equal to session_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

📥 Commits

Reviewing files that changed from the base of the PR and between c2408f0 and be17a7b.

📒 Files selected for processing (1)
  • server/modules/providers/services/session-conversations-search.service.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants