Skip to content

fix(web): broken tiles in the chat gallery (viewing_tile emitted before fetch)#24

Merged
andylizf merged 1 commit into
mainfrom
fix/tile-gallery-404
Jun 5, 2026
Merged

fix(web): broken tiles in the chat gallery (viewing_tile emitted before fetch)#24
andylizf merged 1 commit into
mainfrom
fix/tile-gallery-404

Conversation

@andylizf
Copy link
Copy Markdown
Contributor

@andylizf andylizf commented Jun 5, 2026

Symptom: /api/tile/290066/1/5 rendered as a broken image in the chat gallery while answering the Inter shots-on-target example.

Root cause (from the session transcript): the agent pages through long articles by guessing chunk coordinates (it read 15 tiles of the 2010-final article; 3 guesses 404'd past the article's end — normal exploration). But the backend emitted viewing_tile before fetching, so failed reads still entered the gallery. Search results themselves are clean (sampled 80 hits → 0 missing files).

Fix: emit viewing_tile only after a successful fetch (agent-server + route.ts), plus an onError fallback in TileGallery that drops any tile whose image fails to load.

The agent pages through long articles by guessing chunk coordinates
(0/0, 0/1, ... 1/5, 2/0), so some pixelrag_tile reads 404 past the end of
an article — normal exploration. But the agent backend emitted viewing_tile
BEFORE fetching, so failed reads still landed in the chat tile gallery as
broken images (seen live on /api/tile/290066/1/5 while answering the Inter
shots-on-target example).

- agent-server.mjs + route.ts: emit viewing_tile only after a successful fetch
- TileGallery: belt-and-braces onError — drop tiles whose image fails to load
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 5, 2026 6:47am

@andylizf andylizf merged commit 641c808 into main Jun 5, 2026
6 checks passed
@andylizf andylizf deleted the fix/tile-gallery-404 branch June 5, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant