Repository navigation
fix(native-chat): keep the attachments on a Claude turn that pasted images - #17801
Conversation
…mages
A Claude turn carrying pasted images reached native chat with no images at all —
no thumbnails on mobile, and not even an attachment chip on desktop. Nothing
showed that the message had any.
Both carriers were being dropped:
- Claude records the paths in a companion turn marked `isMeta`, holding one
`[Image: source: <path>]` text block per image. The decoder treats an `isMeta`
user row as injected, filters it down to tool-result blocks, and returns null
when none remain — so the whole row went away.
- The prompt row's own `image` blocks are `{source: {type: 'base64'}}`, which
carry no url or path, so `imageRefBlock` drops them too.
With the companion gone, `isImageSourceUserTurn` could never fire and the fold in
`normalizeImageTranscriptMessages` was unreachable on the Claude path.
Surveying every transcript under `~/.claude/projects`: 238 of 241 image-source
rows are `isMeta`, across every versioned release (2.1.220 through 2.1.237); the
3 that are not carry no version field at all. 38 of those rows hold more than one
content block, which also defeated the single-block rule in
`isImageSourceUserTurn`.
Let image-source text survive the injected-turn filter, and recognize a turn
whose blocks are *all* markers rather than only a lone one. An ordinary injected
turn (a skill preamble, a compact summary) is still dropped, and a turn that
mixes prose with a marker is still not an image-source turn.
Carrying the paths keeps the payload small; decoding the base64 instead would put
hundreds of KB per image on the wire to mobile.
📝 WalkthroughWalkthroughClaude transcript decoding now retains pure image-source companion rows and filters mixed injected rows correctly. Image normalization now detects multiple image-source text blocks and emits one Merge Risk: 🟡 Moderate · up to The change restores Claude image attachments, but adjacent image turns with different timestamps can still be combined incorrectly, causing an attachment to appear on the wrong message. This bounded correctness issue should be fixed or explicitly accepted before merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description gives a detailed explanation of the problem, root cause, fix, tests, and scope. However, it omits several required template sections and confirmations, including the ELI5 section, linked issue, visual proof or an explicit N/A statement, AI disclosure, review, agent-skill boundary, notes, and checklist items. Resolution Add the required template sections. Provide a linked issue after “Fixes #”. Add visual proof or write “N/A” with a reason if there is no visual change. Complete the testing checkboxes and list tested platforms. Complete AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections.
✨ 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: Team
Run ID: 7ae225f3-a554-4b42-a776-ed5c702c3a9f
📒 Files selected for processing (4)
src/main/native-chat/transcript-line-decoders-claude-image-companion.test.tssrc/main/native-chat/transcript-line-decoders-claude.tssrc/shared/native-chat-image-transcript-markers.test.tssrc/shared/native-chat-image-transcript-markers.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Greptile SummaryThe PR preserves Claude pasted-image companion rows and folds their paths into the associated prompt, including multi-image turns. It also introduces normalization-aware ordering across full and incremental session assembly.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains within the eligible follow-up-review scope. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/main/native-chat/transcript-line-decoders-claude.ts | Narrowly preserves injected Claude rows composed entirely of image-source markers while retaining the existing filtering behavior for other metadata. |
| src/shared/native-chat-image-transcript-markers.ts | Recognizes multi-block image companions, folds all paths into prompts, and keeps standalone companions scoped to their own paths. |
| src/renderer/src/components/native-chat/native-chat-session-assembler.ts | Adds normalization-aware atomic ordering for adjacent image companion and prompt records before full session assembly. |
| src/renderer/src/components/native-chat/native-chat-incremental-assembler.ts | Applies the same image-aware ordering to incremental rebuilds and avoids the common prompt-before-companion tail-append mismatch. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
T[Claude transcript rows] --> D[Decode content blocks]
D --> C{Pure image-source companion?}
C -->|Yes| K[Retain path markers]
C -->|No, injected| F[Keep tool results only]
K --> S[Normalization-aware ordering]
P[Prompt with Image markers] --> S
S --> N[Fold companion paths into prompt]
N --> O[Native chat message with image refs]
Reviews (4): Last reviewed commit: "fix(native-chat): keep image companions ..." | Re-trigger Greptile
86914e8 to
65dcef6
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 8c3da973-456e-4b0d-94d1-11a9b4cb2448
📥 Commits
Reviewing files that changed from the base of the PR and between a996b4a and 86914e88285623b9a76a9614403910aa5c82ad0e.
📒 Files selected for processing (5)
src/main/native-chat/transcript-line-decoders-claude-image-companion.test.tssrc/main/native-chat/transcript-line-decoders-claude.tssrc/renderer/src/components/native-chat/native-chat-incremental-assembler.test.tssrc/renderer/src/components/native-chat/native-chat-session-assembler.test.tssrc/renderer/src/components/native-chat/native-chat-session-assembler.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/native-chat/transcript-line-decoders-claude.ts
- src/main/native-chat/transcript-line-decoders-claude-image-companion.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/renderer/src/components/native-chat/native-chat-session-assembler.ts (1)
137-138:⚠️ Potential issue | 🟠 MajorKeep each equal-timestamp companion paired with its prompt.
The previous review comment at Line 138 remains unresolved.
imageTranscriptOrderglobally places every image-source companion before every image prompt. With two same-timestamp pairs,normalizeImageTranscriptMessagesconsumes both companions and assigns both paths to the first prompt. The later prompt loses its image. Preserve pair-specific adjacency, or pair messages by an explicit turn identity, and add a regression test for two same-timestamp pairs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: b69910d3-e7b6-44c6-a4d3-ac94a3f45b50
📥 Commits
Reviewing files that changed from the base of the PR and between 86914e88285623b9a76a9614403910aa5c82ad0e and 65dcef6.
📒 Files selected for processing (1)
src/renderer/src/components/native-chat/native-chat-session-assembler.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Companion-row survival —
decodeClaudeTranscriptLinenow keeps pure[Image: source: …]text blocks on injected user turns, so theisMeta/turnCompanionrow that carries pasted-image paths is no longer dropped. - Multi-image fold —
imageSourcePathsFromMessagereplaces the single-blocksoleTextrule, lettingnormalizeImageTranscriptMessagesfold every marker block (and adjacent source turns) into the prompt while scoping the no-prompt fallback to the turn's own paths. - Tests — a verbatim two-row decoder fixture plus multi-block and mixed-prose guards, with ablation-verified coverage.
The fold's forward-scan semantics are preserved for the single-marker, adjacent-standalone, and no-caption cases, and the decoder change stays narrow: ordinary injected turns (skill preamble, compact summary) still decode to null. The fallback correctly uses messageImagePaths rather than the accumulated scan paths, so a standalone image turn cannot swallow a neighbour's refs.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No critical issues — one small reuse nit inline.
Reviewed changes
- Stricter companion recognition in the decoder — an injected row now survives as an image turn only when every block is an
[Image: source: …]marker; mixed marker-and-prose or marker-and-tool-result rows fall back to tool-result-only (or drop), so they can no longer become image-source turns. - Equal-timestamp companion/prompt ordering —
compareMessagesgains an image tier (companion < other < prompt-with-marker) and each source is sorted before normalization, so a companion emitted at the same instant as its prompt is always folded regardless of UUID or arrival order. - Tests — new decoder cases for mixed meta rows, plus assembler and incremental-assembler cases pinning equal-timestamp companion-first ordering.
All five delta files were verified: the touched test suites, plus the parity oracle (512 seeds), pass locally.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Review status — commit
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: c73ec6de-e2ab-472e-b1e1-9eca36b83820
📒 Files selected for processing (4)
src/renderer/src/components/native-chat/native-chat-incremental-assembler.test.tssrc/renderer/src/components/native-chat/native-chat-incremental-assembler.tssrc/renderer/src/components/native-chat/native-chat-session-assembler.test.tssrc/renderer/src/components/native-chat/native-chat-session-assembler.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer/src/components/native-chat/native-chat-session-assembler.test.ts
- src/renderer/src/components/native-chat/native-chat-incremental-assembler.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| nextIndex < messages.length && | ||
| messages[nextIndex]?.source === message.source && | ||
| isImageSourceUserTurn(messages[nextIndex]!) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Keep each forward companion group within one timestamp.
This branch groups every adjacent same-source companion, even when the rows have different timestamps. If a standalone companion at timestamp A directly precedes companion rows and a marked prompt at timestamp B, normalization folds the timestamp-A path into the timestamp-B prompt.
Require message.timestamp equality for both the companion loop and the candidate prompt. Add a regression case with adjacent same-source image turns at different timestamps.
Proposed fix
nextIndex < messages.length &&
messages[nextIndex]?.source === message.source &&
+ messages[nextIndex]?.timestamp === message.timestamp &&
isImageSourceUserTurn(messages[nextIndex]!)
) {
@@
candidate?.role === 'user' &&
candidate.source === message.source &&
+ candidate.timestamp === message.timestamp &&
hasImagePromptMarker(candidate)
) {Also applies to: 200-202
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Turn-local companion grouping —
sortForImageNormalizationreplaces the global image-tier sort (imageTranscriptOrder/isImageSourceCompanion) with atomic per-turn units, so each image-source companion run stays glued to its adjacent prompt instead of every companion sorting before every prompt. - Sort wired through both assemblers —
assembleNativeChatSessionsorts transcript and scrape sources through the new helper before folding, and the incremental assembler'sreset/applyAppendsuse it too. - Tail-append guard —
isTailAppendnow bails when the current tail is a prompt with an image marker and the incoming batch opens with its equal-timestamp companion, forcing a full re-sort so the companion lands before the prompt. - Regression tests — new cases pin no cross-folding of distinct equal-timestamp image turns, no moving a companion across an unrelated row, and the incremental assembler's matching behavior.
The prior reuse nitpick is addressed: isImageSourceCompanion (and its duplicate predicate) is gone, and both sort paths now import the shared isImageSourceUserTurn/hasImagePromptMarker. The equal-timestamp cross-fold concern from the earlier review is fixed by the unit grouping and covered by the new tests.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…#17930) * fix(native-chat): keep the attachments on a Claude turn that pasted images (#17801) * fix(native-chat): keep the attachments on a Claude turn that pasted images A Claude turn carrying pasted images reached native chat with no images at all — no thumbnails on mobile, and not even an attachment chip on desktop. Nothing showed that the message had any. Both carriers were being dropped: - Claude records the paths in a companion turn marked `isMeta`, holding one `[Image: source: <path>]` text block per image. The decoder treats an `isMeta` user row as injected, filters it down to tool-result blocks, and returns null when none remain — so the whole row went away. - The prompt row's own `image` blocks are `{source: {type: 'base64'}}`, which carry no url or path, so `imageRefBlock` drops them too. With the companion gone, `isImageSourceUserTurn` could never fire and the fold in `normalizeImageTranscriptMessages` was unreachable on the Claude path. Surveying every transcript under `~/.claude/projects`: 238 of 241 image-source rows are `isMeta`, across every versioned release (2.1.220 through 2.1.237); the 3 that are not carry no version field at all. 38 of those rows hold more than one content block, which also defeated the single-block rule in `isImageSourceUserTurn`. Let image-source text survive the injected-turn filter, and recognize a turn whose blocks are *all* markers rather than only a lone one. An ordinary injected turn (a skill preamble, a compact summary) is still dropped, and a turn that mixes prose with a marker is still not an image-source turn. Carrying the paths keeps the payload small; decoding the base64 instead would put hundreds of KB per image on the wire to mobile. * fix(native-chat): preserve image companion ordering * fix(native-chat): keep image companions turn-local --------- Co-authored-by: Merge Sim <sim@local> * fix(native-chat): stop unjournaled provider frames from killing the session (#17813) A frame the classifier declines (status-chrome, suppressed-benign, stream-into-item) is deliberately not journaled. #17720 turned that null translation into `{accepted: false, reason: 'untranslated'}`, which is not `backpressure`, so the notification retry queue treated it as unreplayable and escalated through fail() -> forceCloseUnexpected -> connection.close(). The app-server latched `closing` and the create path's next model/list rejected with "codex app-server connection is closed (model/list)". The provider emits `remoteControl/status/changed` right after initialize, so every structured Codex session died on its first chrome frame. Admit the null translation instead, before any bookkeeping or publish. Also restore the error-frame exemption from the generic row cap, dropped by the same PR: the cap now runs after the classification check, so a noisy turn can no longer reduce provider errors to a suppression count. The test that pinned the capped behavior is inverted to assert the exemption. Co-authored-by: Merge Sim <sim@local> * refactor(mobile): split session and terminal surfaces (cherry picked from commit f129f29) * fix(mobile): restore session parity after extraction (cherry picked from commit 47706a5) * chore(mobile): prune stale max-lines overrides (cherry picked from commit be954c3663409116f34ba08658876262733b3f67) * fix(mobile): honor host-follow tab snapshots (cherry picked from commit a4a9c4da19d6967eceb8025dd01480a56261039f) * fix(mobile): keep split session hooks render-pure Documents the pre-existing render-time refs the split relocated onto changed lines, and drops a ref assignment the split added that the monolith never had. * fix(agent-send-target): acknowledge delivery even when picker closes bef (#17835) Delivery callbacks and telemetry belong to the completed send operation, not to the picker instance that launched it. Remove early returns that skipped delivery acknowledgment and success toast when the popover was already closed. * fix(mobile-native-chat): retire an image echo glued with the send beside it (#17783) * fix(mobile-native-chat): retire an image echo glued with the send beside it A message sent with images could render two or three times over, with the copy carrying the photos sorting below the reply that answered it — and it never cleared. A send issued while the agent is mid-turn is glued onto the agent's input line with any send adjacent to it, so the pair lands as one transcript row whose text is the concatenation. Every retirement path then declined the pair: - The image matcher wanted the whole row to equal the echo's text, so a glued row never bound. That also stranded the local preview: the phone's photo never reached the authoritative row. - The exact-count path skips image echoes by design. - The glue path excluded image echoes too, which made one a *barrier* — splitting the run so the text-only send beside it was left alone, and a lone match is rejected as an ordinary landing. So neither echo could ever retire, and the unmatched image echo fell through to the trailing bucket, which is what put it below the reply. Match a glued row in the image matcher, and let an image echo take part in the glue pass once its preview has been rebound. It stays a barrier while unbound, so the existing guarantee is kept: an image echo never retires before its local preview reaches the transcript row, or the photo would disappear. * fix(mobile-chat): require image provenance for glued prefix matches --------- Co-authored-by: Merge Sim <sim@local> * refactor(renderer): split oversized UI surfaces (cherry picked from commit da89be4) * fix(renderer): keep split imports lint-clean (cherry picked from commit c778ac7) * fix(renderer): preserve extracted lifecycle and retention behavior (cherry picked from commit 1731f2a) * chore(max-lines): prune refactored file suppressions (cherry picked from commit 787228e) * fix(status-bar): preserve Git refresh ordering after split (cherry picked from commit e65d298) * fix(lint): preserve TaskPage effect suppressions after split (cherry picked from commit 4a3bc23) * fix(status-bar): preserve workspace-space review and agent freshness (cherry picked from commit 9455e31) * fix(automations): preserve Escape drill-out behavior (cherry picked from commit 790680d) * fix(renderer): restore worktree palette behavior after split (cherry picked from commit 0b78c1c) * style(renderer): format palette project candidates (cherry picked from commit 1e93d66) * refactor(renderer): finish worktree palette extraction (cherry picked from commit ea8e6e5) * fix(renderer): document intentional render-time refs (cherry picked from commit 6fc78dd) * chore(max-lines): prune stale lifecycle baseline (cherry picked from commit 42bf3eb) * fix(renderer): preserve status localization parity (cherry picked from commit 0a802c7) * fix(renderer): preserve floating editor visibility (cherry picked from commit bcf715b) * fix(automations): preserve destination form save semantics (cherry picked from commit a793b07) * fix(renderer): preserve Codex sign-in behavior (cherry picked from commit 81f4803) * fix(renderer): preserve palette create telemetry (cherry picked from commit b13c2b1) * style(renderer): format extracted palette modules * refactor(automations): extract list toolbar and drop dead list projection * fix(lint): drop unused exhaustive-deps suppression after split The split's dependency list no longer trips the rule, so the directive is dead and the changed-code quality gate rejects it. * fix(renderer): document pre-split render-time refs in workspace search Both assignments are verbatim from the pre-split monolith; the split relocated them onto changed lines, which the React Doctor gate scans. * refactor(renderer): split runtime and store modules (cherry picked from commit 207bef0) * fix(renderer): merge split runtime imports (cherry picked from commit 90bf505) * chore(max-lines): prune runtime baseline entries (cherry picked from commit 08820a4) * fix(renderer): preserve accepted visibility snapshots (cherry picked from commit bc5f8a5ac5b8e8ad3fc59250795842e663bad0ee) * refactor(preload): split bridge API modules (cherry picked from commit b77e318) * test(preload): census split GitHub bridge owners (cherry picked from commit cd08e4e) * fix(preload): merge split plugin imports (cherry picked from commit 682ff4f) * chore(max-lines): prune preload baseline entry (cherry picked from commit aad2e1e) * fix(pty,remote): close the pty master fd leak and two remote-terminal defects #8362: node-pty leaves the forkpty()/posix_openpt() master without FD_CLOEXEC, so on Linux every later child of the process -- both later pty children and plain child_process spawns -- inherits it and keeps the /dev/pts device alive. Measured on Linux with stock node-pty 1.1.0: master fd flags 0404002 (cloexec=false), and 17 -> /dev/pts/ptmx present in both a later pty child's /proc/self/fd and a later child_process child's. Extend the existing node-pty patch with pty_cloexec() on both PtyFork spawn paths; after the patch the flags read 02404002 (cloexec=true) and neither child sees the master. This covers the app and terminal daemon only -- the SSH relay installs node-pty from npm on the remote host, so it stays exposed (see the report). #8414: the inspection queue's fire-and-forget `.finally()` chain re-raised a rejecting inspection as a renderer-global unhandledrejection, which an unreachable runtime produced on every cadence tick. #9194: `tab_not_found` is the host's definitive "no such tab", but the close path cleared the close intent for it exactly like a dropped connection, so a host that keeps republishing the dead surface re-materialized the pane the user just closed. Keep that intent and drop its TTL. Also route the banner's "Remote terminal was closed." line through translate() so it stops mixing English into a localized banner. * fix(pty): retire the node-pty master fd instead of probing around it node-pty hands the master to libuv, which closes it on EIO/EOF, but `_close()` never invalidated `_fd` and neither `resize()` nor the `process` getter consulted anything. A late ioctl therefore addressed whatever the kernel had since reissued that number to. On Linux the very next pty gets it: resizing an exited handle silently resized an unrelated live pane, with no error for #17832's probe-retry-classify to observe. Retire `_fd` in the same block that gives up the master and guard both fd-addressed syscalls on it, so a stale handle is unreachable by construction. The relay's resize keeps the isProcessAlive-proven retirement — still the only evidence of `exited` — and drops the re-probe-and-classify arm the ioctl no longer needs. Windows is unaffected: WindowsTerminal.resize goes through the conpty agent and reads no fd. * fix(pty): retire the write stream's fd copy too, and keep the resize re-probe Two gaps in the fd-retirement change. `CustomWriteStream` is the third fd-addressed surface and takes its own plain-number copy of the master at spawn, so `Terminal._fd = -1` never reaches it. Its `dispose()` only cleared a pending immediate, and it was called from `destroy()` alone — the EIO/EOF read-error path and the socket `'close'` path both reach `_close()` without it. A residual `_writeQueue` and an in-flight `fs.write` therefore kept addressing the number after libuv gave it up. Retire the copy and drop the queue in `dispose()`, and call it from `_close()`. Restore the relay's catch-block re-probe. It was never redundant with the patch: libuv closes the fd synchronously inside `uv_close`, before the JS `'close'` that runs `_close()`, so the reuse window opens ahead of any JS guard; and a relay host installs node-pty from npm, where the patch is not applied at all. The re-probe is a `process.kill(pid, 0)` on a path already inside an exception handler. Both existing resize tests pinned liveness with a constant mock, which is why the deletion passed CI invisibly; the new case is alive at the pre-probe and gone by the time the ioctl throws. Also adds the patch's first upstream reference: microsoft/node-pty#220 named this mechanism in 2018 and was closed 2025-12-19 as completed after only improving the error message; #827 is still open. Tracked as #18109. * test(pty): release the live pty before the next fd-reuse case The new Linux write case killed its live pty without awaiting the exit, so that master was still open when the next case spawned. Linux hands out the lowest free descriptor, so the retired pty got N+1 while the leaked N closed during the 400ms settle -- and `does not name a live pty foreground process off the retired descriptor` then saw its live pty take N, failing its own reuse premise by exactly one (`expected 22 to be 23` on CI, reproduced as 19/20 in a container). Test isolation, not a Linux behavior difference: with the descriptor released the case passes 8/8. Await the exit like the resize case above already does, and switch the payload command to `sleep 1` -- the line discipline echoes a leaked write back on its own, so nothing has to read it. Note the constraint on the block so the next case does not repeat it. The premise assertion stays as it is. It compares two observed descriptors, not a hardcoded number; relaxing it to "differs from the retired one" would let both reuse cases pass vacuously on a kernel that never reissues, which is the whole thing they exist to demonstrate. Verified with vitest under node:24-bookworm against a source-built patched node-pty: 7 passed, 8 runs, no flake. Negative check in the same container -- reverting the `_close()` -> `dispose()` hook fails the case with `expected 'leak\r\n' not to contain 'leak'`, so the rewritten assertion is still load-bearing. --------- Co-authored-by: Brennan Benson <[email protected]> Co-authored-by: Merge Sim <sim@local> Co-authored-by: Jinjing <[email protected]>
…mages (stablyai#17801) * fix(native-chat): keep the attachments on a Claude turn that pasted images A Claude turn carrying pasted images reached native chat with no images at all — no thumbnails on mobile, and not even an attachment chip on desktop. Nothing showed that the message had any. Both carriers were being dropped: - Claude records the paths in a companion turn marked `isMeta`, holding one `[Image: source: <path>]` text block per image. The decoder treats an `isMeta` user row as injected, filters it down to tool-result blocks, and returns null when none remain — so the whole row went away. - The prompt row's own `image` blocks are `{source: {type: 'base64'}}`, which carry no url or path, so `imageRefBlock` drops them too. With the companion gone, `isImageSourceUserTurn` could never fire and the fold in `normalizeImageTranscriptMessages` was unreachable on the Claude path. Surveying every transcript under `~/.claude/projects`: 238 of 241 image-source rows are `isMeta`, across every versioned release (2.1.220 through 2.1.237); the 3 that are not carry no version field at all. 38 of those rows hold more than one content block, which also defeated the single-block rule in `isImageSourceUserTurn`. Let image-source text survive the injected-turn filter, and recognize a turn whose blocks are *all* markers rather than only a lone one. An ordinary injected turn (a skill preamble, a compact summary) is still dropped, and a turn that mixes prose with a marker is still not an image-source turn. Carrying the paths keeps the payload small; decoding the base64 instead would put hundreds of KB per image on the wire to mobile. * fix(native-chat): preserve image companion ordering * fix(native-chat): keep image companions turn-local --------- Co-authored-by: Merge Sim <sim@local>



What was broken
A Claude turn carrying pasted images reached native chat with no images at all — no thumbnails on mobile, and not even an attachment chip on desktop. Nothing indicated the message had any.
Root cause
Both carriers of the attachment were dropped.
1. The companion row is
isMeta. Claude records the paths in a separate turn holding one[Image: source: <path>]text block per image, markedisMeta: true(andturnCompanion: truesince 2.1.237).transcript-line-decoders-claude.tstreats anisMetauser row as injected, filters its blocks down totool-result, and returnsnullwhen none remain:2. The prompt row's own image blocks have no address. They are
{type: 'image', source: {type: 'base64', media_type, data}};imageRefBlock(transcript-record-blocks.ts:103) requiressource.url,record.url, orrecord.path, so they drop too.With the companion gone,
isImageSourceUserTurncould never fire, which made the fold innormalizeImageTranscriptMessagesunreachable on the Claude path.Survey
Every transcript under
~/.claude/projects— 238 of 241 image-source rows areisMeta:Every row from every versioned release is meta. Separately, 38 of those rows hold more than one content block, which also defeated the single-block (
soleText) rule inisImageSourceUserTurn— so a multi-image paste would have been missed even with the meta filter lifted.The fix
[Image: source: ...]marker.Preserved: an ordinary injected turn (skill preamble, compact summary) is still dropped, and a turn mixing prose with a marker is still not an image-source turn. Both are pinned by tests.
Carrying the paths keeps the payload small — decoding the base64 instead would put hundreds of KB per image on the wire to mobile (the reported turn had four blocks totalling ~1.2 MB).
Verification
\r+[Image #N]markers + base64 blocks, plus theisMetacompanion) and asserts the folded turn carries both image refs, the caption survives marker-stripped, and an ordinaryisMetaturn still returnsnull.src/main/native-chat+src/shared+src/renderer/.../native-chat: 183 files / 1727 tests pass. Full mobile suite: 488 files / 3971 tests pass.pnpm tcand mobiletsc --noEmitclean.Caught in review of my own first attempt
My initial version made a standalone image turn swallow its neighbour's path — the fallback branch used the paths accumulated by the fold scan rather than the turn's own.
preserves adjacent standalone image turns without a prompt markercaught it; the landed version scopes the fallback to the turn itself.Unrelated pre-existing failure
structured-tui-transcript-catchup.test.ts > tails only TUI-era appends from the durable account homefails on this branch and on a pristine checkout without these changes. Not introduced here.Follow-on
This restores the attachment chip on desktop and lets mobile's local-preview binding attach real thumbnails on the sending device. Rendering a host path as an actual image on a remote mobile client still needs a transport for the file and is out of scope.