[Bug]: An open Word or PowerPoint preview reloads, and goes back to its start, after every agent command#32669
Area: apps/web
Steps to reproduce
- Open a project and a thread, and open a long
.docx(or a.pptx) from Files. - Scroll down a few pages.
- Ask the agent to run a few shell commands that touch no files, for example
sleep 5; echo one, thensleep 5; echo two.
Expected behavior
The document stays where it is: none of those commands changed it.
Actual behavior
After each command the preview shows its loading state, fetches and prepares the file again, and comes back at its first page. While an agent works, that is every few seconds, so the file cannot be read beside the conversation.
Cause
The document branch of apps/web/src/components/files/FilePreviewPanel.tsx mounts AttachmentFilePreview with key={${environmentId}:${absolutePath}:${workspaceMutationId}:${fileRefreshRevision}}. workspaceMutationId (deriveWorkspaceMutationId in packages/client-runtime/src/state/threadDetail.ts) moves after every completed command, file change, dynamic tool or subagent in the thread, and after each checkpoint, whether or not this file changed. Each move remounts the preview. The same branch serves Excel, archives, SQLite, fonts and other binary files.
The server already reports a file revision for the media-file assets this branch loads outside drafts, and WorkspaceVideoPreview already uses it to keep an unchanged video loaded.
Impact
Major degradation: Office files and other document previews cannot be read while an agent works in the thread.
Version or commit
main @ 25bf84ab07
Environment
Found in a downstream fork that shares this code (macOS 26 on Apple silicon); the key above is unchanged on main. Platform-independent.
Workaround
None in the app; open the file in another app.