Skip to content

[Bug]: Large SVG project icons turn into the monogram after their link expires #42328

Done

Description

@smirea

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Add a project whose root holds a favicon.svg larger than about 24 KB. Any detailed SVG works; this makes a 52 KB one:
    node -e 'const s=Array.from({length:1500},(_,i)=>`<circle cx="${(i*37)%512}" cy="${(i*91)%512}" r="1.5"/>`).join("");process.stdout.write(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><rect width="512" height="512" rx="96" fill="#c81e1e"/><g fill="#fff">${s}</g></svg>`)' > favicon.svg
  2. Add a second project (any folder) and start a thread in each (the Replay (dev) provider is enough).
  3. Open the first project's thread in the web or desktop client. The red icon shows in the chat header and the sidebar.
  4. Let the icon's link expire before the client renews it. In real use this happens when the machine sleeps or the window sits in the background for an hour: the link lives 30–60 minutes, and the client's 30-minute renewal timer does not run during sleep. To get there without waiting, make the server's answer for that one icon URL a 404 (what it returns once the token expires) and wait until the next half hour (:00 or :30) passes, so a newly minted link differs from the old one.
  5. Switch to the other project's thread, then back.

A Playwright script for steps 3–5 against a dev server (run from the repo root with node repro.mjs <pairingUrl> out.png /<environmentId>/<threadId> /<environmentId>/<otherThreadId>):

repro.mjs
import { createRequire } from "node:module";
const require = createRequire(process.cwd() + "/scripts/package.json");
const { chromium } = require("playwright-core");
const [url, out, path, otherPath] = process.argv.slice(2);
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1280, height: 900 } });
const t = () => new Date().toTimeString().slice(0, 8);
const icons = () => page.$$eval("img", (els) => els.filter((e) => e.src.includes("favicon.svg")).map((e) => ({ shown: !e.className.includes("hidden"), ok: e.complete && e.naturalWidth > 0, src: e.src })));
const report = async (label) => {
  const list = await icons();
  console.log(`${t()} ${label}: ${list.map((i) => `${i.shown ? "shown" : "hidden"}/${i.ok ? "loaded" : "broken"}/…${i.src.split("/api/assets/")[1]?.slice(30, 50)}`).join(", ") || "no favicon <img>"}`);
};
const go = (p) => page.evaluate((p) => { history.pushState({}, "", p); dispatchEvent(new PopStateEvent("popstate")); }, p);
await page.goto(url);
await page.waitForTimeout(4000);
await page.goto(new URL(path, url).href);
await page.waitForTimeout(6000);
await report("fresh load");
const expired = (await icons())[0]?.src;
if (!expired) throw new Error("no icon URL");
// Stand-in for the token's expiry: from now on the server's answer for this exact URL is 404.
await page.route((u) => u.href === expired, (route) => route.fulfill({ status: 404, body: "Not Found" }));
const bucket = 30 * 60 * 1000;
const wait = process.env.NO_WAIT ? 0 : Math.ceil(Date.now() / bucket) * bucket - Date.now() + 3000;
console.log(`${t()} waiting ${Math.round(wait / 1000)}s for the next token bucket`);
await page.waitForTimeout(wait);
await go(otherPath);
await page.waitForTimeout(3000);
await go(path);
await page.waitForTimeout(8000);
await report("after remount");
await page.screenshot({ path: out });
await browser.close();

Expected behavior

The project's icon shows. The file still exists and loads fine on a fresh page load. The project icon docs say the monogram is for when no image is found (docs/user/project-settings.md).

Actual behavior

The chat header (and any sidebar row that re-renders) shows the project's two-letter monogram instead of the icon, and keeps showing it. The script prints hidden/broken for the icon after step 5.

Root cause: an SVG icon too large for the client's inline icon cache (32 KiB as a data URL) renders from a signed /api/assets/<token>/…-favicon.svg link. When that link has expired and the icon remounts, ProjectFaviconImage (apps/web/src/components/ProjectFavicon.tsx) falls back to the monogram on the load error and never asks for a new link. Smaller icons and bitmaps are stored inline as data URLs, so they never hit this.

Impact

Cosmetic issue

Version or commit

v0.1.12-nightly.20261124.5191 and main at 921349decf. First seen in the desktop app 0.1.11.

Environment

macOS desktop app 0.1.11 (found there after the project's favicon.svg grew from 2 KB to 35 KB). Reproduced in the web client against a dev server on the nightly and on main, in headless Chromium.

Logs or stack traces

fresh load: shown/loaded
after remount: hidden/broken    <- monogram shown

The server log shows nothing; the icon's link answers 404 once its token has expired.

Screenshots, recordings, or supporting files

After step 5, the chat header shows the monogram ("SD") instead of the red icon:

The chat header shows the SD monogram instead of the project icon

Workaround

Use a smaller icon (an SVG under ~24 KB, or a PNG, which the client downscales and caches), or reload the window.

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