Repository navigation
Description
Out of scope
No new conversion or image-restoration policy, original retention changes, provider-history changes or broad transcript/composer redesign. Do not merge by filename or remove authorized original access. SVG/BMP conversion and restored held-message frames have separate follow-ups.
Context
Part of #3150. The maintainer selected #3155 I3 B (2026-11-11): combine a sent image's visual preview and file row into one attachment display, retaining file details and authorized original access. The current two displays were not accepted as the final layout.
At inspected main 3c44ac6fc56d27675dadaf38a16254db53c39f69, MessageBubble (packages/ui-react/src/components/chat/message-bubble.tsx) renders image attachments separately from SentFiles (same file:75), which maps original files to kit rows at :82; the original files are rendered at :172 and UserAttachments renders previews at :204. AttachmentRow (packages/ui-kit/src/conversation/AttachmentRow.tsx:86) and its existing conversation stories supply the shared visual boundary. Image-frame previews currently map to presentation data in framesFor (packages/ui-react/src/lib/image-frames.ts:174); correlate the exact original identity rather than positional/name guesses.
Scope
First design the combined display using existing kit patterns, with a concrete state/action/data mapping. Then implement the necessary kit component/stories before app integration, preserving every original-file detail/action and existing read-evidence semantics. One original with a corresponding frame has one accessible attachment display in a sent message. Legacy inline images without an original reference remain usable; unknown/missing associations never cause another file's access to be merged.
Approved design and implementation split (maintainer, 2026-11-15)
Blocked by #4015
The November 15 combined-attachment proposal is approved as the implementation direction with the following rulings. These override conflicting proposal details:
- One primary row action: a verified image/original pair renders once as an image AttachmentRow. Activating it opens the existing image viewer; authorized Open original and Download original actions live inside the viewer. No nested controls or second inline original action. Where no preview is possible, the row can open an authorized original instead.
- Responsive thumbnail: 64px on phones, 96px on desktop. This supersedes the proposal's 64px-everywhere value. Retain original filename/size, known dimensions and honest content/read details beside it. Use existing responsive conventions; check 320px, desktop and 200% text without clipping actions or losing metadata.
- Unmatched identity: keep both displays when a frame cannot be associated by exact fileId. Never merge by filename, position or size, and never hide an unmatched preview to make the message look cleaner. Keep original ordering; legacy frame-only messages remain usable. Original-only restored history retains its existing truthful presentation without implying a preview failure.
- Kit first: ui-kit: add combined image-attachment preview and original-action presentation #4015 owns additive preview-row and original-action presentation/stories before this integration. AttachmentRow is in ui-kit; ImageViewer and ZoomableImage currently live in ui-react, so their actual viewer wiring remains here. Preserve this package boundary rather than treating the proposal's viewer API as already exported by the kit.
- Review: approve direction now; bring the built stories back for the reserved ui-react: offer a generic file picker with honest attachment lifecycle states #3155 visual review. The review remains an acceptance step, not an immediate coding prerequisite. Direction approval is not completed visual acceptance.
Use the proposal's loading/ready/missing/failed and unavailable/forbidden original states, honest partial/unknown read evidence, focus/return rules, safe original access and reduced-motion behavior. A preview never proves model reading. No original URL/action may be exposed without authorization. Display interaction does not send, read content for the model or change retention/history.
At inspected main, ChatImageAttachment already carries fileId (ensureFrame, packages/ui-react/src/lib/image-frames.ts:113), but framesFor (:174) drops that identity from presentation previews. Carry exact identity through app-local presentation data; do not infer it by position. Restored messages may have originals/count only: this change does not silently introduce frame persistence or rewrite history. Any necessary public-contract addition follows the contract rules below. Record the approved display policy in the existing attachment decision guidance as part of the implementation, coordinating with #3989.
Acceptance criteria
- Implement the approved November 15 direction and the five rulings above, consuming ui-kit: add combined image-attachment preview and original-action presentation #4015 first. Provide 320px/desktop stories in both themes with enlarged text and exact state/action mapping. Record the later ui-react: offer a generic file picker with honest attachment lifecycle states #3155 maintainer visual review of built stories separately; if it remains after independent implementation, hand off with needs: human and concrete story/evidence links.
- Kit stories cover preview plus original details/access, long/duplicate filenames, mixed attachments, pending/unavailable/failed preview, partial/unknown read evidence and legacy frame-only messages. Kit components/stories precede integration; app reuses them.
- A sent image with a verified original/frame identity appears once, keeps name/size, original access and existing honest content/read details. Mixed ordering and same-name/different-ID cases are correct across send, session switch, reconnect and reload.
- A missing association or unauthorized original gets a truthful safe fallback, not a guessed merge, broken duplicate or leaked URL. Merely displaying/expanding it neither reads contents for the model nor changes send/retention state.
- Real offline browser checks verify 320px/desktop, light/dark, 200% text, keyboard/touch focus and accessible naming. Guard against duplicate attachment displays and loss of original access using named failing-first/restored mutations.
Verification
Extend the approved kit stories plus packages/ui-react/tests/browser/sent-attachments.layout.tsx and composer-image-originals.offline.tsx, with relevant session/reload runtime proof. Use exact original IDs and authorized fixture routes, no live accounts or providers. Record design review and meaningful mutation/browser receipts; run affected required checks.
Contract impact
Prefer additive kit props/internal presentation associations and preserve current wire schemas. Any exported API or identity field change updates its API report and relevant integration-contract component in the same CONTRACT commit. No format, history or ownership change is selected here.
2026-11-15: folded in A1–A5 maintainer answers and approved the design direction with 64px phone / 96px desktop thumbnails. Split kit work into #4015. The decision prerequisite is resolved; this integration is agent-ready and blocked on #4015. Built-story visual acceptance remains outstanding and does not block coding now.
Activity
schlessera commentedon Nov 11, 2026
#3155 I3 B settles the behavior: one sent-image attachment combines the preview, file details and authorized original access. The remaining work is the visual/state/action hierarchy and its accessible layout. Source alone does not choose those details, and the existing reserved #3155 visual review is still outstanding.
schlessera commentedon Nov 15, 2026
Design: one combined sent-image attachment
Summary. A sent image with a verified original↔frame identity renders as one
AttachmentRowin itsimagekind:No second thumbnail, no second row and no extra tab stop for the same file. Where identity is missing, nothing is merged.
Examples: Odysseus, 2026-07-12,
raft-at-ithaca.jpg(2.4 MB, 3024 × 4032).1. Hierarchy and actions
The
AttachmentRowlayout stays as it is:object-fit: coveron the hatched background, so a loading or transparent image never shows a blank.overflowWrap: anywhere). The meta lines are unchanged fromattachmentRowProps(type · size · dimensions, then the read evidence).role="button"(the existing.bk-rowpattern), which opens theZoomableImageviewer at the full frame. The trailing icon isexpand.role=button, which is invalid, or a split card with two stops. The viewer already exists and is where a user goes to see the full image.nexticon. Accessible name: "…Open original."Alternative considered: the preview on top with the row below, in one bordered card. It's more visual, but it doubles the height at 320 px and still needs two actions.
2. States
imageglyphpreview not availableoriginal no longer availableoriginal not shared with yousent as a preview · 1568 px max)no read record yet/read: unknown on this host). A preview never implies a read.image · no original attachedattachmentCount, no frames)AttachmentCountchip, unchangedNone of these interactions sends anything, reads contents for the model, or changes retention.
3. Identity and ordering
fileId. That means an additiveoriginalFileIdon the frame mapping fromframesFor, set at compose time where both are known.originalFileId, or it names a file not inattachmentFiles: render both separately, as today. Duplication beats a wrong merge.attachmentFiles. Unmatched frames come first, then the rows, as today; nothing is reordered.raft-at-ithaca.jpgfiles with differentfileIds give two rows, each with its own preview. The meta adds a disambiguator only when names collide in one message:1 of 2,2 of 2.fileId, so the merge result is stable. A restored message without frames shows the row with the hatched thumb, i.e. the "preview not available" path is not used for history. The thumb is simply the kit default, with no note.4. Layout, themes, text size
grid gap-2list in original order. The thumbnail strip (UserAttachments) disappears whenever every frame merged.color.edgein both themes; the image is never filtered..bk-rowring at −2 offset (unchanged). The viewer opens with focus on its close button and returns focus to the row on close.Mocks
320 px, one merged image plus a doc
Desktop, same-name pair plus a failed preview
Viewer toolbar (opened from the row)
Legacy frame only
Kit and app inventory (additive)
AttachmentRow, two additive props:preview?: { src: string; alt: string; state?: "loading" | "ready" | "failed" }draws an image in the thumb whenstateisready; the hatch otherwise.thumbSizealready exists; 64 is used for merged images.previewrenders exactly as today, so existing baselines hold.ImageViewer/ZoomableImage: an additiveoriginalActions?: { open?: () => void; download?: () => void; note?: string }.framesForaddsoriginalFileId?;MessageBubblebuilds afileId → framemap and passespreviewto the matchingSentFilesrow;UserAttachments.Story and browser matrix
AttachmentRowpreview state: loading, ready, failed;sent-attachments.layout.tsx,composer-image-originals.offline.tsx):originalFileId;Open questions for the maintainer
AttachmentRow.preview, vieweroriginalActionsand the stories) that blocks the integration here?schlessera commentedon Nov 15, 2026
Decision (maintainer, 2026-11-15):
These are the user's explicit interactive choices. The body is updated to the selected branch and correct source/package ownership. Remove needs: decision; add agent-ready and blocked on #4015. The later visual review is an acceptance step and does not block independent coding now. The implementation must record the resulting display policy in the existing attachment guidance, coordinating with #3989. No provider, retention or history change is authorized by this layout decision.