From d497cd72f75fdcc3090b12d95387fa5b0c83c4a1 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 2 Mar 2026 06:44:05 +0000 Subject: [PATCH] Fix BranchToolbar errors silently dropped for draft threads Route errors through onError callback prop so draft thread errors are handled via ChatView's setThreadError, which correctly updates localDraftErrorsByThreadId instead of dispatching SET_ERROR that silently no-ops for threads not in state.threads. Co-authored-by: Julius Marminge --- apps/web/src/components/BranchToolbar.tsx | 8 +++++++- apps/web/src/components/ChatView.tsx | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/BranchToolbar.tsx b/apps/web/src/components/BranchToolbar.tsx index ce095c3b9c..a1c1201944 100644 --- a/apps/web/src/components/BranchToolbar.tsx +++ b/apps/web/src/components/BranchToolbar.tsx @@ -34,6 +34,7 @@ interface BranchToolbarProps { onEnvModeChange: (mode: "local" | "worktree") => void; envLocked: boolean; onComposerFocusRequest?: () => void; + onError?: (error: string | null) => void; } export default function BranchToolbar({ @@ -42,6 +43,7 @@ export default function BranchToolbar({ onEnvModeChange, envLocked, onComposerFocusRequest, + onError, }: BranchToolbarProps) { const { state, dispatch } = useStore(); const draftThread = useComposerDraftStore((store) => store.getDraftThread(threadId)); @@ -147,7 +149,11 @@ export default function BranchToolbar({ const setThreadError = (error: string | null) => { if (!activeThreadId) return; - dispatch({ type: "SET_ERROR", threadId: activeThreadId, error }); + if (hasServerThread) { + dispatch({ type: "SET_ERROR", threadId: activeThreadId, error }); + } else { + onError?.(error); + } }; const setThreadBranch = (branch: string | null, worktreePath: string | null) => { diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 5017fb3f47..ff2ea5f057 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -2463,6 +2463,7 @@ export default function ChatView({ threadId }: ChatViewProps) { onEnvModeChange={onEnvModeChange} envLocked={envLocked} onComposerFocusRequest={scheduleComposerFocus} + onError={(error) => setThreadError(activeThread.id, error)} /> )}