Skip to content

fix(web): images outside the workspace preview from the file surface - #224

Merged
Salochi merged 1 commit into
mainfrom
fix/host-image-preview
Oct 16, 2026
Merged

Salochi merged 1 commit into
mainfrom
fix/host-image-preview

Conversation

@Salochi

@Salochi Salochi commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Problem

Opening an image that lives outside the thread's workspace in the file surface (for example /home/me/previews/shot.png from a chat link) shows "Unable to load workspace image." Video, audio, HTML and PDF files from the same folder preview fine.

WorkspaceImagePreview always requested a workspace-file asset. The server confines workspace-file to the workspace root (finalizeWorkspaceFileAsset → resolveRelativePathWithinRoot), so any host image was rejected. The HTML/PDF preview already picked media-file for paths outside the workspace; images were missed.

This bug is also on upstream main (pingdotgg/t3code, FilePreviewPanel.tsx still hard-codes kind: "workspace-file" for images).

Change

  • New previewAssetKind(absolutePath, workspaceRoot) in filePreviewMode.ts: workspace-file inside the workspace, media-file outside it.
  • WorkspaceImagePreview uses it, and WorkspaceBrowserPreview now shares it instead of its own inline copy of the check.

No server change. media-file is already authorized under filesystem:read and serves host media by extension, the same path videos, audio, HTML and PDFs outside the workspace use.

Scope and approval

Small, focused fix for an obvious bug: one component used the wrong asset kind that its sibling previews already get right. Same permission and the same server path; nothing new is exposed.

Verification

  • vp test run apps/web/src/components/files/FilePreviewPanel.test.ts passes, with new previewAssetKind cases: inside the workspace, nested, outside it, a sibling folder with a matching prefix (/repo-sibling), and the root itself.
  • tsc --noEmit -p apps/web passes.
  • Manual: on a live T3 Hermes server, GIFs and PNGs in /home/aeris/projects/favicon-preview/ (outside the thread's project) now preview in the file surface. Before, every one showed "Unable to load workspace image."
  • Not checked: mobile, which has its own preview path, and Windows host paths (covered only by the shared mediaFileReference logic).

No screenshot: the visible change is the error text being replaced by the image.

Model/harness: Claude Opus 5.5 via Hermes Agent (ACP) in T3 Code.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1896881f-51e5-4f81-9d9f-fe9d2a739edc
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.9 KiB 20.9 KiB 0 B (0.0%) 29.3 KiB ✅
Codex Live turn messages 2 2 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.2 KiB 21.2 KiB 0 B (0.0%) 29.3 KiB ✅
Claude Live turn messages 2 2 0 (0.0%) 8 ✅

Baseline: cb44cd7 · PR result: 4764dc6 · Source CI: success

Scenario and decoded snapshot size

10 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.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

WorkspaceImagePreview always requested a workspace-file asset, which the
server confines to the workspace, so any host image failed with 'Unable to
load workspace image.' It now picks media-file for paths outside the
workspace, as the HTML/PDF preview already did.
@Salochi
Salochi force-pushed the fix/host-image-preview branch from 4764dc6 to a3700b7 Compare October 16, 2026 13:13
@Salochi
Salochi merged commit 8c2da62 into main Oct 16, 2026
29 checks passed
@Salochi
Salochi deleted the fix/host-image-preview branch October 16, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant