Skip to content

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

fix(settings): read the cloud-sync failure as one alert

vastsa37fbd8d01bb3
diff --git a/apps/desktop/src/components/settings/ConfigSyncError.tsx b/apps/desktop/src/components/settings/ConfigSyncError.tsx
index 07ed5c46b..57fe65098 100644
--- a/apps/desktop/src/components/settings/ConfigSyncError.tsx
+++ b/apps/desktop/src/components/settings/ConfigSyncError.tsx
@@ -1,16 +1,28 @@
import { useTranslation } from "react-i18next";
import { configSyncErrorKind } from "../../features/settings/config-sync-error";
+import { IconTriangleAlert } from "../icons";
export function ConfigSyncError({ message }: { message: string }) {
const { t } = useTranslation();
return (
- <div className="settings-config-sync-message error" role="alert">
- <strong>{t("settings.configSync.errorTitle")}</strong>
- <p>{t(`settings.configSync.errors.${configSyncErrorKind(message)}`)}</p>
- <details>
- <summary>{t("settings.configSync.errorDetails")}</summary>
- <pre>{message}</pre>
- </details>
+ <div className="settings-config-sync-alert" role="alert">
+ <IconTriangleAlert
+ aria-hidden
+ className="settings-config-sync-alert-icon"
+ size={16}
+ />
+ <div className="settings-config-sync-alert-copy">
+ <p className="settings-config-sync-alert-title">
+ {t("settings.configSync.errorTitle")}
+ </p>
+ <p className="settings-config-sync-alert-text">
+ {t(`settings.configSync.errors.${configSyncErrorKind(message)}`)}
+ </p>
+ <details className="settings-config-sync-alert-details">
+ <summary>{t("settings.configSync.errorDetails")}</summary>
+ <pre>{message}</pre>
+ </details>
+ </div>
</div>
);
}
diff --git a/apps/desktop/src/styles/settings.css b/apps/desktop/src/styles/settings.css
index 25ac858ab..c365f50ef 100644
--- a/apps/desktop/src/styles/settings.css
+++ b/apps/desktop/src/styles/settings.css
@@ -519,15 +519,77 @@
padding: 0 16px 14px;
}
-.settings-config-sync-message {
+/* A failed sync is a state, not a stray paragraph: the notice wears the error
+ ink on its frame and glyph, keeps the copy legible on both themes, and hides
+ the raw host text behind a disclosure. */
+.settings-config-sync-alert {
+ display: flex;
+ align-items: flex-start;
+ gap: 10px;
margin: 0 16px 14px;
+ padding: 12px 14px;
+ border: 1px solid color-mix(in srgb, var(--ds-error) 30%, transparent);
+ border-radius: var(--radius-md-plus);
+ background: color-mix(in srgb, var(--ds-error) 8%, transparent);
color: var(--ds-text-secondary);
- font-size: var(--text-sm);
+ font-size: var(--text-sm-plus);
+ line-height: var(--leading-body);
overflow-wrap: anywhere;
}
-.settings-config-sync-message.error {
- color: var(--ds-danger);
+.settings-config-sync-alert-icon {
+ flex: none;
+ margin-top: 1px;
+ color: var(--ds-error);
+}
+
+.settings-config-sync-alert-copy {
+ display: grid;
+ gap: 4px;
+ min-width: 0;
+}
+
+.settings-config-sync-alert-title {
+ margin: 0;
+ color: var(--ds-text-primary);
+ font-size: var(--text-md);
+ font-weight: var(--font-weight-medium);
+ line-height: var(--leading-compact);
+}
+
+.settings-config-sync-alert-text {
+ margin: 0;
+}
+
+.settings-config-sync-alert-details {
+ margin-top: 2px;
+}
+
+.settings-config-sync-alert-details > summary {
+ color: var(--ds-text-secondary);
+ font-size: var(--text-sm);
+ line-height: var(--leading-compact);
+ cursor: pointer;
+ user-select: none;
+}
+
+.settings-config-sync-alert-details > summary:hover,
+.settings-config-sync-alert-details > summary:focus-visible {
+ color: var(--ds-text-primary);
+}
+
+.settings-config-sync-alert-details > pre {
+ max-height: 120px;
+ margin: 6px 0 0;
+ padding: 8px 10px;
+ border-radius: var(--radius-sm);
+ background: var(--ds-tile-deep);
+ color: var(--ds-text-secondary);
+ font-size: var(--text-xs-plus);
+ line-height: var(--leading-body);
+ overflow: auto;
+ white-space: pre-wrap;
+ overflow-wrap: anywhere;
}
.settings-storage-path,
@@ -544,7 +606,7 @@
}
.settings-storage-message.error {
- color: var(--ds-danger);
+ color: var(--ds-error);
}
.settings-storage-confirmation {
diff --git a/apps/desktop/test/config-sync-settings.test.mjs b/apps/desktop/test/config-sync-settings.test.mjs
index 8ba3ec407..ba353b398 100644
--- a/apps/desktop/test/config-sync-settings.test.mjs
+++ b/apps/desktop/test/config-sync-settings.test.mjs
@@ -26,6 +26,9 @@ const api = await read("../src/lib/api.ts");
const progressModel = await read(
"../src/features/settings/config-sync-progress.ts",
);
+const syncError = await read(
+ "../src/components/settings/ConfigSyncError.tsx",
+);
test("cloud sync rendering follows the settings visibility gate", () => {
assert.match(settingsPage, /tab === "sync" && !tabHidden && <ConfigSyncPage \/>/);
@@ -184,3 +187,43 @@ test("a manual sync outlasts the flat default transport deadline", () => {
// Every other config-sync call keeps the shared default.
assert.equal(rpcTimeoutMs("configSync.getState", {}), DEFAULT_RPC_TIMEOUT_MS);
});
+
+test("a failed sync reads as one alert, not a stray paragraph", () => {
+ // The notice is the page's error summary: announced once, with the error
+ // signal carried by a single frame instead of an inline bold label.
+ assert.match(
+ syncError,
+ /className="settings-config-sync-alert" role="alert"/,
+ );
+ assert.match(syncError, /<IconTriangleAlert[\s\S]{0,120}size=\{16\}/);
+ assert.match(syncError, /className="settings-config-sync-alert-title"/);
+ assert.match(syncError, /className="settings-config-sync-alert-text"/);
+ // The raw host text stays opt-in behind the existing disclosure.
+ assert.match(syncError, /className="settings-config-sync-alert-details"/);
+ assert.match(
+ syncError,
+ /<summary>\{t\("settings\.configSync\.errorDetails"\)\}<\/summary>/,
+ );
+ assert.match(syncError, /<pre>\{message\}<\/pre>/);
+});
+
+test("the sync alert paints its surface from theme tokens", () => {
+ assert.match(
+ styles,
+ /\.settings-config-sync-alert \{[\s\S]*?border: 1px solid color-mix\(in srgb, var\(--ds-error\) 30%, transparent\);[\s\S]*?background: color-mix\(in srgb, var\(--ds-error\) 8%, transparent\);/s,
+ );
+ assert.match(styles, /\.settings-config-sync-alert-icon \{[\s\S]*?color: var\(--ds-error\);/s);
+ // The host text keeps its own plate so a long provider detail never widens
+ // the notice.
+ assert.match(
+ styles,
+ /\.settings-config-sync-alert-details > pre \{[\s\S]*?overflow-wrap: anywhere;/s,
+ );
+ // `--ds-danger` is defined by no theme, so the error ink it named silently
+ // fell back to inherited text. Settings errors resolve through `--ds-error`.
+ assert.doesNotMatch(styles, /var\(--ds-danger\)/);
+ assert.match(
+ styles,
+ /\.settings-storage-message\.error \{\n color: var\(--ds-error\);/,
+ );
+});