Repository navigation
Conversation
…paces Workspaces have no cloud mirror since local-first (#5731), so chat.createSession's insert failed the v2_workspace_id FK for every workspace created since. Keep the column as a plain uuid pointing at the host-local workspace id.
…setup banner - getSnapshot polling backs off to 5s while errored (was retrying runtime creation + keychain reads at 4fps) and no longer flips the pane between spinner and error on every retry - "No model provider credentials available" now renders as a neutral callout with an Open Model Settings button instead of a raw error
📝 WalkthroughWalkthroughThe PR adds model-provider error detection and settings navigation, changes chat error polling and loading behavior, and removes the foreign-key constraint from ChangesChat session reliability
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ChatInputFooter
participant ErrorUtility
participant ModelSettings
ChatInputFooter->>ErrorUtility: Check chat error message
ErrorUtility-->>ChatInputFooter: Return missing-provider status
ChatInputFooter->>ModelSettings: Navigate to /settings/models
Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/hooks/usePaneRegistry/components/ChatPane/components/WorkspaceChatInterface/components/ChatInputFooter/ChatInputFooter.tsx:
- Around line 163-189: Add the cursor-text class alongside select-text on both
error surfaces in ChatInputFooter: the setup message span within the
showModelProviderSetup branch and the fallback error paragraph rendering
errorMessage. Preserve all existing styling and behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: da392122-5b74-4c40-91cc-a6022c08010f
📒 Files selected for processing (7)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatPane/components/WorkspaceChatInterface/components/ChatInputFooter/ChatInputFooter.tsxapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatPane/components/WorkspaceChatInterface/components/ChatInputFooter/utils/getErrorMessage.tsapps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/ChatPane/hooks/useWorkspaceChatDisplay/useWorkspaceChatDisplay.tspackages/db/drizzle/0064_drop_chat_sessions_v2_workspace_fk.sqlpackages/db/drizzle/meta/0064_snapshot.jsonpackages/db/drizzle/meta/_journal.jsonpackages/db/src/schema/schema.ts
| {showModelProviderSetup ? ( | ||
| <div | ||
| role="alert" | ||
| className="mb-3 select-text rounded-md border border-destructive/20 bg-destructive/10 px-4 py-2 text-sm text-destructive" | ||
| className="mb-3 flex items-center justify-between gap-3 rounded-md border border-border bg-muted/50 px-4 py-2 text-sm" | ||
| > | ||
| {errorMessage} | ||
| </p> | ||
| <span className="select-text text-muted-foreground"> | ||
| Chat needs a model provider. Connect Claude or add an API key to | ||
| get started. | ||
| </span> | ||
| <Button | ||
| size="sm" | ||
| variant="outline" | ||
| className="shrink-0" | ||
| onClick={() => void navigate({ to: "/settings/models" })} | ||
| > | ||
| Open Model Settings | ||
| </Button> | ||
| </div> | ||
| ) : ( | ||
| errorMessage && ( | ||
| <p | ||
| role="alert" | ||
| className="mb-3 select-text rounded-md border border-destructive/20 bg-destructive/10 px-4 py-2 text-sm text-destructive" | ||
| > | ||
| {errorMessage} | ||
| </p> | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add cursor-text to both error surfaces.
The setup message at Line [168] and the fallback error at Line [185] include select-text but not cursor-text. Add the missing class so users receive the required text-selection cursor.
Proposed fix
- <span className="select-text text-muted-foreground">
+ <span className="select-text cursor-text text-muted-foreground">
...
- className="mb-3 select-text rounded-md border border-destructive/20 bg-destructive/10 px-4 py-2 text-sm text-destructive"
+ className="mb-3 select-text cursor-text rounded-md border border-destructive/20 bg-destructive/10 px-4 py-2 text-sm text-destructive"As per coding guidelines, rendered error messages must include select-text cursor-text classes so users can copy them; Sonner toasts are exempt.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| {showModelProviderSetup ? ( | |
| <div | |
| role="alert" | |
| className="mb-3 select-text rounded-md border border-destructive/20 bg-destructive/10 px-4 py-2 text-sm text-destructive" | |
| className="mb-3 flex items-center justify-between gap-3 rounded-md border border-border bg-muted/50 px-4 py-2 text-sm" | |
| > | |
| {errorMessage} | |
| </p> | |
| <span className="select-text text-muted-foreground"> | |
| Chat needs a model provider. Connect Claude or add an API key to | |
| get started. | |
| </span> | |
| <Button | |
| size="sm" | |
| variant="outline" | |
| className="shrink-0" | |
| onClick={() => void navigate({ to: "/settings/models" })} | |
| > | |
| Open Model Settings | |
| </Button> | |
| </div> | |
| ) : ( | |
| errorMessage && ( | |
| <p | |
| role="alert" | |
| className="mb-3 select-text rounded-md border border-destructive/20 bg-destructive/10 px-4 py-2 text-sm text-destructive" | |
| > | |
| {errorMessage} | |
| </p> | |
| ) | |
| {showModelProviderSetup ? ( | |
| <div | |
| role="alert" | |
| className="mb-3 flex items-center justify-between gap-3 rounded-md border border-border bg-muted/50 px-4 py-2 text-sm" | |
| > | |
| <span className="select-text cursor-text text-muted-foreground"> | |
| Chat needs a model provider. Connect Claude or add an API key to | |
| get started. | |
| </span> | |
| <Button | |
| size="sm" | |
| variant="outline" | |
| className="shrink-0" | |
| onClick={() => void navigate({ to: "/settings/models" })} | |
| > | |
| Open Model Settings | |
| </Button> | |
| </div> | |
| ) : ( | |
| errorMessage && ( | |
| <p | |
| role="alert" | |
| className="mb-3 select-text cursor-text rounded-md border border-destructive/20 bg-destructive/10 px-4 py-2 text-sm text-destructive" | |
| > | |
| {errorMessage} | |
| </p> | |
| ) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/hooks/usePaneRegistry/components/ChatPane/components/WorkspaceChatInterface/components/ChatInputFooter/ChatInputFooter.tsx
around lines 163 - 189, Add the cursor-text class alongside select-text on both
error surfaces in ChatInputFooter: the setup message span within the
showModelProviderSetup branch and the fallback error paragraph rendering
errorMessage. Preserve all existing styling and behavior.
Source: Coding guidelines
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
|
This PR has had no activity for 53 days and will close in 7 days unless there is new activity. If this contribution is still important or relevant, please leave a comment to keep it open. If it closes, you are welcome to reopen it or ask a maintainer to reopen it. Thank you for contributing! |
|
This PR was automatically closed due to inactivity to help keep the review queue manageable. This does not mean the contribution was rejected. If this contribution is still important or relevant, please reopen it or leave a comment asking a maintainer to reopen it. Thank you for contributing! |
Summary
chat_sessions.v2_workspace_id→v2_workspacesFK (migration 0064): since workspaces went local-first (feat(desktop,host-service): local-first projects — host.db owns projects, workspace cloud sync retired #5731) they have no cloud mirror row, sochat.createSessionfailed its insert for every newly created workspace and chat was unusable there.getSnapshotpoll retried runtime creation (including macOS keychain reads) four times a second while flipping between the loading spinner and the error banner — it now holds a steady error state and backs off to 5s until it recovers.Why / Context
Reported symptom: sending a chat message in a v2 workspace surfaced
Failed query: insert into "chat_sessions" …and the pane kept "reloading". Root causes were the stale cloud FK (the referencedv2_workspacesrow is never created anymore) and the snapshot poll treating every failed background retry as a fresh load.How It Works
v2WorkspaceIdstays on the cloudchat_sessionsrow as a plain uuid — it still scopes the Electric-synced session list per workspace; it just no longer requires a cloud workspace row. LosingonDelete: set nullonly leaves orphaned session rows that the UI already never shows (the selector filters by live workspace id).useWorkspaceChatDisplay:isConversationLoadingusesisPendingonly, andrefetchIntervalreturns 5s while the query is errored (auto-recovers to 4fps on success).ChatInputFooterrecognizes the missing-credentials error and renders the actionable banner; all other errors keep the existing destructive banner.Manual QA Checklist (all done via CDP against the dev desktop, workspace
0830f756)chat_sessionsgetSnapshotcalls per 5s window (was 4/s), steady banner, no spinner flicker#/settings/modelsTesting
bun run typecheck(packages/db, packages/trpc, apps/desktop)bun run lintbun test apps/desktop/.../v2-workspace(117 pass)pg_constrainton a production-derived branch; applied cleanly viabun run db:migrateRisks / Rollout
Follow-ups
hasUsableRuntimeEnvdisagree. Separately, the credential resolver only probes legacy keychain services (claude-cli), not modern Claude Code's"Claude Code-credentials".chat_sessions) remains Phase B ofplans/remove-cloud-project-model.md.Summary by cubic
Fixes chat in local-first workspaces by removing the stale
chat_sessions.v2_workspace_idFK and stabilizing the chat pane’s error behavior. Adds a simple model setup callout with an “Open Model Settings” button and backs off polling on errors.Bug Fixes
chat_sessions → v2_workspacesFK; keptv2_workspace_idas a plain uuid so session inserts work for local-only workspaces.Migration
0064_drop_chat_sessions_v2_workspace_fkto drop the FK (forward-only, non-destructive).Written for commit 279a4ac. Summary will update on new commits.