PR #9623 review: chat transcript without workspace host
Summary
When you opened a cloud workspace while its box was asleep, the app showed "This view hit an error – Unable to find tRPC Context" in place of the stored chat. StoredCloudChat renders the transcript outside WorkspaceProvider, and three transcript rows called workspaceTrpc hooks without a check. The PR removes the fake provider from #9621. Now the transcript reads the host only when ChatPaneActions.workspaceId is set. TurnChangesCard gets worktreePath from the pane actions, and image attachments fall back to file cards (cloud fileId images still load).
Verdict
Looks good The source fix is better than the stub it replaces. I reproduced the crash and the fix in the real desktop app. CI is green, and the new test fails without the fix. My findings are small follow-ups, not blockers.
Findings
apps/desktop/src/renderer/…/AcpChatPane/components/DraftChat/DraftChat.tsx:53: DraftChat now wraps its warm StoredChatTranscript with workspaceId but no worktreePath. That transcript now loads host images, but its TurnChangesCard still shows absolute paths such as /workspace/src/app.ts. The same chat in SessionView shows relative paths. This is not a regression, because the card had no workspaceId there before. But the two views of one chat now differ.
Fix: Query workspace.get in DraftChat (or in AcpChatPane) and pass worktreePath, as SessionView.tsx:316 does.
…/Transcript/hooks/useChatImageSource/useChatImageSource.ts:31 still queries workspace.get for the worktree path. The pane now has ChatPaneActions.worktreePath for this (SessionView.tsx:316). So two places resolve the same value.
Fix: After the DraftChat fix above, read worktreePath from useChatPaneActions() here and drop the extra query. The host reads then stay only in filesystem.readFile.
…/ChatSession/providers/ChatPaneActionsProvider/ChatPaneActionsProvider.tsx:39: "workspaceId present ⇒ a workspace tRPC provider is mounted" is now a contract that only a doc comment states. workspaceId also drives links and chips that do not need a host. A later surface that passes workspaceId for links outside WorkspaceProvider brings the crash back. The PR description treats this loud failure as a feature, which is reasonable.
Optional fix: Use a separate field such as hostMounted or hostReads, so the host contract does not ride on an identifier.
…/Transcript/hooks/useAttachmentSource/useAttachmentSource.ts:49: The throw can never run. showable already disables the query when hostRead is null and the part has no fileId, and readAttachmentSource tries fileId first. You can keep it as a guard, but readAttachmentSource could also take an optional hostRead and return null.
I checked these points and they are fine: no other transcript row calls workspaceTrpc without a guard. The gallery overlay and PrefetchChatImage mount only after HostAttachmentImage opens them, and that needs a workspace. New folders follow the co-location rules. No new user-facing strings, so i18n is not affected. No tRPC procedure changes.
Evidence
Surface: desktop (Electron dev build, this workspace, renderer localhost:3005, CDP port 9333, signed in as the workspace's dev user). Journey with real mouse input: New Workspace → click the cloud workspace "Archive PR review workspaces on close" in the sidebar, with its box asleep.
What was synthetic: This user has no stored cloud chats, so before each click I put one stored chat into the renderer's React Query cache over CDP (chatHistory.ofWorkspace and the stored-chat-snapshot key). It has an edit turn, a path-tagged image and a host-only attachmentId image, the same shape as the PR's test. A CDP fetch interceptor blocked cloudWorkspace.access calls with wake: true, so no real box was woken. cloud_workspace_boots has no new boot for that workspace during this run. The "before" run used main's transcript files with this PR's StoredCloudChat (no #9621 stub), which is the state that shipped the bug.


Not exercised: a loaded cloud (fileId) thumbnail without a host. That needs a real uploaded file. The live SessionView and DraftChat paths with a woken host were checked only by the existing unit tests, not in the app.
Questions for the author
- Should
DraftChatpassworktreePathtoo, so its warm transcript matchesSessionView? See finding 1. - Do you plan to move
useChatImageSourceontoChatPaneActions.worktreePath, soworkspace.getis read in one place? - Did you think about a dedicated "host mounted" signal, apart from
workspaceId?
Test / CI notes
- All at commit
967263080ea7. bun teston$workspaceId/components,ChatSessionandChatPane: 646 pass, 0 fail (afterbun run generate:icons; a fresh checkout is missingresources/public/file-icons/manifest.json).- Regression check: with the transcript files reverted to base
b5da7a5,StoredChatTranscript.test.tsxfails with "Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?" (0 pass, 1 fail). With the PR, it passes. bun run --cwd apps/desktop typecheck: clean.biome checkon the 16 changed files: no issues.- GitHub CI: all checks pass (Lint, Typecheck, Test, Sherif, Build CLI, Version Sync, Vale, preview deploys). cubic: neutral. CodeRabbit: success, no inline comments.