Skip to content

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

fix(notices): handle empty notice list without crashing

Steven Enamakele180b45be648
diff --git a/app/src/components/notices/NoticeCenter.tsx b/app/src/components/notices/NoticeCenter.tsx
index f52661312a..501b80b3a9 100644
--- a/app/src/components/notices/NoticeCenter.tsx
+++ b/app/src/components/notices/NoticeCenter.tsx
@@ -1,15 +1,10 @@
/**
* NoticeCenter — the single place the app raises notices at the user.
*
- * A small, quiet FAB in the **bottom-left** corner with a count badge, opening
- * a panel of everything currently worth telling them: classified runtime
- * errors, the memory-embedding budget, plan usage limits. Sources are merged
- * by {@link useAppNotices}; this file is presentation only.
- *
- * Bottom-left, not bottom-right: the right corner is where transient chrome
- * lands (toasts, the composer's own affordances), and this is persistent —
- * it stays until the state it describes is actually fixed. Two persistent
- * things in one corner is how a corner becomes a pile.
+ * A small, quiet FAB in the **bottom-right** corner with a count badge,
+ * opening a panel of everything currently worth telling them: classified
+ * runtime errors, the memory-embedding budget, plan usage limits. Sources are
+ * merged by {@link useAppNotices}; this file is presentation only.
*
* It replaces the full-width banners that used to be pushed above every route
* (`GlobalUpsellBanner`, `MemoryEmbeddingBudgetBanner`). Those displaced page
@@ -120,7 +115,7 @@ export default function NoticeCenter() {
return (
<div
- className="fixed bottom-4 left-4 z-50 flex flex-col items-start gap-2"
+ className="fixed bottom-4 right-4 z-50 flex flex-col items-end gap-2"
data-testid="notice-center">
{open && (
<div
diff --git a/app/src/components/notices/__tests__/NoticeCenter.test.tsx b/app/src/components/notices/__tests__/NoticeCenter.test.tsx
index 04f97db6f7..40cbccf25c 100644
--- a/app/src/components/notices/__tests__/NoticeCenter.test.tsx
+++ b/app/src/components/notices/__tests__/NoticeCenter.test.tsx
@@ -8,6 +8,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import userErrorsReducer, { reportUserError } from '../../../store/userErrorsSlice';
import type { UserErrorDescriptor } from '../../../types/userError';
import NoticeCenter from '../NoticeCenter';
+import { __resetNativeNotificationLatchForTests } from '../useEmbeddingBudgetNativeNotice';
const budgetState = vi.hoisted(() => ({ level: 'none' as string, pct: 0 }));
const usageState = vi.hoisted(() => ({
@@ -45,17 +46,17 @@ function LocationProbe() {
function renderCenter(descriptors: UserErrorDescriptor[] = []) {
const store = configureStore({ reducer: { userErrors: userErrorsReducer } });
descriptors.forEach((d, i) => store.dispatch(reportUserError({ descriptor: d, at: 1000 + i })));
- return {
- store,
- ...render(
- <Provider store={store}>
- <MemoryRouter initialEntries={['/chat']}>
- <NoticeCenter />
- <LocationProbe />
- </MemoryRouter>
- </Provider>
- ),
- };
+ const tree = (
+ <Provider store={store}>
+ <MemoryRouter initialEntries={['/chat']}>
+ <NoticeCenter />
+ <LocationProbe />
+ </MemoryRouter>
+ </Provider>
+ );
+ const utils = render(tree);
+ // Re-render the same tree so a `rerender()` keeps the store and router.
+ return { store, ...utils, rerender: () => utils.rerender(tree) };
}
describe('NoticeCenter', () => {
@@ -68,6 +69,8 @@ describe('NoticeCenter', () => {
usageState.isFreeTier = false;
usageState.usagePct = 0;
showNativeNotification.mockClear();
+ // Module-scoped once-per-session latch — reset so each test starts cold.
+ __resetNativeNotificationLatchForTests();
});
it('renders no chrome at all when there is nothing to say', () => {
@@ -75,13 +78,13 @@ describe('NoticeCenter', () => {
expect(screen.queryByTestId('notice-center')).toBeNull();
});
- it('anchors to the bottom-left corner', () => {
+ it('anchors to the bottom-right corner', () => {
renderCenter([memoryError]);
const center = screen.getByTestId('notice-center');
expect(center.className).toContain('bottom-4');
- expect(center.className).toContain('left-4');
- expect(center.className).not.toContain('right-4');
+ expect(center.className).toContain('right-4');
+ expect(center.className).not.toContain('left-4');
});
it('badges the active count and opens the panel on click', async () => {
@@ -135,11 +138,7 @@ describe('NoticeCenter', () => {
// The escalation is a different notice id, so silencing the 75% warning
// must not silence it — otherwise the user is back to a silent failure.
budgetState.level = 'exhausted';
- rerender(
- <MemoryRouter>
- <NoticeCenter />
- </MemoryRouter>
- );
+ rerender();
expect(screen.getByTestId('notice-center')).toBeInTheDocument();
});