Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(ui): toast dedup + inline raw output for Test failures
cyh5d3dd7f0a83c
diff --git a/ui/src/components/settings/BackendTestPanel.tsx b/ui/src/components/settings/BackendTestPanel.tsxindex 443d375a2..a7039f034 100644--- a/ui/src/components/settings/BackendTestPanel.tsx+++ b/ui/src/components/settings/BackendTestPanel.tsx@@ -202,6 +202,22 @@ export const BackendTestPanel: React.FC<BackendTestPanelProps> = ({ backend }) =</p></div>)}++ {/* Failure detail block — surfaces the raw stderr / stdout snippet+ the backend captured ("detail" field) instead of pointing the+ user at a non-clickable toast. Previously the i18n copy said+ "click the toast to see raw output" but no such affordance+ existed. */}+ {lastResult && !lastResult.ok && lastResult.detail && (+ <details className="rounded-md border border-destructive/30 bg-destructive/[0.04] px-3 py-2 [&[open]>summary]:mb-2">+ <summary className="cursor-pointer font-mono text-[11px] uppercase tracking-wide text-destructive">+ {t('settings.backends.testConnectionRawOutputLabel')}+ </summary>+ <pre className="max-h-48 overflow-auto whitespace-pre-wrap break-all rounded bg-background px-3 py-2 font-mono text-[11px] leading-relaxed text-muted">+ {lastResult.detail}+ </pre>+ </details>+ )}</div>);};diff --git a/ui/src/context/ToastContext.tsx b/ui/src/context/ToastContext.tsxindex 9fa5c3312..bcd58dfa6 100644--- a/ui/src/context/ToastContext.tsx+++ b/ui/src/context/ToastContext.tsx@@ -1,4 +1,4 @@-import React, { createContext, useContext, useState, useCallback } from 'react';+import React, { createContext, useContext, useState, useCallback, useRef } from 'react';import { AlertTriangle, CheckCircle, XCircle, X } from 'lucide-react';type ToastType = 'success' | 'error' | 'warning';@@ -7,6 +7,11 @@ interface Toast {id: number;message: string;type: ToastType;+ // Counter of suppressed duplicates while this toast is on screen — when+ // the same message fires repeatedly (e.g. a polling component hammers a+ // 503-ing endpoint during a daemon restart) we coalesce instead of+ // stacking 5+ identical popups.+ repeats: number;}interface ToastContextType {@@ -17,16 +22,39 @@ const ToastContext = createContext<ToastContextType | null>(null);let toastId = 0;+// Dedupe window — within this many ms, an identical message replaces the+// existing toast's repeat counter instead of stacking a new toast.+const DEDUPE_WINDOW_MS = 4000;+export const ToastProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {const [toasts, setToasts] = useState<Toast[]>([]);+ // Ref so dedupe lookups don't rerender. Maps message -> {id, expiresAt}+ // for currently-visible toasts; we evict on auto-dismiss.+ const recentRef = useRef<Map<string, { id: number; expiresAt: number }>>(new Map());const showToast = useCallback((message: string, type: ToastType = 'success') => {+ // Coalesce duplicate messages from polling / retry loops. The user+ // sees one toast with a "(×N)" badge instead of a wall of identical+ // popups; this matters most for transient 503s during daemon restarts.+ const now = Date.now();+ const existing = recentRef.current.get(message);+ if (existing && existing.expiresAt > now) {+ setToasts((prev) =>+ prev.map((t) => (t.id === existing.id ? { ...t, repeats: t.repeats + 1, type } : t)),+ );+ return;+ }const id = ++toastId;- setToasts((prev) => [...prev, { id, message, type }]);-+ recentRef.current.set(message, { id, expiresAt: now + DEDUPE_WINDOW_MS });+ setToasts((prev) => [...prev, { id, message, type, repeats: 0 }]);+// Auto dismiss after 3 secondssetTimeout(() => {setToasts((prev) => prev.filter((t) => t.id !== id));+ // Best-effort cleanup of the dedupe map — the entry may have been+ // re-issued under a different id during the window.+ const tracked = recentRef.current.get(message);+ if (tracked && tracked.id === id) recentRef.current.delete(message);}, 3000);}, []);@@ -58,6 +86,11 @@ export const ToastProvider: React.FC<{ children: React.ReactNode }> = ({ childre<XCircle size={18} />)}<span className="text-sm font-medium">{toast.message}</span>+ {toast.repeats > 0 && (+ <span className="ml-1 rounded-full bg-current/15 px-1.5 py-0.5 text-[10px] font-semibold tabular-nums opacity-80">+ ×{toast.repeats + 1}+ </span>+ )}<buttononClick={() => dismissToast(toast.id)}className="ml-2 opacity-60 hover:opacity-100 transition-opacity"diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex 285ce587e..068ff9529 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -201,7 +201,8 @@"testFailureCliNotFound": "The backend CLI binary was not found. Check the Path on the runtime card.","testFailureSpawnFailed": "Could not launch the backend CLI: {{detail}}","testFailureTimedOut": "The CLI did not respond within the test timeout.",- "testFailureCliFailed": "The CLI exited with an error. Open the toast details for the raw output.",+ "testFailureCliFailed": "The CLI exited with an error. Expand the raw output below to see what it said.",+ "testConnectionRawOutputLabel": "Raw output","activeAuthOauth": "Active: OAuth","activeAuthApiKey": "Active: API Key","activeAuthNone": "Not signed in",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex 81ea61800..9c5ebe7c6 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -201,7 +201,8 @@"testFailureCliNotFound": "未找到后端 CLI 二进制。检查 Runtime 卡片上的路径。","testFailureSpawnFailed": "无法启动后端 CLI:{{detail}}","testFailureTimedOut": "CLI 在测试超时时间内没有响应。",- "testFailureCliFailed": "CLI 退出失败。点击 toast 查看原始输出。",+ "testFailureCliFailed": "CLI 退出失败。展开下方原始输出查看详情。",+ "testConnectionRawOutputLabel": "原始输出","activeAuthOauth": "当前:OAuth","activeAuthApiKey": "当前:API Key","activeAuthNone": "未登录",