Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,13 @@ import {
ProviderStatusBanner,
shouldShowProviderStatusBanner,
} from "./chat/ProviderStatusBanner";
import { ThreadErrorBanner } from "./chat/ThreadErrorBanner";
import {
dismissThreadErrorBannerForSession,
getThreadErrorBannerKey,
isThreadErrorBannerDismissedForSession,
shouldShowThreadErrorBanner,
ThreadErrorBanner,
} from "./chat/ThreadErrorBanner";
import { resolveThreadPr, ThreadReadyCheckIcon } from "./ThreadStatusIndicators";
import { ComposerBannerStack, type ComposerBannerStackItem } from "./chat/ComposerBannerStack";
import { ThreadSyncStatusPill } from "./chat/ThreadSyncStatusPill";
Expand Down Expand Up @@ -1515,6 +1521,22 @@ function ChatViewContent(props: ChatViewProps) {
const threadError = isServerThread
? (localServerError ?? activeServerThread?.session?.lastError ?? null)
: localDraftError;
// Dismissals can only mask the shown error, never clear it: a server thread
// keeps its error in session.lastError, so clearing the local shadow would
// just fall through to the persisted one. Mask the current error until a
// different error arrives, mirroring the provider status banner.
const threadErrorBannerKey = getThreadErrorBannerKey(routeThreadKey, threadError);
const visibleThreadError = shouldShowThreadErrorBanner(
routeThreadKey,
threadError,
isThreadErrorBannerDismissedForSession(threadErrorBannerKey),
)
? threadError
: null;
// The session-scoped mask set does not trigger a render on its own, and
// setThreadError(null) bails when the banner is driven purely by
// session.lastError. Bump a tick so the banner hides immediately.
const [, setThreadErrorBannerDismissTick] = useState(0);
const runtimeMode = composerRuntimeMode ?? activeThread?.runtimeMode ?? DEFAULT_RUNTIME_MODE;
const interactionMode =
composerInteractionMode ?? activeThread?.interactionMode ?? DEFAULT_INTERACTION_MODE;
Expand Down Expand Up @@ -2582,7 +2604,7 @@ function ChatViewContent(props: ChatViewProps) {
)
? activeProviderStatus
: null;
const hasTimelineTopBanner = Boolean(threadError) || visibleProviderStatus !== null;
const hasTimelineTopBanner = Boolean(visibleThreadError) || visibleProviderStatus !== null;
const activeProjectCwd = activeProject?.workspaceRoot ?? null;
const activeThreadWorktreePath = activeThread?.worktreePath ?? null;
const activeWorkspaceRoot = activeThreadWorktreePath ?? activeProjectCwd ?? undefined;
Expand Down Expand Up @@ -6192,8 +6214,12 @@ function ChatViewContent(props: ChatViewProps) {
/>

<ThreadErrorBanner
error={threadError}
onDismiss={() => setThreadError(activeThread.id, null)}
error={visibleThreadError}
onDismiss={() => {
setThreadError(activeThread.id, null);
dismissThreadErrorBannerForSession(threadErrorBannerKey);
setThreadErrorBannerDismissTick((tick) => tick + 1);
}}
/>
{/* Main content area with optional plan sidebar */}
<div className="flex min-h-0 min-w-0 flex-1">
Expand Down
Loading