Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(ui): dismiss restored assistant error cards (#972)

vastsabf788548c72b
diff --git a/apps/desktop/src/features/chat/transcript/shared.tsx b/apps/desktop/src/features/chat/transcript/shared.tsx
index a3ab32e2b..fc92315fe 100644
--- a/apps/desktop/src/features/chat/transcript/shared.tsx
+++ b/apps/desktop/src/features/chat/transcript/shared.tsx
@@ -55,6 +55,7 @@ import {
IconTerminal,
IconVideo,
IconWrench,
+ IconX,
} from "../../../components/icons";
import { TooltipButton } from "../../../components/ui";
@@ -149,8 +150,14 @@ export function AssistantErrorMessage({ message }: { message: UiMessage }) {
const detailsToggleRef = useRef<HTMLButtonElement | null>(null);
const notifyDisclosureAnchor = useDisclosureAnchorNotifier();
const detailsId = useId();
+ const dismissed = useAppStore(
+ (state) => state.dismissedAssistantErrorMessages[message.id] === true,
+ );
+ const dismissAssistantErrorMessage = useAppStore(
+ (state) => state.dismissAssistantErrorMessage,
+ );
const error = message.error;
- if (!error) return null;
+ if (!error || dismissed) return null;
const networkDetails = error.details;
const certificateFailure =
error.code === "NETWORK_ERROR" &&
@@ -232,6 +239,15 @@ export function AssistantErrorMessage({ message }: { message: UiMessage }) {
{t("errors.action.openSettings")}
</button>
) : null}
+ <button
+ type="button"
+ className="message-error-dismiss"
+ aria-label={t("chat.dismissError")}
+ title={t("chat.dismissError")}
+ onClick={() => dismissAssistantErrorMessage(message.id)}
+ >
+ <IconX size={14} aria-hidden />
+ </button>
</div>
</div>
<div
diff --git a/apps/desktop/src/stores/app-state.ts b/apps/desktop/src/stores/app-state.ts
index 3cf9e08e0..692b44e04 100644
--- a/apps/desktop/src/stores/app-state.ts
+++ b/apps/desktop/src/stores/app-state.ts
@@ -126,6 +126,8 @@ export type AppState = {
/** Latest user-selected session while its transcript/workspace is resolving. */
selectingSessionId?: string;
messages: UiMessage[];
+ /** Renderer-only visibility overrides; never persisted with transcript messages. */
+ dismissedAssistantErrorMessages: Record<string, true>;
/** Session ids whose panes stay mounted, most recently visible first. */
retainedSessionIds: string[];
/** Last transcript each retained pane painted. */
@@ -236,6 +238,7 @@ export type AppState = {
) => Promise<boolean>;
retryLastPrompt: () => Promise<void>;
clearError: () => void;
+ dismissAssistantErrorMessage: (messageId: string) => void;
activateMessageRevision: (rootUserId: string, revisionIndex: number) => Promise<void>;
deleteMessage: (messageId: string) => Promise<void>;
rollbackWorkspaceChange: (
diff --git a/apps/desktop/src/stores/slices/initial-state.ts b/apps/desktop/src/stores/slices/initial-state.ts
index 998f3eeb5..742bb6b2f 100644
--- a/apps/desktop/src/stores/slices/initial-state.ts
+++ b/apps/desktop/src/stores/slices/initial-state.ts
@@ -51,6 +51,7 @@ export function createInitialState(): AppStateData {
projectSort: initialSidebarPreferences.projectSort,
messages: [],
retainedSessionIds: [],
+ dismissedAssistantErrorMessages: {},
retainedTranscripts: {},
transcriptViews: {},
sessionHistory: {},
diff --git a/apps/desktop/src/stores/slices/interaction-slice.ts b/apps/desktop/src/stores/slices/interaction-slice.ts
index bf22605c4..978bf6bd1 100644
--- a/apps/desktop/src/stores/slices/interaction-slice.ts
+++ b/apps/desktop/src/stores/slices/interaction-slice.ts
@@ -46,8 +46,19 @@ export function createInteractionSlice({
| "resolvePlan"
| "showToast"
| "dismissToast"
+ | "dismissAssistantErrorMessage"
> {
return {
+ dismissAssistantErrorMessage: (messageId) => {
+ if (!messageId) return;
+ set((state) => ({
+ dismissedAssistantErrorMessages: {
+ ...state.dismissedAssistantErrorMessages,
+ [messageId]: true,
+ },
+ }));
+ },
+
setPage: (page, opts) => {
runtime.beginNavigationIntent();
const record = opts?.record !== false;
diff --git a/apps/desktop/src/styles/messages.css b/apps/desktop/src/styles/messages.css
index 237664b2a..bc81d72e1 100644
--- a/apps/desktop/src/styles/messages.css
+++ b/apps/desktop/src/styles/messages.css
@@ -1700,6 +1700,27 @@
justify-content: flex-end;
}
+.message-error-dismiss {
+ display: inline-flex;
+ width: 26px;
+ height: 26px;
+ flex: 0 0 auto;
+ align-items: center;
+ justify-content: center;
+ border-radius: var(--radius-sm);
+ color: var(--ds-text-muted);
+}
+
+.message-error-dismiss:hover {
+ background: var(--ds-bg-hover);
+ color: var(--ds-text-primary);
+}
+
+.message-error-dismiss:focus-visible {
+ outline: 2px solid var(--ds-accent);
+ outline-offset: 2px;
+}
+
.message-error-toggle {
display: inline-flex;
min-height: 24px;
diff --git a/apps/desktop/test/chat-error-message.test.mjs b/apps/desktop/test/chat-error-message.test.mjs
index 80776a560..956f80f9b 100644
--- a/apps/desktop/test/chat-error-message.test.mjs
+++ b/apps/desktop/test/chat-error-message.test.mjs
@@ -65,3 +65,35 @@ test("network failures show the transport errno beside the error code", async ()
assert.match(activityGroup, /retryError\.networkCode/);
});
});
+
+test("dismissing an assistant error hides its card without changing transcript data", async () => {
+ const [transcript, appState, initialState, interactionSlice, sessionSlice] =
+ await Promise.all([
+ readTranscriptSource(),
+ read("src/stores/app-state.ts"),
+ read("src/stores/slices/initial-state.ts"),
+ read("src/stores/slices/interaction-slice.ts"),
+ read("src/stores/slices/session-slice.ts"),
+ ]);
+ const component = transcript.slice(
+ transcript.indexOf("function AssistantErrorMessage"),
+ transcript.indexOf("const TOOL_ACTION_KEYS"),
+ );
+ const dismissAction = interactionSlice.slice(
+ interactionSlice.indexOf("dismissAssistantErrorMessage:"),
+ interactionSlice.indexOf("setPage:"),
+ );
+
+ assert.match(component, /dismissedAssistantErrorMessages\[message\.id\]/);
+ assert.match(component, /if \(!error \|\| dismissed\) return null/);
+ assert.match(component, /aria-label=\{t\("chat\.dismissError"\)\}/);
+ assert.match(component, /title=\{t\("chat\.dismissError"\)\}/);
+ assert.match(component, /onClick=\{\(\) => dismissAssistantErrorMessage\(message\.id\)\}/);
+ assert.match(appState, /messages: UiMessage\[\];/);
+ assert.match(appState, /dismissedAssistantErrorMessages: Record<string, true>/);
+ assert.match(initialState, /dismissedAssistantErrorMessages: \{\}/);
+ assert.match(dismissAction, /\.\.\.state\.dismissedAssistantErrorMessages/);
+ assert.match(dismissAction, /\[messageId\]: true/);
+ assert.doesNotMatch(dismissAction, /messages\s*:|replaceSessionMessages|deleteMessage|api\./);
+ assert.doesNotMatch(sessionSlice, /dismissedAssistantErrorMessages/);
+});
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index 9c5436797..2b86b0b7f 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -1832,7 +1832,7 @@ Single message render — either user (plaintext) or assistant (markdown streami
| Streaming | transparent like a completed turn — no left rail, no reserved inset, no whole-turn `--ds-tile` (D323); content grows. The tile belongs only to a subagent/delegation card (D319) |
| Thinking streaming | disclosure open; answer bubble omitted until answer text exists |
| Complete | transparent full-width markdown; no streaming chrome |
-| Error | compact assistant error card in transcript; localized summary and stable code share one header with the details disclosure; details still opens to redacted provider response, provider/model IDs, and copy action; the card offers a localized Continue action that resends the continuation prompt; configuration failures show Open settings. The session-scoped failed-turn recovery card is a fallback for terminal failures without a structured assistant error, so both cards never render for one turn |
+| Error | Compact assistant error card in transcript; localized summary and stable code share one header with the details disclosure; details still opens to redacted provider response, provider/model IDs, and copy action; the card offers localized Continue and accessible Dismiss actions. Dismiss affects renderer-only visibility keyed by message id and preserves the original UiMessage/host transcript. Configuration failures show Open settings. The session-scoped failed-turn recovery card is a fallback for terminal failures without a structured assistant error, so both cards never render for one turn |
### 8.4a Context compaction row
diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.md
index 9f651d6e4..5e321e191 100644
--- a/docs/spec/04-ux/09-interaction-patterns.md
+++ b/docs/spec/04-ux/09-interaction-patterns.md
@@ -678,6 +678,11 @@ may be retained while exactly one workspace supplies the visible shell context.
users must not see duplicate failure summaries for one turn. Completed turns
do not add a success card; their existing transcript and message-scoped
review cards remain the completion evidence.
+- A structured inline assistant error can be dismissed from the transcript. This
+ hides only its UI card, keyed by message id in renderer runtime state; the
+ original UiMessage, host transcript, and database record remain untouched.
+ The dismissal survives rerenders and session switches for the current app
+ lifetime, and does not add a restore or destructive transcript action.
- Failure copy states that the existing work remains available. The applicable
failure surface has exactly one **Continue** action and no **Regenerate**
action. Continue appends the current locale's continuation prompt (`Continue
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index 9aa50c52f..77af8b450 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -301,6 +301,7 @@ export const de = {
"responseFailed": "Der Assistent konnte diese Antwort nicht fertigstellen.",
"showErrorDetails": "Details anzeigen",
"hideErrorDetails": "Details ausblenden",
+ "dismissError": "Fehlermeldung schließen",
"copyErrorDetails": "Details kopieren",
"errorProvider": "KI-Anbieter",
"errorModel": "Modell",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index 0b741126e..4248faa87 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -308,6 +308,7 @@ export const en = {
responseFailed: "The assistant couldn't complete this reply.",
showErrorDetails: "Show details",
hideErrorDetails: "Hide details",
+ dismissError: "Dismiss error message",
copyErrorDetails: "Copy details",
errorProvider: "AI provider",
errorModel: "Model",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index 62befdb84..5044190c2 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -301,6 +301,7 @@ export const es = {
"responseFailed": "El asistente no pudo completar esta respuesta.",
"showErrorDetails": "Mostrar detalles",
"hideErrorDetails": "Ocultar detalles",
+ "dismissError": "Cerrar mensaje de error",
"copyErrorDetails": "Copiar detalles",
"errorProvider": "Proveedor de IA",
"errorModel": "Modelo",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index 9a34e4116..c6ca5d75c 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -301,6 +301,7 @@ export const fr = {
"responseFailed": "L'assistant n'a pas pu terminer cette réponse.",
"showErrorDetails": "Afficher les détails",
"hideErrorDetails": "Masquer les détails",
+ "dismissError": "Fermer le message d’erreur",
"copyErrorDetails": "Copier les détails",
"errorProvider": "Fournisseur d'IA",
"errorModel": "Modèle",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index e98bec760..793ff0bb8 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -310,6 +310,7 @@ export const ko = {
responseFailed: "어시스턴트가 이 답변을 완료하지 못했습니다.",
showErrorDetails: "세부 정보 표시",
hideErrorDetails: "세부 정보 숨기기",
+ dismissError: "오류 메시지 닫기",
copyErrorDetails: "세부 정보 복사",
errorProvider: "AI 프로바이더",
errorModel: "모델",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index efe71b931..be3394706 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -310,6 +310,7 @@ export const tr = {
responseFailed: "Asistan bu yanıtı tamamlayamadı.",
showErrorDetails: "Ayrıntıları göster",
hideErrorDetails: "Ayrıntıları gizle",
+ dismissError: "Hata mesajını kapat",
copyErrorDetails: "Ayrıntıları kopyala",
errorProvider: "AI servisi",
errorModel: "Model",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index 07e888332..70feae9a1 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -302,6 +302,7 @@ export const zhCN = {
responseFailed: "助手没能完成这次回复。",
showErrorDetails: "显示详情",
hideErrorDetails: "隐藏详情",
+ dismissError: "关闭错误消息",
copyErrorDetails: "复制详情",
errorProvider: "AI 服务",
errorModel: "模型",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index d1fe4b3a6..c55fa5d56 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -302,6 +302,7 @@ export const zhTW = {
responseFailed: "助手沒能完成這次回覆。",
showErrorDetails: "顯示詳情",
hideErrorDetails: "隱藏詳情",
+ dismissError: "關閉錯誤訊息",
copyErrorDetails: "複製詳情",
errorProvider: "AI 服務",
errorModel: "模型",