Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix: restore quota window history and align Home tab (#18326)

Arvin Xucd6700008035
diff --git a/packages/heterogeneous-agents/src/quota/quota.test.ts b/packages/heterogeneous-agents/src/quota/quota.test.ts
index 79d1a7c5097..ffc3356f0cc 100644
--- a/packages/heterogeneous-agents/src/quota/quota.test.ts
+++ b/packages/heterogeneous-agents/src/quota/quota.test.ts
@@ -174,6 +174,17 @@ describe('projectWindows', () => {
expect(fable.limitType).toBe('weekly_scoped');
});
+ it('folds sub-second reset jitter around a minute boundary into one window', () => {
+ const windows = projectWindows([
+ mk({ resetsAt: reset - 483, utilization: 20 }),
+ mk({ resetsAt: reset + 43, utilization: 40 }),
+ mk({ resetsAt: reset + 938, utilization: 60 }),
+ ]);
+
+ expect(windows).toHaveLength(1);
+ expect(windows[0]).toMatchObject({ peakUtilization: 60, resetsAt: reset });
+ });
+
it('ignores readings without a resetsAt', () => {
expect(projectWindows([mk({ resetsAt: null })])).toHaveLength(0);
});
diff --git a/packages/heterogeneous-agents/src/quota/windows.ts b/packages/heterogeneous-agents/src/quota/windows.ts
index ff49c18706f..72db6bc1bd7 100644
Binary files a/packages/heterogeneous-agents/src/quota/windows.ts and b/packages/heterogeneous-agents/src/quota/windows.ts differ
diff --git a/packages/model-bank/src/aiModels/__tests__/index.test.ts b/packages/model-bank/src/aiModels/__tests__/index.test.ts
index 42893ab99a8..6bbce3dc423 100644
--- a/packages/model-bank/src/aiModels/__tests__/index.test.ts
+++ b/packages/model-bank/src/aiModels/__tests__/index.test.ts
@@ -206,17 +206,15 @@ describe('Google rolling model aliases', () => {
it('tracks the current Flash and Flash-Lite model versions', () => {
const googleModels = LOBE_DEFAULT_MODEL_LIST.filter((model) => model.providerId === 'google');
const flashLatest = googleModels.find((model) => model.id === 'gemini-flash-latest');
- const flash = googleModels.find((model) => model.id === 'gemini-3.6-flash');
const flashLiteLatest = googleModels.find((model) => model.id === 'gemini-flash-lite-latest');
const flashLite = googleModels.find((model) => model.id === 'gemini-3.5-flash-lite');
expect(flashLatest).toEqual(
expect.objectContaining({
- description: 'Points to gemini-3.6-flash',
+ description: 'Points to gemini-3.7-flash',
knowledgeCutoff: '2026-03',
}),
);
- expect(flashLatest?.pricing).toEqual(flash?.pricing);
expect(flashLatest?.settings?.disabledParams).toEqual(['temperature', 'top_p']);
expect(flashLiteLatest).toEqual(
@@ -254,7 +252,7 @@ describe('Google Gemini 3.1 Flash Image models', () => {
type: 'image',
}),
expect.objectContaining({
- enabled: true,
+ enabled: false,
id: 'gemini-3.1-flash-image-preview',
releasedAt: '2026-02-26',
type: 'chat',
diff --git a/src/features/AgentQuotaCalendar/QuotaCalendarModal.tsx b/src/features/AgentQuotaCalendar/QuotaCalendarModal.tsx
index 65bb40a8d2b..aa7ae383031 100644
--- a/src/features/AgentQuotaCalendar/QuotaCalendarModal.tsx
+++ b/src/features/AgentQuotaCalendar/QuotaCalendarModal.tsx
@@ -1,6 +1,7 @@
'use client';
import type { QuotaLimitReading } from '@lobechat/heterogeneous-agents/quota';
+import { projectWindows } from '@lobechat/heterogeneous-agents/quota';
import { ActionIcon, Flexbox, Icon, Skeleton, Text, Tooltip } from '@lobehub/ui';
import { createModal, type ModalInstance, Segmented } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
@@ -293,7 +294,16 @@ interface NormalizedWindow extends QuotaWindowSpan {
seriesId: string;
}
-const normalizeWindows = (rows: WindowRow[]): NormalizedWindow[] =>
+interface WindowLike {
+ limitType: string;
+ peakUtilization: number;
+ rateLimitedAt: Date | number | string | null;
+ resetsAt: Date | number | string;
+ scopeKey: string;
+ windowStartAt: Date | number | string;
+}
+
+const normalizeWindows = (rows: WindowLike[]): NormalizedWindow[] =>
rows.map((row) => ({
peakUtilization: row.peakUtilization,
rateLimitedAt: toMs(row.rateLimitedAt),
@@ -756,20 +766,27 @@ const QuotaCalendar = memo<QuotaCalendarProps>(({ externalAccountId }) => {
[dailyBurn, dailySpend],
);
+ // Re-project the persisted snapshot series so historical windows remain
+ // available even when legacy millisecond-jitter rows exhaust getWindows' limit.
+ const historicalWindows = useMemo(
+ () => [...windows, ...normalizeWindows(projectWindows(readings))],
+ [readings, windows],
+ );
+
const chartWindow = useMemo(() => {
const live = currentWindow(readings, series, now);
if (live) return live;
- const past = windows.filter((w) => w.seriesId === seriesId(series));
+ const past = historicalWindows.filter((w) => w.seriesId === seriesId(series));
return past.length > 0 ? past.reduce((a, b) => (a.resetsAt > b.resetsAt ? a : b)) : null;
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [readings, series, windows]);
+ }, [historicalWindows, readings, series]);
const windowStats = useMemo(() => {
- const history = windows.filter((window) => window.seriesId === seriesId(series));
+ const history = historicalWindows.filter((window) => window.seriesId === seriesId(series));
return buildWindowStats(history, chartWindow, turns, now, series.type === 'session' ? 40 : 8);
// `now` is intentionally captured when the modal opens, matching chartWindow.
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [windows, chartWindow, turns, series]);
+ }, [historicalWindows, chartWindow, turns, series]);
// A 5-hour window resets several times a day, so a per-day reset badge would
// fire on every cell — only the weekly windows get one.
diff --git a/src/spa/router/desktopRouter.meta.desktop.test.ts b/src/spa/router/desktopRouter.meta.desktop.test.ts
index c59d09bc2c2..5bf83f82561 100644
--- a/src/spa/router/desktopRouter.meta.desktop.test.ts
+++ b/src/spa/router/desktopRouter.meta.desktop.test.ts
@@ -1,4 +1,4 @@
-import { ImageIcon, MessageSquarePlus } from 'lucide-react';
+import { HomeIcon, ImageIcon } from 'lucide-react';
import { describe, expect, it } from 'vitest';
import { matchRouteMeta } from '@/features/Electron/titlebar/TabBar/resolveRouteMeta';
@@ -14,7 +14,7 @@ describe('mainAreaMetaRoutes (Electron adapter)', () => {
it('uses Home for the personal Home tab and document title', () => {
const { static: staticMeta } = matchRouteMeta(mainAreaMetaRoutes, '/');
- expect(staticMeta.icon).toBe(MessageSquarePlus);
+ expect(staticMeta.icon).toBe(HomeIcon);
expect(staticMeta.tabTitleKey).toBe('navigation.home');
expect(staticMeta.titleKey).toBe('navigation.home');
});
diff --git a/src/spa/router/desktopRouter.shared.tsx b/src/spa/router/desktopRouter.shared.tsx
index 63a4ea1a76f..c5d8d065a3f 100644
--- a/src/spa/router/desktopRouter.shared.tsx
+++ b/src/spa/router/desktopRouter.shared.tsx
@@ -5,11 +5,11 @@ import {
FilePenIcon,
FilesIcon,
FileText,
+ HomeIcon,
Image,
ImageIcon,
LayoutPanelTopIcon,
LibraryBigIcon,
- MessageSquarePlus,
Mic2,
Settings,
ShapesIcon,
@@ -1245,7 +1245,7 @@ const createMainAreaChildrenDefinition = (options: MainAreaRouteOptions = {}): R
element: deferPlatformElement(options.createHomeElement),
handle: {
meta: routeMeta({
- icon: MessageSquarePlus,
+ icon: HomeIcon,
tabTitleKey: 'navigation.home',
titleKey: 'navigation.home',
}),