Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(ui): stop a card that cannot be activated from stacking a wall of identical warnings
rubenluetke10-beep083a0ab5056a
diff --git a/jarvis/ui/web/frontend/src/components/ToastLayer.tsx b/jarvis/ui/web/frontend/src/components/ToastLayer.tsxindex 4cfd49ccda..897847ed7f 100644--- a/jarvis/ui/web/frontend/src/components/ToastLayer.tsx+++ b/jarvis/ui/web/frontend/src/components/ToastLayer.tsx@@ -83,7 +83,24 @@ export function ToastLayer() {<Icon className={cn("mt-0.5 h-4 w-4 shrink-0", ACCENT_FOR_KIND[toast.kind])} />)}<div className="min-w-0 flex-1 text-xs leading-relaxed">- <div className="break-words">{toast.message}</div>+ <div className="flex items-start gap-2">+ <span className="min-w-0 flex-1 break-words">{toast.message}</span>+ {/* Repeats collapse into this counter instead of stacking a+ fresh box per click, which used to bury the control the+ message is asking the user to press. */}+ {toast.count > 1 && (+ <span+ data-testid={`toast-repeat-${toast.count}`}+ aria-label={`Repeated ${toast.count} times`}+ className={cn(+ "mt-px shrink-0 rounded-full border border-current/30 px-1.5 py-px text-[10px] font-semibold tabular-nums",+ ACCENT_FOR_KIND[toast.kind],+ )}+ >+ ×{toast.count}+ </span>+ )}+ </div>{draggable && (<div className="mt-1 text-[11px] font-medium text-primary/80">{t("file_toast.drag_hint")}diff --git a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsxindex 32ca02128e..05bb7a9541 100644--- a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx+++ b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.test.tsx@@ -845,3 +845,80 @@ describe("ProviderCard: ChatGPT subscription Realtime", () => {expect(screen.queryByText("Yes")).toBeNull();});});++/**+ * Regression guard for the stacked-notification wall (2026-08-04).+ *+ * A card the user cannot activate yet answers each click with one fixed+ * sentence. The card used to bind BOTH onClick and onDoubleClick to the same+ * handler, so a double click ran it three times (click, click, dblclick) and+ * two attempts left six identical toasts stacked over the connect button the+ * message points at. One gesture must produce at most one visible notice.+ */+describe("ProviderCard — an unavailable card does not build a warning wall", () => {+ beforeEach(() => {+ window.localStorage.clear();+ vi.restoreAllMocks();+ useI18nStore.getState().setUi("en", { push: false });+ useEventStore.setState({ toasts: [] });+ });++ afterEach(() => {+ cleanup();+ });++ function unconnectedSubscriptionCard(): ProviderDescriptor {+ return {+ ...dictationCard(),+ id: "codex-subscription-realtime",+ label: "ChatGPT subscription (Codex)",+ tier: "realtime",+ auth_mode: "codex",+ secret_keys: [],+ secrets_set: {},+ billing: "subscription",+ configured: false,+ optional: false,+ polish_family: null,+ codex_status: {+ installed: true,+ connected: false,+ mode: "not_connected",+ message: "The dedicated Codex voice profile has not been created yet.",+ reason_code: "login_required",+ },+ } as ProviderDescriptor;+ }++ it("raises ONE notice for a double click, not three", async () => {+ installFetchMock();+ renderCard(unconnectedSubscriptionCard());++ const title = screen.getByText("ChatGPT subscription (Codex)");+ // Exactly what a user does: a real double click delivers two click events+ // plus one dblclick. Only the clicks may reach the handler now.+ fireEvent.click(title);+ fireEvent.click(title);+ fireEvent.doubleClick(title);++ await waitFor(() =>+ expect(useEventStore.getState().toasts.length).toBeGreaterThan(0),+ );+ const { toasts } = useEventStore.getState();+ expect(toasts).toHaveLength(1);+ // Collapsed, and honest about how often it was raised.+ expect(toasts[0].count).toBe(2);+ });++ it("never activates a card whose login is still missing", async () => {+ const calls = installFetchMock();+ renderCard(unconnectedSubscriptionCard());++ fireEvent.click(screen.getByText("ChatGPT subscription (Codex)"));++ await waitFor(() =>+ expect(useEventStore.getState().toasts.length).toBe(1),+ );+ expect(calls.some((c) => c.url.includes("/api/realtime/switch"))).toBe(false);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsxindex e29a3c3688..5abebd883d 100644--- a/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx+++ b/jarvis/ui/web/frontend/src/components/providers/ProviderTierSection.tsx@@ -1010,7 +1010,13 @@ export function ProviderCard({}}- // A single click AND a double click on the card both activate the provider.+ // A click anywhere on the card activates the provider. There is deliberately+ // NO separate onDoubleClick: a double click already delivers two `click`+ // events, and binding both handlers made it fire activate() THREE times —+ // on a card that only answers with "connect this provider first", that meant+ // three identical warnings per double click (six after two), stacked into a+ // wall over the connect button itself.+ //// We explicitly filter clicks on interactive sub-elements (inputs, buttons,// links) so that a click into the password field or on the// "Replace"/trash icon does NOT accidentally trigger a switch. The radio@@ -1096,7 +1102,6 @@ export function ProviderCard({{consentDialog}<divonClick={handleCardActivate}- onDoubleClick={handleCardActivate}title={descriptor.active? t("apikeys_view.active_tooltip")@@ -1515,13 +1520,11 @@ export function ActiveControl({return (<label+ // The radio owns its own activation; letting the click bubble would run+ // the card handler for the same gesture and send a second API call.+ // (The card no longer binds onDoubleClick, so there is nothing else to+ // stop here.)onClick={(e) => e.stopPropagation()}- onDoubleClick={(e) => {- // A double click on the radio label must NOT also trigger the- // card's onDoubleClick — otherwise activate() would fire twice- // (idempotent, but sends two API calls).- e.stopPropagation();- }}className={cn("inline-flex shrink-0 select-none items-center gap-1.5 rounded-full border px-2.5 py-1.5 text-xs transition-colors focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2 focus-within:ring-offset-background",disabled ? "cursor-not-allowed" : "cursor-pointer",diff --git a/jarvis/ui/web/frontend/src/store/events.test.ts b/jarvis/ui/web/frontend/src/store/events.test.tsindex 9847f8a7bb..4c42b3df0a 100644--- a/jarvis/ui/web/frontend/src/store/events.test.ts+++ b/jarvis/ui/web/frontend/src/store/events.test.ts@@ -152,3 +152,64 @@ describe("reasoning trace (thinkingSteps / thinkingTraces)", () => {expect(useEventStore.getState().chatThinking).toBe(false);});});++/**+ * Regression guard for the stacked-notification wall (2026-08-04).+ *+ * A provider card answers a click it cannot honour with a fixed sentence+ * ("Connect your ChatGPT subscription to use this voice provider."). Every+ * click emitted a fresh toast, and the card bound BOTH onClick and+ * onDoubleClick, so one double click emitted three. Two attempts produced six+ * identical boxes stacked down the right edge — covering the connect button+ * the message was telling the user to press. Repeats must collapse into one+ * toast with a counter.+ */+describe("useEventStore.pushToast repeat collapsing", () => {+ beforeEach(() => {+ useEventStore.setState({ toasts: [] });+ });++ it("collapses an identical repeated notice into one counted toast", () => {+ const { pushToast } = useEventStore.getState();+ const line = "Connect your ChatGPT subscription to use this voice provider.";+ for (let i = 0; i < 6; i += 1) pushToast("warning", line);++ const { toasts } = useEventStore.getState();+ expect(toasts).toHaveLength(1);+ expect(toasts[0].count).toBe(6);+ expect(toasts[0].message).toBe(line);+ });++ it("keeps genuinely different notices apart", () => {+ const { pushToast } = useEventStore.getState();+ pushToast("warning", "Connect your ChatGPT subscription.");+ pushToast("warning", "OpenAI Realtime needs a key.");+ pushToast("error", "Connect your ChatGPT subscription.");++ const { toasts } = useEventStore.getState();+ expect(toasts).toHaveLength(3);+ expect(toasts.every((toast) => toast.count === 1)).toBe(true);+ });++ it("keeps two saved files as two toasts with their own actions", () => {+ const { pushToast } = useEventStore.getState();+ pushToast("success", "Saved", { filePath: "/tmp/a.md", filename: "a.md" });+ pushToast("success", "Saved", { filePath: "/tmp/b.md", filename: "b.md" });++ const { toasts } = useEventStore.getState();+ expect(toasts).toHaveLength(2);+ expect(toasts.map((toast) => toast.filePath)).toEqual([+ "/tmp/a.md",+ "/tmp/b.md",+ ]);+ });++ it("a repeat pushes the dismissal out instead of inheriting the first expiry", () => {+ const { pushToast } = useEventStore.getState();+ pushToast("info", "still here");+ const first = useEventStore.getState().toasts[0].expiresAt;+ pushToast("info", "still here");+ const refreshed = useEventStore.getState().toasts[0].expiresAt;+ expect(refreshed).toBeGreaterThanOrEqual(first);+ });+});diff --git a/jarvis/ui/web/frontend/src/store/events.ts b/jarvis/ui/web/frontend/src/store/events.tsindex 557d8f2bf4..522f111eb9 100644--- a/jarvis/ui/web/frontend/src/store/events.ts+++ b/jarvis/ui/web/frontend/src/store/events.ts@@ -168,6 +168,19 @@ export interface Toast {kind: "info" | "success" | "warning" | "error";message: string;ts: number;+ /**+ * How often this identical notice was raised while it was already on screen.+ * Repeats COLLAPSE into one toast carrying this counter instead of stacking:+ * a provider card that answers every click with the same "connect this first"+ * line used to build a six-high wall of identical boxes covering the very+ * button that resolves it.+ */+ count: number;+ /**+ * Wall-clock ms at which this toast auto-dismisses. A repeat pushes it out,+ * so the expiry timer must re-check it rather than firing blindly.+ */+ expiresAt: number;/*** Absolute path of a file that was just saved to the user's Downloads. When* set (desktop only), the toast renders "Show in folder" / "Open" actions and@@ -369,6 +382,27 @@ const TOAST_FILE_TTL_MS = 12000;// map so a long session cannot grow it unbounded (insertion order = age).const MAX_TRACES = 24;+/**+ * Arm the auto-dismiss timer for one toast.+ *+ * A repeat refreshes ``expiresAt`` and arms a NEW timer, so an older timer must+ * not dismiss a toast that has since been pushed out — it re-checks the expiry+ * and lets the newest timer own the removal. Without that check, the second of+ * two rapid repeats would vanish after the FIRST one's remaining time.+ */+function scheduleToastExpiry(+ get: () => EventStore,+ id: string,+ ttl: number,+): void {+ setTimeout(() => {+ const toast = get().toasts.find((candidate) => candidate.id === id);+ if (!toast) return;+ if (toast.expiresAt > Date.now()) return;+ get().dismissToast(id);+ }, ttl);+}+export const useEventStore = create<EventStore>((set, get) => ({events: [],voiceState: "idle",@@ -419,18 +453,52 @@ export const useEventStore = create<EventStore>((set, get) => ({set({ transcription: text, transcriptionFinal: isFinal }),pushToast: (kind, message, opts) => {- const id = `toast-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;const filePath = opts?.filePath;+ const ttl = filePath ? TOAST_FILE_TTL_MS : TOAST_TTL_MS;+ const now = Date.now();+ const expiresAt = now + ttl;++ // Collapse a repeat of a notice that is still on screen. Every surface that+ // answers a click with a fixed sentence ("connect this provider first") can+ // otherwise emit it once per click — and a double click on a card emits it+ // twice more — until the stack buries the control the user needs to press.+ // File toasts are matched on their path too, so two different saved files+ // stay two separate toasts with their own actions.+ const existing = get().toasts.find(+ (toast) =>+ toast.kind === kind &&+ toast.message === message &&+ toast.filePath === filePath,+ );+ if (existing) {+ set((state) => ({+ toasts: state.toasts.map((toast) =>+ toast.id === existing.id+ ? { ...toast, count: toast.count + 1, ts: now, expiresAt }+ : toast,+ ),+ }));+ scheduleToastExpiry(get, existing.id, ttl);+ return;+ }++ const id = `toast-${now}-${Math.random().toString(36).slice(2, 7)}`;set((state) => ({toasts: [...state.toasts,- { id, kind, message, ts: Date.now(), filePath, filename: opts?.filename },+ {+ id,+ kind,+ message,+ ts: now,+ count: 1,+ expiresAt,+ filePath,+ filename: opts?.filename,+ },],}));- setTimeout(- () => get().dismissToast(id),- filePath ? TOAST_FILE_TTL_MS : TOAST_TTL_MS,- );+ scheduleToastExpiry(get, id, ttl);},dismissToast: (id) =>