Skip to content

[Bug]: File preview (HTML/PDF/image) reloads and jumps to top after every agent command, even when the file is unchanged #27681

Open

Description

@kurtkuehnert

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. In a thread, have the agent write a long local HTML report and link it in a reply.
  2. Open the link in the side preview panel and scroll halfway down.
  3. Send a follow-up so the agent works in that thread, running commands such as ls or git status.

Expected behavior

The preview keeps its page and scroll position. It reloads only when the file it shows changes, or when I ask.

Actual behavior

The panel flashes white and the page reloads at the top every time the agent finishes a command or a file edit, or a checkpoint lands. This happens even when nothing touched the open file. While an agent works, this happens every few seconds, so a report can't be read in the thread that produced it.

Cause: FilePreviewPanel appends workspace-revision=<workspaceMutationId> to the frame URL, and the frame is keyed by its URL, so each new id remounts it. The id is thread-wide. It moves on any completed command_execution or file_change item and on every checkpoint. It applies to every file opened from the thread, inside or outside the workspace root, because they all load as media-file. So moving the file elsewhere doesn't help.

#20913 reported the same problem and was closed as by design. #23106 later fixed it for video and audio: the server returns a fileRevision (device, inode, size, mtime, ctime) with the asset URL, and the player reloads only when that changes. HTML, PDF and image previews were left out on purpose, so they still reload on every agent command.

Suggested fix: use the same fileRevision for HTML, PDF and image previews. Reload only when the open file's revision changes, and fall back to workspaceMutationId only for older servers that don't send it. For HTML, also keep the scroll position across a real refresh. If HTML must still be refreshed when the files it links (CSS, JS) change, that could be opt-in or limited to the file's directory. Read-only commands anywhere in the workspace shouldn't reload it.

Impact

Major degradation or frequent failure

Version or commit

T3 Code (Beta) 0.1.5

Environment

macOS 27.0.1, desktop app, Claude provider

Workaround

The only workarounds I know of are opening the file in a thread where no agent is running, or serving it over a localhost HTTP server and opening that URL in a browser tab. Neither is reasonable for reading a report while an agent works on it.

Activity

  1. JackFrancis2357 commented on Nov 10, 2026

    @JackFrancis2357

    I’m seeing this in the desktop app’s file preview panel.

    Reproduction

    1. Open an existing image/PDF in the file preview panel.
    2. Have the thread generate a new file.
    3. The existing file’s preview flickers badly while the thread is active. The flickering stops when the thread is inactive.

    Environment: Local machine runs macOS on Apple silicon; local server reports 0.1.7. Desktop app version hasn’t been confirmed.

    Source inspection: In v0.1.7, image previews use a thread-wide workspace revision in their URL and React key. Completed commands and other agent activity change that revision, remounting the image even when the displayed file is unchanged. PDFs use a separate file-revision path, so the PDF-specific cause remains unconfirmed.

    Prepared by Codex (GPT-6).

  2. baohappy02 commented on Nov 11, 2026

    @baohappy02

    Me too, its so annoying

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