perf(web): defer image URL requests for thread history - #9760
Conversation
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped web performance change that defers signed image URL requests for offscreen thread history while preserving mounted-image loading and pending-preview handoffs. It adds no schema, deployment, security-sensitive behavior, or new user-facing capability, and the core selection and preview-projection behavior is covered by tests. You can add or adjust custom eligibility rules. Learn more. |
Opening a thread requested signed URLs for every loaded image, including images in rows that were not mounted.
Mounted user rows now request their own image URLs, including gallery images and annotation crops. Local previews and offscreen upload handoffs keep the existing preload and cleanup flow.
Asset TTLs, virtualization, and mobile code are unchanged. Assistant markdown and worklog images keep their existing queries.
Checks
Newly mounted history rows can wait for their first signed URL. No browser or device run was used.
Created with GPT-6 Astra (preview) in Codex.
Note
Medium Risk
Changes when and how chat image URLs are fetched; history rows may briefly lack signed previews until mount, but scope is limited to web chat attachments with dedicated tests.
Overview
Stops prefetching signed URLs for every image in loaded thread history and instead loads them only where they are needed.
ChatViewnow builds asset requests withselectHandoffImageResources, so offscreen upload handoffs still get server URLs while the rest of history is not scanned for signing. Each mounted user timeline row inMessagesTimelinecallsselectMessageImageResourcesanduseAssetUrlsfor its own gallery (including crops), skipping attachments that already useblob:ordata:previews. Preview wiring usescreateMessageAttachmentPreviewProjectorso signed URLs apply only after local handoff previews are released.New session-logic tests cover resource selection, empty-handoff fast paths, and handoff vs row preview behavior.
Reviewed by Cursor Bugbot for commit ba96662. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Defer image URL requests for thread history in
ChatViewselectHandoffImageResourcesandselectMessageImageResourcesselectors in session-logic.ts that deduplicate image attachment IDs and skip attachments with localblob:ordata:preview URLs.ChatViewno longer bulk-requests image URLs for all server-history attachments; consumers expecting eager URL resolution for full history must rely on per-row mounting instead.Macroscope summarized ba96662.