Repository navigation
fix(native-chat): unwrap Claude's pasted_content so a multi-line prompt's echo retires - #23469
Harshul1484 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This PR fixes #23450 by unwrapping Claude Code's <pasted_content> wrapper in the Claude transcript decoder, so a multi-line prompt's optimistic echo matches the saved transcript row and retires, and the user bubble no longer renders the literal tags.
- New
claude-pasted-content.ts— addsunwrapClaudePastedContent, one anchored regex that returns the inner text only when the whole block is exactly one paste (optionalidon both tags, openingidbackreferenced on the closing tag), else returns the input unchanged. transcript-line-decoders-claude.ts—decodeClaudeTranscriptLinemapsrole === 'user'blocks throughwithoutPastedContentWrapper; it only rewrites text blocks whose unwrap actually changed the text, leaving non-text blocks and assistant turns untouched.- New test file — 6 tests covering the unwrap, the normalization equality that drives echo retirement, array content with CRLF, text around a paste, a mismatched closing id, and assistant text quoting the wrapper. The first three fail without the decoder change.
I re-ran the touched suite (13 passed across the Claude decoder tests), oxlint, oxfmt --check, check:code-quality:changed (0 new findings), and typecheck:node — all clean. The decoder approach is the stronger of the two the issue suggested, since it also removes the tags from the rendered bubble instead of only fixing the comparison key, and it keeps the Claude-specific format inside the Claude decoder rather than the provider-neutral normalizer.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Delta since the prior review: the only new commit (f4f7a3d) shortens the file-level Why: comment in claude-pasted-content.ts and drops the function JSDoc. No behavior, signatures, regex, or test changes — the decoder and its 6 tests are byte-identical to the reviewed b93e6c0. Re-ran the Claude decoder suite (13 passed), oxlint, and check:code-quality:changed (0 new findings) at the new head; all clean. My prior review's assessment — mergeable as-is — stands.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change is mergeable after normal checks. A rare prompt that literally contains a complete pasted-content wrapper may not match its pending echo. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Saved pasted prompts should now replace their temporary copies correctly. No new permissions or external services are involved. A prompt that literally resembles Claude’s paste markers could, in some circumstances, be shown differently; whether that occurs in normal use remains unconfirmed. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |

ELI5
When you send a multi-line message in the chat view, Orca shows it straight away as a "pending" bubble and removes that copy once Claude Code saves the real message. Claude Code now saves pasted multi-line text wrapped in
<pasted_content>tags, so Orca never recognised the saved message as the same one, and the pending bubble stayed stuck at the bottom of the chat for the rest of the session. This PR removes that wrapper when Orca reads Claude's transcript, so the two copies match again.What Changed
<pasted_content id="…">tags.\n\n<pasted_content id="7e64">\n<prompt>\n</pasted_content id="7e64">\n.decodeClaudeTranscriptLinenow unwraps that for user turns (claude-pasted-content.ts). It only unwraps when the whole text block is exactly one paste with matching opening and closing ids, so text typed around a paste, mismatched tags and assistant text are left untouched.Why
The issue suggests two places for the fix: the pending-echo comparison key (
normalizeNativeChatUserText), or the Claude transcript decoder. I went with the decoder. Fixing only the key would retire the echo, but the transcript row that replaces it would then render the literal tags in the user bubble. Unwrapping in the decoder fixes both, and keeps the Claude-specific format inside the Claude decoder instead of the provider-neutral normalizer.Linked Issue
Fixes #23450
Visual Proof
Not captured. I couldn't run the desktop app on this machine, so the behavior is covered by decoder tests instead (below). The expected visual change: a multi-line prompt no longer stays pinned at the bottom of the chat, and its bubble shows no
<pasted_content>tags.Testing
transcript-line-decoders-claude-pasted-content.test.ts(6 tests):Without the decoder change, the first three fail and the three guards pass.
I also ran every native-chat suite (
src/main/native-chat,src/shared/native-chat*,src/renderer/src/components/native-chat): the same 51 tests fail with and without this change. They fail only in my local environment (dependencies installed with--ignore-scripts, so native modules weren't built), and no suite fails only with the change.oxlintandoxfmt --checkpass on the changed files, and a targetedtscover them (usingconfig/tsconfig.node.jsonsettings) reports no errors in them. I didn't run the fullpnpm typecheckandpnpm build: this machine doesn't have the memory for the 7 GB node typecheck, so CI will cover them.AI Disclosure
I used Claude (Anthropic's Claude Opus 5.5, through Claude Code) to investigate the issue, write the fix and tests, and run the checks above. I reviewed the change and the test results.
Review
AI code review summary:
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Older transcripts without the wrapper decode exactly as before.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)