Skip to content

fix(native-chat): keep the attachments on a Claude turn that pasted images - #17801

Merged
brennanb2025 merged 3 commits into
mainfrom
brennanb2025/native-chat-claude-image-blocks-fix
Sep 1, 2026
Merged

brennanb2025 merged 3 commits into
mainfrom
brennanb2025/native-chat-claude-image-blocks-fix

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​350 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​350
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​156 $\color{#cf222e}{\Huge{\mathbf{−}}}$​23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​133

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, marked isMeta: true (and turnCompanion: true since 2.1.237). transcript-line-decoders-claude.ts treats an isMeta user row as injected, filters its blocks down to tool-result, and returns null when none remain:

const blocks = isInjectedUserTurn
  ? decodedBlocks.filter((block) => block.type === 'tool-result')
  : decodedBlocks
if (blocks.length === 0) { return null }

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) requires source.url, record.url, or record.path, so they drop too.

With the companion gone, isImageSourceUserTurn could never fire, which made the fold in normalizeImageTranscriptMessages unreachable on the Claude path.

Survey

Every transcript under ~/.claude/projects — 238 of 241 image-source rows are isMeta:

version isMeta
2.1.220 48
2.1.227 13
2.1.228 9
2.1.229 5
2.1.232 18
2.1.233 63
2.1.234 8
2.1.237 74
(no version field) 0 — the only 3 non-meta rows

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 in isImageSourceUserTurn — so a multi-image paste would have been missed even with the meta filter lifted.

The fix

  • Let image-source text survive the injected-turn filter, narrowly: a text block only passes when it parses as an [Image: source: ...] marker.
  • Recognize a turn whose blocks are all markers, instead of only a lone one, so a multi-image paste folds.

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

  • New test decodes the verbatim two-row shape (prompt row with \r + [Image #N] markers + base64 blocks, plus the isMeta companion) and asserts the folded turn carries both image refs, the caption survives marker-stripped, and an ordinary isMeta turn still returns null.
  • Ablation: reverting the decoder filter turns 2 of the 3 new tests red; reverting multi-block support turns 1 red. Both restored and re-verified green.
  • src/main/native-chat + src/shared + src/renderer/.../native-chat: 183 files / 1727 tests pass. Full mobile suite: 488 files / 3971 tests pass. pnpm tc and mobile tsc --noEmit clean.
  • Changed-code quality gate: 0 new findings across 4 files.

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 marker caught 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 home fails 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.

…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.
@coderabbitai

coderabbitai Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Claude 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 image-ref block per path. Session and incremental assembly preserve companion-prompt pairings during equal-timestamp ordering. Tests cover decoding, normalization, ordering, and ordinary injected-turn removal.

Merge Risk: 🟡 Moderate · up to 849f2

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)

Check name Status Explanation Resolution
Description check ⚠️ Warning 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, link… 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, Revie…
Docstring Coverage ⚠️ Warning Docstring coverage is 64.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: preserving attachments on Claude turns that contain pasted images. It is concise and specific.
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.
Full details: Description check

Explanation

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.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 7ae225f3-a554-4b42-a776-ed5c702c3a9f

📥 Commits

Reviewing files that changed from the base of the PR and between abe1d30 and a996b4a.

📒 Files selected for processing (4)
  • src/main/native-chat/transcript-line-decoders-claude-image-companion.test.ts
  • src/main/native-chat/transcript-line-decoders-claude.ts
  • src/shared/native-chat-image-transcript-markers.test.ts
  • src/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-apps

greptile-apps Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Greptile Summary

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

  • Retains pure image-source metadata rows while continuing to filter ordinary injected turns.
  • Supports multiple image-source markers within one companion row.
  • Keeps adjacent companion and prompt records together during session ordering.
  • Adds decoder, normalization, full-assembly, and incremental-assembly regression coverage.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the eligible follow-up-review scope.

No blocking failure remains.

Important Files Changed

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]
Loading

Reviews (4): Last reviewed commit: "fix(native-chat): keep image companions ..." | Re-trigger Greptile

