Skip to content

fix(desktop): give the stored cloud chat a workspace tRPC context while its box wakes - #9621

Merged
superset-home merged 1 commit into
mainfrom
sentry/desktop-1v4-stored-chat-trpc-context
Nov 11, 2026
Merged

superset-home merged 1 commit into
mainfrom
sentry/desktop-1v4-stored-chat-trpc-context

Conversation

@superset-home

@superset-home superset-home commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

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): AttachmentImage with no workspaceTrpc.Provider throws Unable 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 --noEmit finished 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.

Written for commit 581804b. Summary will update on new commits.

View guided diff Turn on auto-fix

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of stored chat transcripts when a workspace does not yet have a host.

…le its box wakes

The stored-chat screen renders the chat pane's transcript before the box has
an address, outside WorkspaceProvider. Image attachments, attachment parts and
changed-files cards call workspaceTrpc hooks, which throw without a provider
even when the query is disabled, so the dashboard content boundary showed its
error page until the user navigated away.

Mount a workspaceTrpc provider whose client fails every call. With no
ChatPaneActions workspaceId the host queries stay disabled and the rows fall
back to file cards, as they were written to.

Refs DESKTOP-1V4
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

StoredCloudChat now provides StoredChatTranscript with a workspace tRPC client and a query client. The workspace client returns an error when no host is available, and the query client does not retry queries.

Changes: Stored chat workspace context

Layer / File(s) Summary
Hostless workspace tRPC provider
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/StoredCloudChat/StoredCloudChat.tsx
StoredCloudChat creates a workspace client that errors when no host is available and a query client with retries disabled. It provides both clients to StoredChatTranscript. The transcript props remain unchanged.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related PRs

  • ParadevAI/Paradev#9565: Updates the stored-cloud-chat wake-up flow. This PR also changes how StoredCloudChat renders stored chat before a cloud workspace has a host.
  • ParadevAI/Paradev#9344: Introduces cloud-chat launch and pending-pane behavior during workspace wake-up, which relates to the stored-chat rendering flow.

Suggested reviewers: harshithmullapudi

Merge Risk: Minimal · up to 58180

Stored chats can render while a cloud workspace wakes. No merge-blocking issue was established.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title uses conventional commit format and clearly describes the main change: adding a workspace tRPC context for stored cloud chat while the workspace box wakes.
Description check Passed The description clearly explains the problem, root cause, fix, implementation placement, and verification results. It omits the template's Checklist section, but the core required information is compl…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the problem, root cause, fix, implementation placement, and verification results. It omits the template's Checklist section, but the core required information is complete.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e3e70241-e622-4ee5-8e97-cb139daa1cd0
Commits

Reviewing files that changed from the base of the PR and between 196339e and 581804b.

Files selected for processing: 1

  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/StoredCloudChat/StoredCloudChat.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

@superset-home
superset-home merged commit e6933b5 into main Nov 11, 2026
18 checks passed
Kitenite added a commit that referenced this pull request Nov 12, 2026
… (SUPER-3412) (#9623)

A cloud workspace opens on its stored chat while its box wakes. That
screen draws the chat pane's transcript before WorkspaceProvider mounts,
because the sandbox has no address yet. TurnChangesCard, AttachmentImage
and AttachmentPartImage called workspaceTrpc hooks, which throw outside a
provider even when their query is disabled, so the view showed "Unable to
find tRPC Context" instead of the chat.

The transcript now reads the host only where the pane gives it one:
- TurnChangesCard takes worktreePath from ChatPaneActions (SessionView
  supplies it) instead of querying workspace.get.
- AttachmentImage and AttachmentPartImage mount their host-reading part
  only when ChatPaneActions has a workspaceId. Otherwise they show file
  cards; cloud-stored attachments still load without a host.
- DraftChat's ChatPaneActionsProvider wraps the whole pane, so its warm
  transcript keeps host reads.

This removes the provider whose client failed every call, added to
StoredCloudChat in #9621. A fake provider hid the missing host instead of
the transcript stating it.

Adds a StoredChatTranscript test that renders a stored chat with a
changes card and image attachments and no workspace tRPC provider. It
fails with the original error when the fix is reverted.

This branch was previously deployed

1 inactive deployment
preview — 581804bb Deployed Nov 11, 2026 by superset-home via Deploy Docs #14385
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant