Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(upsell): remove duplicate upsell banner for memory embedding budget

Steven Enamakele2c756d712b2
diff --git a/app/src/App.tsx b/app/src/App.tsx
index 180486a5ca..7b837b57f4 100644
--- a/app/src/App.tsx
+++ b/app/src/App.tsx
@@ -30,7 +30,7 @@ import OpenhumanLinkModal from './components/OpenhumanLinkModal';
import PersistRehydrationScreen from './components/PersistRehydrationScreen';
import PttHotkeyManager from './components/PttHotkeyManager';
import SecurityBanner from './components/SecurityBanner';
-import UserErrorCenter from './components/userErrors/UserErrorCenter';
+import NoticeCenter from './components/notices/NoticeCenter';
import AppWalkthrough from './components/walkthrough/AppWalkthrough';
import { useNotchBootSync } from './hooks/useNotchBootSync';
import { I18nProvider } from './lib/i18n/I18nContext';
@@ -258,11 +258,11 @@ export function AppShellDesktop() {
)}
</div>
<OpenhumanLinkModal />
- {/* User-actionable runtime errors (#3931): a first-class panel for
- expected user states (insufficient BYO credits, managed-budget
- exhaustion). Mounted outside the routes so entries survive route
+ {/* Every notice the app raises, in one bottom-left FAB: classified
+ runtime errors (#3931), the memory-embedding budget (#5324), plan
+ usage limits. Mounted outside the routes so entries survive route
changes and background-job completion. */}
- <UserErrorCenter />
+ <NoticeCenter />
{/* Post-onboarding Joyride walkthrough — mounted here (outside routes) so
it persists across tab navigations. Joyride targets span Home + the
sidebar nav so it must stay mounted while the user moves between routes. */}
diff --git a/app/src/components/upsell/GlobalUpsellBanner.tsx b/app/src/components/upsell/GlobalUpsellBanner.tsx
deleted file mode 100644
index f620d5c140..0000000000
--- a/app/src/components/upsell/GlobalUpsellBanner.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-import { useUsageState } from '../../hooks/useUsageState';
-import { useT } from '../../lib/i18n/I18nContext';
-import { PRICING_URL } from '../../utils/links';
-import { openUrl } from '../../utils/openUrl';
-import UpsellBanner from './UpsellBanner';
-
-export default function GlobalUpsellBanner() {
- const { t } = useT();
- const { teamUsage, isLoading, isAtLimit, isNearLimit, isFreeTier, usagePct } = useUsageState();
-
- if (isLoading || !teamUsage) return null;
-
- if (isAtLimit) {
- return (
- <div className="relative z-20">
- <UpsellBanner
- variant="upgrade"
- title={t('upsell.global.limitTitle')}
- message={t('upsell.global.limitMessage')}
- ctaLabel={t('chat.upgrade')}
- rounded={false}
- onCtaClick={() => {
- void openUrl(PRICING_URL);
- }}
- />
- </div>
- );
- }
-
- if (isNearLimit && isFreeTier) {
- const pct = Math.round(usagePct * 100);
- return (
- <div className="relative z-20">
- <UpsellBanner
- variant="warning"
- title={t('upsell.global.nearLimitTitle')}
- message={t('upsell.global.nearLimitMessage').replace('{pct}', String(pct))}
- ctaLabel={t('chat.upgrade')}
- rounded={false}
- onCtaClick={() => {
- void openUrl(PRICING_URL);
- }}
- />
- </div>
- );
- }
-
- return null;
-}
diff --git a/app/src/components/upsell/MemoryEmbeddingBudgetBanner.tsx b/app/src/components/upsell/MemoryEmbeddingBudgetBanner.tsx
deleted file mode 100644
index e559d00bb8..0000000000
--- a/app/src/components/upsell/MemoryEmbeddingBudgetBanner.tsx
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * Memory-embedding budget banner (#5324).
- *
- * Shell-mounted beside {@link GlobalUpsellBanner}, so the warning reaches the
- * user on whatever screen they are on rather than waiting for them to open
- * Memory Tree settings — the failure mode this issue is about.
- *
- * Escalation, matching the issue's acceptance criteria:
- *
- * | Consumption | Behaviour |
- * | ----------- | ------------------------------------------------------ |
- * | ≥ 75% | dismissible warning — "set up local embeddings or …" |
- * | ≥ 90% | non-dismissible warning with the same CTA |
- * | exhausted | non-dismissible, and memory has already stopped growing |
- *
- * Dismissal is per-session and per-level on purpose: dismissing the 75%
- * warning must not also silence the 90% escalation, or the user is back to a
- * silent failure. It is deliberately not persisted — a warning that survives
- * a restart it no longer applies to is worse than one shown twice.
- *
- * The CTA deep-links to the embeddings configuration screen. It never asks
- * the user to know what an embedding is: the copy names the two fixes (local
- * Ollama, own API key) and the button takes them to the one screen where both
- * are done.
- */
-import { useEffect, useState } from 'react';
-import { useNavigate } from 'react-router-dom';
-
-import {
- type EmbeddingBudgetLevel,
- useEmbeddingBudgetState,
-} from '../../hooks/useEmbeddingBudgetState';
-import { useT } from '../../lib/i18n/I18nContext';
-import { showNativeNotification } from '../../lib/nativeNotifications/tauriBridge';
-import UpsellBanner from './UpsellBanner';
-
-/** Where both remediations (local Ollama, BYO key) are configured. */
-export const EMBEDDINGS_SETTINGS_ROUTE = '/connections?tab=embeddings';
-
-/** Only the early warning can be silenced; escalations cannot. */
-function isDismissible(level: EmbeddingBudgetLevel): boolean {
- return level === 'warn';
-}
-
-/**
- * Module-scoped so the OS notification fires at most once per app session.
- * The banner re-renders 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 default function MemoryEmbeddingBudgetBanner() {
- const { t } = useT();
- const navigate = useNavigate();
- const { level, pct } = useEmbeddingBudgetState();
- const [dismissedLevel, setDismissedLevel] = useState<EmbeddingBudgetLevel | null>(null);
-
- // Push an OS-level notification the first time the budget is actually spent.
- // The in-app banner and UserErrorCenter only reach a user who is looking at
- // the app; the whole point of this issue is that memory broke while nobody
- // was looking. Email is the backend's job (tracked separately) — this is the
- // client-side half.
- //
- // 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.
- 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]);
-
- if (level === 'none') return null;
- if (dismissedLevel === level) return null;
-
- const isExhausted = level === 'exhausted';
- const title = isExhausted ? t('memoryBudget.exhaustedTitle') : t('memoryBudget.approachingTitle');
- const message = isExhausted
- ? t('memoryBudget.exhaustedMessage')
- : t('memoryBudget.approachingMessage').replace('{pct}', String(pct));
-
- return (
- <div className="relative z-20" data-testid="memory-embedding-budget-banner">
- <UpsellBanner
- variant="warning"
- title={title}
- message={message}
- ctaLabel={t('memoryBudget.cta')}
- rounded={false}
- dismissible={isDismissible(level)}
- onDismiss={() => setDismissedLevel(level)}
- onCtaClick={() => {
- navigate(EMBEDDINGS_SETTINGS_ROUTE);
- }}
- />
- </div>
- );
-}
diff --git a/app/src/components/userErrors/UserErrorCenter.tsx b/app/src/components/userErrors/UserErrorCenter.tsx
deleted file mode 100644
index 1d7a0b6244..0000000000
--- a/app/src/components/userErrors/UserErrorCenter.tsx
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * UserErrorCenter (#3931)
- * -----------------------
- *
- * First-class, shell-mounted surface for user-actionable runtime errors. It is
- * rendered once in the desktop shell (outside the router) so entries stay
- * visible across route changes and after background/cron jobs finish — there is
- * no dependence on an active chat route.
- *
- * Notification affordance: while unresolved entries exist, a fixed trigger with
- * a count badge appears. Opening it reveals the panel; each entry shows a title,
- * one-line explanation, source + timestamp, recurrence count, a primary action
- * that deep-links to the relevant settings flow, and a dismiss control.
- *
- * Privacy: only translated copy (via i18n keys) and privacy-safe metadata are
- * shown — never raw provider responses, tokens, prompts, or PII.
- */
-import { useState } from 'react';
-import { useNavigate } from 'react-router-dom';
-
-import { useT } from '../../lib/i18n/I18nContext';
-import { useAppDispatch, useAppSelector } from '../../store/hooks';
-import { selectActiveUserErrors } from '../../store/userErrorsSelectors';
-import { dismissUserError, resolveUserError } from '../../store/userErrorsSlice';
-import type { UserActionableError, UserErrorAction } from '../../types/userError';
-
-/** Deep-link target for each primary action. `dismiss` has no route. */
-const ACTION_ROUTE: Record<Exclude<UserErrorAction, 'dismiss'>, string> = {
- open_billing: '/settings/billing',
- open_provider_settings: '/settings/llm',
- // #5324: both memory-embedding remediations (local Ollama, BYO key) live on
- // this one screen, so a single CTA covers them without the user needing to
- // know which one applies.
- open_embeddings_settings: '/connections?tab=embeddings',
-};
-
-/** i18n key for each primary action's button label. */
-const ACTION_LABEL_KEY: Record<Exclude<UserErrorAction, 'dismiss'>, string> = {
- open_billing: 'userErrors.action.openBilling',
- open_provider_settings: 'userErrors.action.openProviderSettings',
- open_embeddings_settings: 'userErrors.action.openEmbeddingsSettings',
-};
-
-// Wall-clock read for the resolve/dismiss timestamps. Defined at module scope
-// so the component body doesn't reference an impure function during render
-// (react-hooks/purity); the calls below run only from event handlers.
-const nowMs = (): number => Date.now();
-
-function UserErrorCenter() {
- const { t } = useT();
- const dispatch = useAppDispatch();
- const navigate = useNavigate();
- const active = useAppSelector(selectActiveUserErrors);
- const [open, setOpen] = useState(false);
-
- // Nothing to surface → render nothing at all (no idle chrome in the shell).
- if (active.length === 0) return null;
-
- const runAction = (entry: UserActionableError) => {
- if (entry.action !== 'dismiss') {
- navigate(ACTION_ROUTE[entry.action]);
- }
- dispatch(resolveUserError({ id: entry.id, at: nowMs() }));
- setOpen(false);
- };
-
- return (
- <div
- className="fixed bottom-4 right-4 z-50 flex flex-col items-end gap-2"
- data-testid="user-error-center">
- {open && (
- <div
- role="dialog"
- aria-label={t('userErrors.title')}
- data-testid="user-error-panel"
- className="w-80 max-w-[calc(100vw-2rem)] overflow-hidden rounded-xl border border-amber-300 bg-surface shadow-lg dark:border-amber-700">
- <div className="flex items-center justify-between border-b border-amber-200 px-3 py-2 dark:border-amber-800">
- <span className="text-sm font-semibold text-ink dark:text-content">
- {t('userErrors.title')}
- </span>
- <span className="rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-900 dark:bg-amber-900 dark:text-amber-100">
- {active.length}
- </span>
- </div>
-
- <ul className="max-h-96 divide-y divide-line-subtle overflow-auto dark:divide-neutral-800">
- {active.map(entry => (
- <li key={entry.id} className="px-3 py-2.5" data-testid="user-error-item">
- <p className="text-sm font-semibold text-ink dark:text-content">
- {t(entry.titleKey)}
- </p>
- <p className="mt-0.5 text-xs text-ink-soft dark:text-content-secondary">
- {t(entry.bodyKey)}
- </p>
- <p className="mt-1 text-[11px] text-content-muted">
- {t(`userErrors.scope.${entry.scope}`, entry.scope)}
- {' · '}
- {new Date(entry.lastSeenAt).toLocaleTimeString()}
- {entry.count > 1 ? ` · ×${entry.count}` : ''}
- </p>
- <div className="mt-2 flex items-center gap-2">
- {entry.action !== 'dismiss' && (
- <button
- type="button"
- data-testid="user-error-action"
- onClick={() => runAction(entry)}
- className="rounded-md bg-primary-500 px-2.5 py-1 text-xs font-medium text-content-inverted hover:bg-primary-600">
- {t(ACTION_LABEL_KEY[entry.action])}
- </button>
- )}
- <button
- type="button"
- data-testid="user-error-dismiss"
- onClick={() => dispatch(dismissUserError({ id: entry.id }))}
- className="rounded-md px-2.5 py-1 text-xs font-medium text-ink-soft hover:bg-surface-hover dark:text-content-secondary">
- {t('userErrors.dismiss')}
- </button>
- </div>
- </li>
- ))}
- </ul>
- </div>
- )}
-
- <button
- type="button"
- data-testid="user-error-trigger"
- aria-label={t('userErrors.title')}
- onClick={() => setOpen(o => !o)}
- className="relative flex h-11 w-11 items-center justify-center rounded-full border border-amber-300 bg-surface text-lg shadow-md hover:bg-amber-50 dark:border-amber-700 dark:hover:bg-surface-muted">
- <span aria-hidden>⚠️</span>
- <span
- data-testid="user-error-badge"
- className="absolute -right-1 -top-1 min-w-[18px] rounded-full bg-coral px-1 text-center text-[11px] font-bold leading-[18px] text-white">
- {active.length}
- </span>
- </button>
- </div>
- );
-}
-
-export default UserErrorCenter;