fix: show error toast when workspace connection fails#539
fix: show error toast when workspace connection fails#539AndrewMoryakov wants to merge 7 commits intoDimillian:mainfrom
Conversation
Previously connection errors were only logged to the debug panel. Now users see a visible toast notification with the failure reason, making it easier to diagnose connection issues. https://claude.ai/code/session_0182kaMdjTV63jvU8bavh97C
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07563f12e5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| pushErrorToast({ | ||
| title: "Workspace connection failed", | ||
| message, | ||
| }); |
There was a problem hiding this comment.
Avoid double-reporting connection errors via toast
connectWorkspace now emits a toast and then rethrows, but several callers already show their own error toast when this promise rejects; for example, usePullRequestReviewActions catches the same failure and calls pushErrorToast (src/features/git/hooks/usePullRequestReviewActions.ts:110-115), so a single connect failure during PR review now produces two user-facing toasts. This regression was introduced by moving toast emission into the shared low-level helper.
Useful? React with 👍 / 👎.
| pushErrorToast({ | ||
| title: "Workspace connection failed", | ||
| message, |
There was a problem hiding this comment.
Keep background workspace restore failures silent
This helper is also used by automatic startup restore, where failures are intentionally swallowed (src/features/workspaces/hooks/useWorkspaceRestore.ts:46-47); adding a toast here turns those background retries into visible errors, so users with stale/unavailable workspaces can get unexpected toast spam on launch even though they didn’t manually trigger a connect action.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2811446601
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pushErrorToast({ | ||
| title: "Workspace connection failed", | ||
| message, |
There was a problem hiding this comment.
Keep lifecycle reconnect failures from triggering toasts
This low-level connectWorkspace helper is wired into remote lifecycle hooks (checked App.tsx:704 and App.tsx:1771), and those hooks intentionally catch reconnect failures to avoid user-facing noise (useRemoteThreadRefreshOnFocus.ts:74-76 and useRemoteThreadLiveConnection.ts:263-267). Emitting pushErrorToast here means background reconnect attempts (focus/visibility recovery and 12s polling) now surface repeated "Workspace connection failed" toasts whenever a remote workspace is unavailable, even though those code paths were designed to fail silently; this regresses UX and can spam users until connectivity returns.
Useful? React with 👍 / 👎.
All 9 empty catch handlers across the codebase now log errors via console.debug instead of silently swallowing them. These are all background refresh/polling operations where toast notifications would cause spam, but debug-level logging aids development troubleshooting. Files changed: - src/App.tsx (refreshLocalUsage) - src/features/home/hooks/useLocalUsage.ts (2 instances) - src/features/shared/hooks/useFileEditor.ts - src/features/git/hooks/useGitStatus.ts - src/features/git/hooks/useGitRemote.ts - src/features/git/hooks/useGitLog.ts - src/features/workspaces/hooks/useWorkspaceFiles.ts - src/features/threads/hooks/useThreadTurnEvents.ts https://claude.ai/code/session_0182kaMdjTV63jvU8bavh97C
Replace 4 `as any` type casts with proper `Record<string, unknown>` narrowing after runtime type checks. The function already validates `typeof candidate === "object"` before accessing properties, so the cast to Record is safe and eliminates unsafe `any` access. https://claude.ai/code/session_0182kaMdjTV63jvU8bavh97C
Replace `as any` with `Record<string, unknown>` for API response parsing and prompt item mapping. Runtime type checks (Array.isArray, typeof) already guard access, so the narrower types are safe. https://claude.ai/code/session_0182kaMdjTV63jvU8bavh97C
Replace 159 individual `import X from "lucide-react/dist/esm/icons/x"`
imports across 40 files with grouped `import { X } from "lucide-react"`.
The dist path is an internal implementation detail that could break on
library updates. lucide-react ^0.562.0 supports named exports with
full tree-shaking via Vite, making the dist path unnecessary.
Also removes src/lucide-icons.d.ts (TypeScript declaration for the
dist pattern, no longer needed).
https://claude.ai/code/session_0182kaMdjTV63jvU8bavh97C
Add user-facing error notification when drag-and-drop of workspace files fails. This is always a user-initiated action (not background) so toast feedback is appropriate. Keeps existing console.error for developer debugging. https://claude.ai/code/session_0182kaMdjTV63jvU8bavh97C
Summary
pushErrorToastservice to display failure reasonChanges
src/features/workspaces/hooks/useWorkspaceCrud.ts: Added error toast in catch block (+7 lines)