Skip to content

fix: refresh link previews when a page's metadata changes #969

Open

Description

@sonyarianto

Problem

Link previews are cached forever. LinkPreview rows are shared by URL (CreateCommit::linkPreviewFor() uses firstOrCreate on sha256($url)), and UnfurlLink returns early once fetched_at is set. There is no TTL, no refresh action, and no way to update a preview when the linked page changes its title, description, or image.

This is visible today: https://mybox.id now serves:

Personal digital box: a browser-based suite of small apps — radio, tasks, pomodoro, notes and everyday tools. Works on any device.

but dev-null still renders the old description on every commit that links to it:

MyBox, something that you open everyday.

Affected public examples:

The first commit predates the site's metadata change; the later commits reuse the same cached row. Because previews are shared, one stale URL affects every post that links to it.

Possible directions

  1. TTL refresh (preferred): re-unfurl previews older than a bounded age (for example, 7 or 30 days) in the background. Keep the last successful metadata if a refresh fails, respect the existing SSRF and retry rules in UpdateLinkPreview, and cap/batch the work so a sweep cannot flood the queue.
  2. Manual refresh: a small refresh control on the card, throttled and limited to the commit author or admins. Since the row is shared, refreshing one card would update every card for that URL.
  3. Operations fallback: an admin-only way to clear or refetch a URL, even if automated refresh is not desired.

Implementation notes

  • fetched_at is already indexed.
  • UnfurlLink currently skips rows with fetched_at !== null; a refresh path needs to bypass or reset that guard without exposing a pending skeleton to all viewers.
  • A manual endpoint would need authorization and throttling; the existing link-preview endpoint is read-only and private, no-store.
  • Tests should cover stale selection, successful refresh, failed refresh retaining old metadata, and no duplicate jobs for concurrent posts.

Question

Which direction fits the project? A TTL sweep seems least intrusive, but it changes when old cards update without user action. A manual refresh is more explicit but adds UI and an abuse surface.

Happy to open a PR for whichever direction you prefer.

Activity

  1. changed the title [-]fix: refresh link previews when a page metadata changes[/-] [+]fix: refresh link previews when a page's metadata changes[/+] on Oct 22, 2026
  2. added a commit that references this issue on Oct 24, 2026
    197b469
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions