Skip to content

bug(platform): a chat image's preview breaks after 15 minutes — the page keeps presigned links past their lifetime #5366

Closed

Description

@yannickmonney

Summary

A chat keeps the presigned links of its images for as long as the page stays open, but each link lives 15 minutes. After that, the images in the messages still show, because they were already loaded, but opening one shows a broken image in Image preview. Its link now answers 403, and nothing fetches a new one. Found while checking the report "… one image is broken and cannot be viewed" on main 7d7b1ee98 (2026-11-04). The main cause of that report is filed as #5358; this is a second way to reach the same symptom.

What the code does today (main 7d7b1ee98)

  • Presigned links live 15 minutes: DEFAULT_PRESIGN_TTL_SEC = 15 * 60 (services/platform/backend/core/lib/storage/object_store.ts:703-704); observed X-Amz-Expires=900.
  • A message's image links come from files/queries:getFileUrls (services/platform/app/lib/backend/documents.ts:225-244). The query has no options of its own, so the app defaults apply: staleTime 5 minutes, gcTime 15 minutes, no refetch interval, and refetch on window focus only for a query in error (services/platform/app/router.tsx:26-50). A chat that stays mounted keeps its first links.
  • The message gallery tracks links that fail to load and falls back to a file card (services/platform/app/features/chat/components/message-artifacts.tsx:150-196). The preview dialog gets the same link and shows whatever it loads (services/platform/app/features/chat/components/message-artifacts.tsx:218-230).

What was observed

Local stack (MinIO as the object store). A chat with two generated images was left open in one tab:

Time (UTC) What happened
11:05:58 The page's two image links were signed (re-read by the page at that time)
11:16:32 Both links fetched again: 200
11:21:09 Both links: 403. The page still held the 11:05:58 links; both images were still visible in the message
11:21:16 Clicking the first image opened Image preview with a broken image (file name as alt text, 0 px wide)

Not examined: other surfaces that show stored images through the same query (task attachments, documents), phones with the app in the background for a long time, and a production object store other than MinIO.

Options (no preference)

  1. Refetch file links on an interval shorter than their lifetime, but only while a chat shows images.
  2. Refetch a link when an image or the preview fails to load, once, before falling back.
  3. Give each file-link query a staleTime below the link lifetime, and refetch on focus as well.
  4. Serve images through an app route that signs a fresh link on every request (302 to the store, or proxied).
  5. Sign links for longer, and keep the client's cache within that lifetime.

Related

Activity

  1. added
    priority: low
    bug
    service: platform
    on Nov 4, 2026
  2. added
    agent-ready
    on Nov 4, 2026
  3. added a commit that references this issue on Nov 5, 2026
    c029a67
  4. added a commit that references this issue on Nov 5, 2026
    4a5a102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readybugpriority: lowservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions