Skip to content

fix(mobile): render host-owned chat image attachments - #33555

Closed
gentslava wants to merge 5 commits into
stablyai:mainfrom
gentslava:fix/mobile-host-chat-image-attachments
Closed

gentslava wants to merge 5 commits into
stablyai:mainfrom
gentslava:fix/mobile-host-chat-image-attachments

Conversation

@gentslava

@gentslava gentslava commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Source and validation

Includes upstream main through 1187abdbc2554f69e281868a83f4ab0ca045276b. The base refresh preserves this PR's feature scope and passed ordinary commit hooks. Validation and visual evidence below retain their stated source revisions. Complete upstream CI remains pending.

Known upstream base issue: Node typechecking at this main revision reports switchedBuild missing in workspace-layout-paired-desktop.test.ts:50. This PR retains that upstream file unchanged; the layout-test repair is separate from its feature scope.

ELI5

An older picture in a mobile chat could appear as a computer's file path. This change asks the computer that owns the chat for that saved picture, shows a preview, and opens the existing full-size viewer when tapped.

What Changed

  • Pass the selected chat controller's existing image source to structured rows. Resolve recognized attachment-store paths through agentSessionAttachment.read on the owning execution host; retain device-loadable previews.
  • Reuse the existing thumbnail, full-size viewer, actions and bounded store reader. A failed direct preview falls back to that same owner's canonical reader. Support unavailable/retry and decoder failures.
  • Fence replies, decoder events and viewer state by client, connection generation, session and image identity. Allow and route the existing attachment-read method for mobile.

Why

A phone cannot load a path on another machine. Using the selected chat owner's reader preserves remote ownership and the store's existing path, symlink, image, and reply-size checks. It also avoids adding a parallel transfer or viewer mechanism.

Linked Issue

Fixes #33554.

Related #29632: this fixes stored-image resolution; its compact gallery, layout, and swipe-navigation proposal remains open. Refs #33357.

Visual Proof

Same synthetic English message, stored path, two-color 320×240 PNG, and 390×844 viewport in both captures. The image-ref intentionally has no alt text so the original path placeholder is visible. These are actual React Native Web components in headless Chromium under the shipped webshell CSP, with a controlled synthetic RPC transport.

Before: stored path placeholder After: decoded image preview
Before: the synthetic stored host image path appears instead of a preview After: the same synthetic image is decoded as a thumbnail above the English message

Before loads only the immutable MobileNativeChatProse.tsx from parent 8b8d343ef0 via an esbuild loader in the same fixture; the surrounding message, styles, and data stay identical. After uses accepted commit 17bf536b3f without a source override. No DOM text or raster replacement was used.

After tapping: the existing full-size viewer displays the same synthetic image

The fixture asserts path placeholder/no image/no RPC before; decoded natural dimensions 320×240, no visible path, one exact attachment-read request, full viewer, Close, and no page errors after. All uploaded images were viewed and contain only synthetic data. Public asset provenance: synthetic evidence comment. This is browser evidence, not physical-device or live-paired-host validation.

Testing

The direct-preview fallback follow-up at a2dcc6a0 passed 82 tests across five mobile image/message/Android/overlay suites, both mobile typechecks, all 11 selected check:changed checks and normal hooks. The original host attachment/store/routing validation passed 93 tests, and the published CSP fixture verifies decoded thumbnails and the existing viewer.

The earlier full aggregate gate was not green: it included unrelated PTY timeout failures and a sandbox-dependent macOS preflight. The stale upload-only expectation was corrected and its suite passed. A fresh complete repository gate is still pending in upstream CI; the source refresh does not represent it as passed.

Full repository lint, typechecks, tests and builds remain assigned to upstream PR CI. Focused checks and component captures do not establish physical-device or live-provider acceptance.

AI Disclosure

Implemented and reviewed with OpenAI Codex assistance.

Review

Owning-host routing, bounded store reads, symlink/image/reply-size checks and stale reply/viewer fences remain in effect. This reuses the store-wide attachment reader; it adds no server-side per-session ACL or arbitrary-file reader. Nonstore paths retain their placeholders.

Agent skill upstream boundary

  • No upstream skill-installer material is copied or mechanically translated.

