Repository navigation
#898 Show images inline as galleries in Session Chat - #911
Conversation
…roid Keep images that tools return (v1 attachments, v2 file content) from REST and live events, group them into a mosaic under the tool card or group, above user text and after assistant text, and open any tile in a paged viewer with zoom, swipe-down dismiss and share. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Keep images that tools return (v1 attachments, v2 file content) from REST and live events, group them into a mosaic under the tool card or group, above user text and after assistant text, and open any tile in a paged viewer with zoom, swipe-down dismiss and share. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Real-app evidence (scenario harness, scripted fake model)Both apps run against a real opencode server through Tool images under the card: 1, 2, 3, 4, 7 (+4)
Viewer
Swipe-down dismiss works on both. User message with attached images (3 on iOS, 5 with
|
| iOS | Android |
|---|---|
![]() |
![]() |
v2 server (live, session open while the turn ran)
| iOS 3 images | iOS 7 images | Android 3 images |
|---|---|---|
![]() |
![]() |
![]() |
Server shapes observed
- v1 (1.19.5),
GET /session/:id/message:part.state.attachments[]={id, sessionID, messageID, type:"file", mime:"image/png", url:"data:image/png;base64,…"}. Nofilename. The server drops an unreadable image and says so instate.output([1 image omitted: …]). - v2 (
dev),GET /api/session/:id/message:content[].state.content[]={type:"text",text:"Image read successfully"}plus{type:"file", uri:"data:image/png;base64,…", mime:"image/png", name:"assets/…png"}.
Both match what the adapters parse.
Found problems (not fixed here)
- A gallery disappears when the session is reopened from the session cache (both apps; reproduced on v1, the cache codec is shared with v2). It shows on the first open or live, and is gone after leaving and reopening the session or relaunching the app.
SessionCacheCodecneither writes nor readsToolPart.images(iOSDomain/SessionCache/SessionCacheCodec.swift~709 and ~847, Androiddomain/sessioncache/SessionCacheCodec.kt~266, ~488, ~550). Screenshots:ios-11-reopen-gallery-missing.png,android-11-reopen-gallery-missing.png. - Activity Card timeline style (the Recommended default in the first-run picker) shows no gallery. Settled turns fold into "N steps · Read", and the steps sheet lists the files without their images. Standard shows them. Not checked: Chips, Step Rail.
- Android tool tiles are labelled "Image" (v1 attachments carry no filename); iOS shows no label there. v2 tiles show the file name on both.
Not verified: a failed or loading tile (the real servers never deliver a corrupt image: v1 omits it, v2 reads it as text), VoiceOver / TalkBack, scroll performance with many galleries on screen (only a few screens scrolled by hand, no hitching seen).
🤖 Generated with Claude Code
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6f41efd. Configure here.
There was a problem hiding this comment.
Automated review: no finding that 2+ of 3 passes agreed on.
4 finding(s) from a single pass, not posted
android/app/src/main/java/dev/opencode/mobile/ui/components/chat/OpenCodeImageGalleryViewer.kt:143high: Viewer chrome indexes pager page without bounds check (muse-spark-1.3-contributor)android/app/src/main/java/dev/opencode/mobile/ui/sessionchat/view/SessionChatImageShare.kt:31medium: Share deletes whole share directory before writing (muse-spark-1.3-contributor)ios/OpenCode Mobile/OpenCode Mobile/Components/Chat/OpenCodeImageGallery.swift:133low: Overflow accessibility label understates hidden images (muse-spark-1.3-contributor)android/app/src/main/java/dev/opencode/mobile/ui/components/chat/OpenCodeImageGallery.kt:245low: Overflow tile accessibility label off by one (glm-5.3-flash)
opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.133 · 1 pass(es) stopped early
…verflow tile label iOS: OpenCodeZoomingImageScrollView.setImage no longer resets zoom when a sharper picture of the same aspect ratio replaces the one on screen. Android: the overflow tile's accessibility label counts the images still hidden (N - 1), and the viewer chrome clamps the pager page. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Keep image galleries alongside the steering/pending bubbles from #909 on both platforms: pending steers dim attachments and galleries, and pending steers keep no message actions. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>


























Summary
#898
First slice of inline image galleries in Session Chat, on both platforms.
attachments[], v2content[type=file]) from REST history and live events instead of dropping them.OpenCodeImageGallerymosaic: 1 image inline, 2 columns, 3 as large tile + two stacked, 4+ as 2×2 with a+Ntile. Loading and failed tile states.OpenCodeImageViewer/OpenCodeImageGalleryViewer: paged, pinch/double-tap zoom, swipe-down dismiss, share.Work stays open on #898: path/markdown images, the other timeline styles, the preference, and the harness scenario.
Checks
Risks / Follow-ups
attachmentsshape is covered by unit tests only, not confirmed against a real v1 server yet.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Large chat UI and message projection changes with in-memory image decoding/caching and new share FileProvider paths; scope is timeline presentation rather than auth or payments.
Overview
Session Chat on Android and iOS now keeps images tools return (v1
attachments, v2content[type=file]) through REST and live events, maps them ontoMessagePart.Tool.images, and renders them in the timeline—not only user uploads.The UI adds
OpenCodeImageGallery(count-based mosaic with loading/failed tiles and+Noverflow) and a paged full-screen viewer (zoom, swipe dismiss, share). Timeline building introducesImageGalleryblocks under tool cards/groups and for runs of two+ message images; Session Chat owns viewer state (SessionChatImageViewer/imageViewerin UI state) and wires taps from outgoing bubbles, assistant rows, and the tool-group route (Android stashes group member images inSessionToolGroupImagesbecause the nav key cannot carry bytes). Decoding goes through a bounded bitmap cache and gallery loaders; Android share writes viashared-images/FileProvider.Supporting work:
ToolResultImagesfiltering, preview cache warming for tool images, component gallery + design doc, iOS photo-library-add plist string, and unit tests for parsing and gallery block layout.Reviewed by Cursor Bugbot for commit 6f41efd. Bugbot is set up for automated code reviews on this repo. Configure here.