This repository was archived by the owner on Aug 6, 2026. It is now read-only.
feat(mobile): show S3-backed image attachment thumbnails (port #3707) - #3751
Merged
Merged
Conversation
Ports the desktop thumbnail feature (#3707) to the React Native app. Image attachments on cloud task messages now render as real thumbnails resolved from the artifact manifest — including on re-entry and on devices that did not send the message — instead of plain file-name chips. Resolves attachments from the `session/prompt` entries already in the S3-backed log (a real fix) rather than the local AsyncStorage echo cache, which is removed. Non-image attachments and images whose preview fails to resolve keep rendering as the existing file chip. Generated-By: PostHog Code Task-Id: 45cd9bec-4cfc-4982-bde6-fd84d7ebf00d
|
😎 Merged successfully - details. |
|
React Doctor found 1 issue in 1 file · 1 warning. 1 warning
Reviewed by React Doctor for commit |
There was a problem hiding this comment.
Contained mobile-only UI/data-resolution feature (image thumbnails from S3 artifacts) with no auth, billing, migration, dependency, or CI changes — it only calls an existing backend endpoint pattern via the established authedFetch client. Diff matches the description, includes solid new unit test coverage, and no reviews, holds, or unresolved comments block it.
- Author wrote 1% of the modified lines and has 26 merged PRs in these paths (familiarity MODERATE).
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 452L, 11F substantive, 710L/14F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1d-complex (710L, 14F, single-area, feat) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ f057f43 · reviewed head ee37418 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Why: Image attachments on cloud task messages only appeared as file-name chips in the mobile app, making similar screenshots impossible to tell apart. This ports the desktop fix (#3707) to React Native.
Attachments also used to vanish after the task screen unmounted: the mobile app persisted a local echo of locally-sent attachments to AsyncStorage because the cloud log doesn't surface attachment data on
user_message_chunkevents. That cache never covered re-entry on a device that didn't send the message.Changes
Image attachments on cloud task messages now render as real thumbnails, with the existing file chip as the fallback.
session/promptentries already in the S3-backed log carry the attachment URIs (file://…/.posthog/attachments/<runId>/<artifactId>/<file>). On snapshot load we parse those and reattach them to the historicaluser_message_chunkevents, so thumbnails appear on re-entry and on any device — not just the one that sent them.attachmentEchoStore(AsyncStorage) workaround is removed. In-flight optimistic rendering still works from the in-memory message the composer already pushes; the persisted cache it provided is now covered by log resolution.presignTaskRunArtifactto the mobile HTTP layer and auseCloudAttachmentPreviewreact-query hook. The run's artifact manifest is fetched once per run through the shared query cache (a message with several images does one manifest request), and presigned URLs are cached with a stale time well under their expiry (50 min).HumanMessagestays a generic chat primitive: it exposes arenderAttachmentseam so the tasks feature supplies cloud resolution, avoiding achat → tasksimport cycle.Note: the artifact-URI parsing mirrors
@posthog/core/sessions/promptContent; mobile deliberately does not depend on@posthog/core, so the two are kept in sync by hand (same pattern as the existingiconDomainmirror). A possible follow-up is to host the parsing in@posthog/shared, which both already depend on.How did you test this?
pnpm --filter @posthog/mobile test— 473 passing, including new unit tests for the artifact-URI parsing / reinjection (promptAttachments.test.ts, parameterised) and the presign API call (api.test.ts). The parsing tests cover the fallback-to-chip cases (ordinary file URIs, missing segments, non-image kinds).pnpm lint(Biome) clean on all changed files.tscclean on the changed source files.Automatic notifications
Created with PostHog Code