Checklist

  • Feature scope, behavior and rationale are documented.
  • Scoped checks and source-specific visual evidence are documented.
  • Platform, remote, mobile and folder-workspace impact is considered.
  • Full repository lint, typechecks, tests and builds are assigned to upstream PR CI.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

Mobile structured chat reads recognized stored image attachments through the selected host and displays previews in chat. Opened images remain associated with their owning client and generation. Tests cover RPC routing, loading and retry states, ownership changes, and browser rendering.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Moderate · up to 2a513

The required changed-files gate still lacks a successful post-fix result and should be rerun before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 13 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: rendering host-owned chat image attachments on mobile.
Linked Issues check Passed Issue #33554 is the only active directly linked issue. Its coding requirements are: (1) resolve recognized stored images in structured mobile chats through the selected owner's bounded attachment read…
Out of Scope Changes check Passed The PR changes described in the whole-PR summary are: the image attachment component and its tests, the overlay host and overlay type changes, the Prose delegation, the image-preview reader helper, me…
Description check Passed The description has all template sections: ELI5, What Changed, Why, Linked Issue (Fixes #33554), Visual Proof with before/after images, Testing, AI Disclosure, Review, upstream boundary checkbox, and …
Full details: Linked Issues check

Explanation

Issue #33554 is the only active directly linked issue. Its coding requirements are: (1) resolve recognized stored images in structured mobile chats through the selected owner's bounded attachment reader; (2) show a thumbnail and open the existing viewer; (3) keep canonical store containment, image, and reply limits; (4) show an unavailable state when the owner or method is unsupported; (5) do not read arbitrary paths or fall back silently to another host. Current-head evidence: mobile/src/session/MobileNativeChatImageAttachment.tsx and mobile-native-chat-image-preview.ts call agentSessionAttachment.read through readMobileNativeChatImage for store paths, and the overlay host passes nativeChatVisualSource as imageSource. src/main/runtime/runtime-rpc/runtime-rpc-mobile-agent-session-methods.ts exposes agentSessionAttachment.read, and method routing maps it to execution-host. Focused tests cover routing, invalid paths, retries, stale replies, decoder fallback, viewer ownership, and shipped-CSP rendering. Since the previous reviewed head, the diff for MobileNativeChatImageAttachment.tsx and runtime-rpc-mobile-agent-session-methods.ts is empty, so earlier conclusions for those files remain supported. The incremental diff for the full head was too large to read (diff metadata exceeded the inspection buffer), so unchanged status of the remaining paths is inferred, not verified. The change does not implement the separate #29632 gallery, multi-image layout, or swipe-navigation scope.

Full details: Out of Scope Changes check

Explanation

The PR changes described in the whole-PR summary are: the image attachment component and its tests, the overlay host and overlay type changes, the Prose delegation, the image-preview reader helper, message styles, the RPC method list and routing test, the attachment allowlist test expectation, and the shipped-CSP browser fixture. Each one supports #33554: it renders the image, reads it through the owner, or verifies that read or its routing. The allowlist test change corrects an upload-only expectation to include agentSessionAttachment.read, which the feature requires. No unrelated feature or #29632 gallery, layout, or swipe work is present in these paths. The upstream main merge in the branch history brings unrelated upstream commits (for example WSL, memory, ps, drops, and CLI changes). These are not PR changes relative to merge base 5a973e2 and are not assessed as scope creep. Because the full incremental diff could not be read, this verdict relies on the summary and the two unchanged core paths.

Full details: Description check

Explanation

The description has all template sections: ELI5, What Changed, Why, Linked Issue (Fixes #33554), Visual Proof with before/after images, Testing, AI Disclosure, Review, upstream boundary checkbox, and Checklist. It explains the mechanism (owning-host attachment read, reuse of existing reader and viewer) and gives concrete validation details. Gaps: the Testing section does not tick the 'I manually tested these changes locally' box, and the description says the full repository gate is still pending. The Notes section's cross-platform, SSH, and performance concerns are addressed only briefly. The Linked Issue section also cites #33554 as the fix, while the objectives mention #33555 as the PR title reference, which is a minor inconsistency to confirm.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ff960098-fd04-4dcf-a142-21e1712e1f61
Commits

Reviewing files that changed from the base of the PR and between e13c47b and 17bf536.

Files selected for processing: 13
  • config/scripts/mobile-web-app/mobile-web-app-chat-attachments-render.test.mjs
  • mobile/src/session/MobileNativeChatImageAttachment.test.tsx
  • mobile/src/session/MobileNativeChatImageAttachment.tsx
  • mobile/src/session/MobileNativeChatOverlay.tsx
  • mobile/src/session/MobileNativeChatProse.tsx
  • mobile/src/session/MobileNativeChatRowOverlaysHost.test.tsx
  • mobile/src/session/MobileNativeChatRowOverlaysHost.tsx
  • mobile/src/session/mobile-native-chat-image-preview.ts
  • mobile/src/session/mobile-native-chat-message-styles.ts
  • mobile/src/session/mobile-native-chat-row-overlays.ts
  • src/main/runtime/mobile-rpc-allowlist.test.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-mobile-agent-session-methods.ts
  • src/main/runtime/runtime-rpc/runtime-rpc-mobile-method-routing.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 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.

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1c554d34-b2cd-4f68-a7ca-311ffd74434e
Commits

Reviewing files that changed from the base of the PR and between a2dcc6a and 2a51385.

Files selected for processing: 2
  • mobile/src/session/MobileNativeChatOverlay.tsx
  • src/main/runtime/runtime-rpc/runtime-rpc-mobile-method-routing.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment on lines +23 to +24
it('reads chat attachment bytes from the execution host that owns their store', () => {
expect(MOBILE_RPC_METHOD_ROUTES.get('agentSessionAttachment.read')).toBe('execution-host')

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.

Minor · Maintainability & Code Quality · Quick win

🔎 Supported by static analysis

Script executed:

set -eu
printf '%s\n' '--- package and config references ---'
rg -n -F --glob 'package.json' --glob 'pnpm-workspace.yaml' --glob '.github/**' --glob 'config/**' -e 'check:changed' -e 'maxWorkers' -e 'required' -e 'changed-files' . || test "$?" -eq 1
printf '%s\n' '--- changed file and relevant diff ---'
git diff --no-ext-diff --unified=40 5a973e29a73f6b466d497c4214184bcd578b92cd 2a51385ac2af96708dd70f8fe47e37d3e92b1d9a -- src/main/runtime/runtime-rpc/runtime-rpc-mobile-method-routing.test.ts
printf '%s\n' '--- current file ---'
nl -ba src/main/runtime/runtime-rpc/runtime-rpc-mobile-method-routing.test.ts | sed -n '1,90p'

Repository: stablyai/orca

Length of output: 45646


Script executed:

set -eu
printf '%s\n' '--- package script ---'
sed -n '1,40p' package.json
printf '%s\n' '--- check-changed implementation outline and source ---'
if command -v ast-grep >/dev/null 2>&1; then ast-grep outline config/scripts/check-changed.mjs --view expanded; fi
nl -ba config/scripts/check-changed.mjs | sed -n '1,260p'
printf '%s\n' '--- focused references ---'
rg -n -F --glob '.github/workflows/*.yml' --glob '.github/workflows/*.yaml' --glob 'AGENTS.md' --glob 'docs/**/*.md' --glob 'config/scripts/*.mjs' -e 'check:changed' -e 'check-changed.mjs' -e 'changed-files gate' -e 'changed files' . || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 17709


Script executed:

set -eu
printf '%s\n' '--- package script ---'
sed -n '1,40p' package.json
printf '%s\n' '--- check-changed implementation ---'
nl -ba config/scripts/check-changed.mjs | sed -n '1,300p'
printf '%s\n' '--- focused references ---'
rg -n -F --glob '.github/workflows/*.yml' --glob '.github/workflows/*.yaml' --glob 'AGENTS.md' --glob 'docs/**/*.md' --glob 'config/scripts/*.mjs' -e 'check:changed' -e 'check-changed.mjs' -e 'changed-files gate' -e 'changed files' . || test "$?" -eq 1

Repository: stablyai/orca

Length of output: 18234


Rerun the required changed-files gate before merge.

AGENTS.md requires pnpm check:changed --maxWorkers=2 before handoff. The earlier run failed, and the later fix was validated only by a narrower suite.

pnpm check:changed --maxWorkers=2

@gentslava gentslava closed this Oct 27, 2026
@gentslava
gentslava deleted the fix/mobile-host-chat-image-attachments branch November 2, 2026 04:57
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.

Mobile structured chat shows stored image paths instead of previews

1 participant