Repository navigation
Fix native chat image marker position handling - #14162
Conversation
|
Warning Review limit reached
Next review available in: 8 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughImage prompt markers are now recognized anywhere in transcript text, including repeated runs. Marker removal preserves required spacing. Transcript assembly merges image sources with trailing-marker prompts into one cleaned user message with an image reference. Mobile draft reconciliation normalizes text, matches these prompts, migrates standalone previews, clears pending sends, and assigns previews to the authoritative message. Regression tests cover parsing, assembly, rendering, pending-send pruning, and reconciliation. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 905f56c0-40d2-4907-bacc-e35ebb39c6b7
📒 Files selected for processing (10)
mobile/src/session/mobile-native-chat-draft-reconcile.test.tsmobile/src/session/mobile-native-chat-draft-reconcile.tsmobile/src/session/mobile-native-chat-image-transcript-markers.tsmobile/src/session/mobile-native-chat-render-data.test.tsmobile/src/session/use-mobile-native-chat-drafts.test.tssrc/renderer/src/components/native-chat/native-chat-pending.test.tssrc/renderer/src/components/native-chat/native-chat-preassembled-session-parity.test.tssrc/renderer/src/components/native-chat/native-chat-session-assembler.test.tssrc/shared/native-chat-image-transcript-markers.test.tssrc/shared/native-chat-image-transcript-markers.ts
QA evidence (HEAD
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
mobile/src/session/use-mobile-native-chat-drafts.ts (1)
136-142: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the canonical matching field.
captureSendOriginnow returnsnormalizedTextafter whitespace canonicalization. Add a brief comment to the exported return contract orMobileNativeChatSendOrigin.normalizedTextstating that this value is for reconciliation only. Callers must keep using the originaltextfor display and send payloads.Based on learnings: document non-obvious members of exported hook-return contracts, but do not add boilerplate documentation for trivial local callbacks.
Source: Learnings
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 54e8926f-77b1-4542-adc7-580b8a564513
📒 Files selected for processing (5)
mobile/src/session/mobile-native-chat-draft-reconcile.test.tsmobile/src/session/mobile-native-chat-draft-reconcile.tsmobile/src/session/use-mobile-native-chat-drafts.tssrc/shared/native-chat-image-transcript-markers.test.tssrc/shared/native-chat-image-transcript-markers.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- mobile/src/session/mobile-native-chat-draft-reconcile.ts
- src/shared/native-chat-image-transcript-markers.test.ts
- mobile/src/session/mobile-native-chat-draft-reconcile.test.ts
- src/shared/native-chat-image-transcript-markers.ts
|
thanks for reporting. looking into it |
* fix(native-chat): handle image markers in any position * fix(native-chat): preserve image caption whitespace * test(native-chat): cover marker boundary spacing * fix(mobile): normalize image echo reconciliation * fix(mobile): use idiomatic tail access * refactor(native-chat): share image echo matching * perf(native-chat): avoid unchanged block copies


Summary
[Image #N]is detected and stripped at the start, end, or middle of a caption.Before this fix, an image send could render two bubbles: one delivered bubble with literal trailing
[Image #1]text and no image, plus a second never-clearing optimistic bubble holding the photo. The root cause was a start-anchored shared regex even though Claude can append the marker as a suffix; because that regex is shared, desktop native chat was affected too.The send-ordering race that lets the marker arrive late is deliberately not fixed here. Replacing the fixed settle delays or changing image send ordering remains follow-up scope.
Screenshots
No screenshot was captured. Before: two bubbles appeared for one image send—literal trailing marker/no image, then a never-clearing photo bubble; after: one bubble contains the caption and folded image.
Testing
pnpm lintpnpm typecheckpnpm test— targeted affected suites pass; the full root suite was stopped after unrelated existing PTY/updater/remote-runtime failures (pty-handler.test.ts,ipc/pty.test.ts,updater.test.ts,remote-runtime-pty-transport.test.ts,pty-subprocess.test.ts).pnpm buildTargeted commands:
PATH="/opt/homebrew/opt/node@24/bin:$PATH" pnpm exec vitest run --config config/vitest.config.ts src/shared/native-chat-image-transcript-markers.test.ts src/renderer/src/components/native-chat/native-chat-session-assembler.test.ts src/renderer/src/components/native-chat/native-chat-preassembled-session-parity.test.ts src/renderer/src/components/native-chat/native-chat-pending.test.ts— 84 passed.PATH="/opt/homebrew/opt/node@24/bin:$PATH" node ./mobile/node_modules/vitest/vitest.mjs run --config mobile/vitest.config.ts mobile/src/session/mobile-native-chat-draft-reconcile.test.ts mobile/src/session/use-mobile-native-chat-drafts.test.ts mobile/src/session/mobile-native-chat-render-data.test.ts— 45 passed.AI Review Report
Self-reviewed marker stripping, transcript folding, pending-send matching, preview migration, and all importers/call sites. Cross-platform macOS/Linux/Windows behavior was checked: this is pure shared string/regex logic with no platform-dependent path, shell, or shortcut behavior, and it remains compatible with local, folder-workspace, SSH, and remote sessions.
Security Audit
No new input authority, filesystem access, network behavior, or dependency changes. Image source-path parsing is unchanged; only the position of an existing transcript marker is generalized.
Notes
Scope is intentionally limited to marker-position handling and tests. Send ordering, settle delays, and queued/pending labels are unchanged.