The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(notices): correct budget notice for native embedding
Steven Enamakel9271008958c0
diff --git a/app/src/components/notices/NoticeCenter.tsx b/app/src/components/notices/NoticeCenter.tsxindex b1ac060876..f52661312a 100644--- a/app/src/components/notices/NoticeCenter.tsx+++ b/app/src/components/notices/NoticeCenter.tsx@@ -30,6 +30,7 @@ import { LuBell, LuInfo, LuTriangleAlert, LuX } from 'react-icons/lu';import { cn } from '../../lib/cn';import { useT } from '../../lib/i18n/I18nContext';import { Button } from '../ui';+import { useEmbeddingBudgetNativeNotice } from './useEmbeddingBudgetNativeNotice';import { type AppNotice, type NoticeSeverity, peakSeverity, useAppNotices } from './useAppNotices';/** Accent per severity — the badge fill and the row's leading icon. */@@ -89,6 +90,10 @@ export default function NoticeCenter() {const { t } = useT();const notices = useAppNotices();const [open, setOpen] = useState(false);+ // Reaches a user who is not looking at the app; deliberately independent of+ // whether this panel is open, or even rendered (the hook runs before the+ // empty-list early return below).+ useEmbeddingBudgetNativeNotice();const panelRef = useRef<HTMLDivElement | null>(null);// Close on Escape while the panel is open. A fixed overlay with no dismissaldiff --git a/app/src/components/notices/useEmbeddingBudgetNativeNotice.ts b/app/src/components/notices/useEmbeddingBudgetNativeNotice.tsnew file mode 100644index 0000000000..c533c7caa7--- /dev/null+++ b/app/src/components/notices/useEmbeddingBudgetNativeNotice.ts@@ -0,0 +1,43 @@+/**+ * OS-level notification for an exhausted memory-embedding budget (#5324).+ *+ * Separate from the in-app notice because it serves the opposite case: the+ * panel and the FAB only reach a user who is *looking* at the app, and the+ * failure this issue is about is memory silently stopping while nobody was.+ * Email is the backend's half; this is the client's.+ *+ * Fires only on `exhausted`, never on the 75%/90% warnings — those are not yet+ * a broken state, and an OS notification for them would be noise.+ */+import { useEffect } from 'react';++import { useEmbeddingBudgetState } from '../../hooks/useEmbeddingBudgetState';+import { useT } from '../../lib/i18n/I18nContext';+import { showNativeNotification } from '../../lib/nativeNotifications/tauriBridge';++/**+ * Module-scoped so the notification fires at most once per app session. The+ * budget state re-reads on every usage poll; without this the user would get a+ * notification every 60s, which trains them to mute the app.+ */+let nativeNotificationSent = false;++/** Test seam — resets the once-per-session latch. */+export function __resetNativeNotificationLatchForTests() {+ nativeNotificationSent = false;+}++export function useEmbeddingBudgetNativeNotice(): void {+ const { t } = useT();+ const { level } = useEmbeddingBudgetState();++ useEffect(() => {+ if (level !== 'exhausted' || nativeNotificationSent) return;+ nativeNotificationSent = true;+ void showNativeNotification({+ title: t('memoryBudget.exhaustedTitle'),+ body: t('memoryBudget.exhaustedMessage'),+ tag: 'memory-embedding-budget-exhausted',+ });+ }, [level, t]);+}