fix(desktop): give the stored cloud chat a workspace tRPC context while its box wakes
Problem
When a cloud workspace's box is asleep and has no address yet, the workspace route shows the newest stored chat (StoredCloudChat, un-flagged in #9565). If that chat shows an image attachment, the render throws a "no tRPC context" error. The dashboard ContentBoundary then shows its error page, and the page stays there after the box wakes, until the user navigates away.
Root cause
layout.tsx returns StoredCloudChat before it mounts WorkspaceProvider, so no workspaceTrpc.Provider exists above it. The chat pane's transcript calls workspaceTrpc hooks in AttachmentImage → useChatImageSource, in useAttachmentSource (useUtils) and in TurnChangesCard. In @trpc/react-query 11.16.0 these hooks read the context first and throw when it is absent, even when the query is enabled: false.
The transcript already handles "no workspace": with no ChatPaneActions.workspaceId, those queries are disabled and the rows fall back to file cards. Only the context itself was missing.
Fix
StoredCloudChat wraps the transcript in a workspaceTrpc.Provider whose client fails every call, with its own query client. Disabled host queries never run. A host read that is attempted (an attachment part with only a host attachment id) fails and shows the file card. The provider goes in StoredCloudChat, not StoredChatTranscript, because AcpChatPane renders StoredChatTranscript under the real workspace provider.
Verification
- Scratch test (not committed):
AttachmentImagewith noworkspaceTrpc.ProviderthrowsUnable to find tRPC Context, the same error as the event. Under a provider whose link always fails, it renders the file card and the link is called 0 times. Result:2 pass, 0 fail. bunx biome check StoredCloudChat.tsx:Checked 1 file in 10ms. No fixes applied.cd apps/desktop && bun run typecheck:tsc --noEmitfinished with no errors.bun test 'src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/':1155 pass, 0 fail.- Not verified in the running app: I could not put a cloud box to sleep from this sandbox.
Refs DESKTOP-1V4
Summary by cubic
Fixes a crash in the stored cloud chat view shown while a cloud workspace's box is waking. The transcript renders image attachments and other elements that call workspace tRPC hooks, which previously threw without a provider and sent the dashboard to its error page.
The transcript now sits inside a workspace tRPC provider whose client fails every call, and with no workspace ID the queries stay disabled, so rows fall back to file cards as designed. This addresses DESKTOP-1V4.
Summary by CodeRabbit
- Bug Fixes
- Improved handling of stored chat transcripts when a workspace does not yet have a host.