@brennanb2025
brennanb2025 force-pushed the brennanb2025/native-chat-claude-image-blocks-fix branch from 86914e8 to 65dcef6 Compare September 1, 2026 04:41

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

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.ts
  • src/main/native-chat/transcript-line-decoders-claude.ts
  • src/renderer/src/components/native-chat/native-chat-incremental-assembler.test.ts
  • src/renderer/src/components/native-chat/native-chat-session-assembler.test.ts
  • src/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.

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

♻️ Duplicate comments (1)
src/renderer/src/components/native-chat/native-chat-session-assembler.ts (1)

137-138: ⚠️ Potential issue | 🟠 Major

Keep each equal-timestamp companion paired with its prompt.

The previous review comment at Line 138 remains unresolved. imageTranscriptOrder globally places every image-source companion before every image prompt. With two same-timestamp pairs, normalizeImageTranscriptMessages consumes 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.

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Companion-row survival — decodeClaudeTranscriptLine now keeps pure [Image: source: …] text blocks on injected user turns, so the isMeta/turnCompanion row that carries pasted-image paths is no longer dropped.
  • Multi-image fold — imageSourcePathsFromMessage replaces the single-block soleText rule, letting normalizeImageTranscriptMessages fold 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.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog 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.

ℹ️ 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 — compareMessages gains 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.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Electron validation (commit 65dcef636f)

Launched this worktree with an isolated dev profile (CDP 9363, renderer 5188). window.api.app.getIdentity() returned:

  • name: Orca: brennanb2025/native-chat-claude-image-blocks-fix
  • devBranch: brennanb2025/native-chat-claude-image-blocks-fix
  • devRepoRoot: /Users/brennanbenson/orca/workspaces/orca/native-chat-claude-image-blocks-fix

Dock tile included Orca/ brennanb2025-native-chat-claude-image-blocks-fix.

Native Claude image attachments

Seeded the verbatim Claude pasted-image JSONL (isMeta companion + prompt with [Image #N] / pathless base64). nativeChat.readSession kept the companion row. The visible native chat transcript then rendered two Pasted image chips on the user bubble, with the caption and assistant reply.

Loaded Orca UI
01-loaded-orca-ui.png

Attachment chips in native Claude chat
04-native-chat-image-chips.png

Renderer console: 0 errors, 4 unrelated warnings. No product-file edits.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review status — commit 849f2671fe

The PR was reviewed and corrected in three same-model, high-effort passes:

  • Preserved pure Claude image companion rows, including multi-image companions.
  • Prevented mixed marker/prose metadata rows from becoming image attachments.
  • Made equal-timestamp folding turn-local so distinct turns cannot cross-fold or reorder.

Verification:

  • 61 focused tests pass locally (decoder, full-session, and incremental assembler coverage).
  • pnpm tc passes.
  • Changed-code quality, type-aware quality, React Doctor, oxlint, formatting, and diff checks pass with 0 new findings.
  • Final readiness audit found no P0/P1 issues and no remaining candidate findings.
  • Grok Electron validation rendered two Pasted image chips with the caption and assistant reply; screenshots are attached in the Electron evidence comment.
  • Worktree is clean and the PR branch is pushed at 849f2671fe.

GitHub package and test checks were still running when this status was posted.

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: c73ec6de-e2ab-472e-b1e1-9eca36b83820

📥 Commits

Reviewing files that changed from the base of the PR and between 65dcef6 and 849f267.

📒 Files selected for processing (4)
  • src/renderer/src/components/native-chat/native-chat-incremental-assembler.test.ts
  • src/renderer/src/components/native-chat/native-chat-incremental-assembler.ts
  • src/renderer/src/components/native-chat/native-chat-session-assembler.test.ts
  • src/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.

Comment on lines +191 to +193
nextIndex < messages.length &&
messages[nextIndex]?.source === message.source &&
isImageSourceUserTurn(messages[nextIndex]!)

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.

🎯 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

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

  • Turn-local companion grouping — sortForImageNormalization replaces 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 — assembleNativeChatSession sorts transcript and scrape sources through the new helper before folding, and the incremental assembler's reset/applyAppends use it too.
  • Tail-append guard — isTailAppend now 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.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@brennanb2025
brennanb2025 merged commit 51bc2ec into main Sep 1, 2026
29 checks passed
nwparker added a commit that referenced this pull request Sep 2, 2026
…#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]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…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>
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