Skip to content

fix(claude): support Claude Desktop transcript format#739

Open
WenhuaXia wants to merge 1 commit intositeboon:mainfrom
WenhuaXia:main
Open

fix(claude): support Claude Desktop transcript format#739
WenhuaXia wants to merge 1 commit intositeboon:mainfrom
WenhuaXia:main

Conversation

@WenhuaXia
Copy link
Copy Markdown

@WenhuaXia WenhuaXia commented May 4, 2026

Summary

  • Claude Code Desktop writes JSONL entries with a top-level type: 'assistant' field instead of message.role: 'assistant'
  • The session parser only checked message.role, causing all assistant messages to be silently skipped
  • Users see no replies in the chat UI when using sessions from Claude Code Desktop

Fix

Check both raw.message?.role === 'assistant' and raw.type === 'assistant' to support both CLI and Desktop transcript formats.

Test plan

  • Install ClaudeCodeUI with Claude Code Desktop sessions and verify assistant messages are displayed
  • Verify CLI sessions (with message.role) still work correctly

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced message detection in Claude transcripts. Tool usage data is now correctly identified and processed across multiple transcript format variations, including those from Claude Desktop and other transcript sources. All transcripts are handled reliably and consistently regardless of their structural format, composition, or origin.

… messages lack message.role

Claude Code Desktop writes JSONL entries with a top-level `type: 'assistant'` field
instead of `message.role: 'assistant'`. The session parser only checked
`message.role`, causing all assistant messages to be silently skipped and users
seeing no replies in the chat UI.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f2ffc435-1987-485f-bceb-545c233afca6

📥 Commits

Reviewing files that changed from the base of the PR and between e89d2da and 4be505b.

📒 Files selected for processing (1)
  • server/modules/providers/list/claude/claude-sessions.provider.ts

📝 Walkthrough

Walkthrough

The PR extends transcript format detection in the Claude sessions provider to support both CLI-style (message.role) and Desktop-style (type) assistant markers. Two functions that identify and normalize assistant entries now check both condition patterns to handle both transcript shapes.

Changes

Transcript Format Support Expansion

Layer / File(s) Summary
Assistant Entry Detection
server/modules/providers/list/claude/claude-sessions.provider.ts (lines 53-60)
parseAgentTools now identifies assistant entries when either entry.message.role === 'assistant' or entry.type === 'assistant', broadening which entries are scanned for tool_use parts.
Assistant Message Normalization
server/modules/providers/list/claude/claude-sessions.provider.ts (lines 352-358)
normalizeMessage applies the same dual-condition check (`raw.message?.role === 'assistant'

Suggested reviewers

  • viper151
  • blackmammoth

Poem

🐰 A rabbit's ode to flexibility:

Two formats, one provider—what joy!
Both CLI and Desktop now play,
Assistant entries dance either way,
With role or type deployed,
No transcript left behind today! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding support for Claude Desktop transcript format to handle entries with top-level type: 'assistant' instead of just message.role.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

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.

1 participant