Skip to content

Commit 8085826

Browse files
author
IM.codes
committed
Clear stale Codex quota usage display
1 parent 850c9e5 commit 8085826

5 files changed

Lines changed: 22 additions & 16 deletions

File tree

src/daemon/command-handler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,9 +1315,9 @@ async function handleSend(cmd: Record<string, unknown>, serverLink: ServerLink):
13151315
upsertSession({
13161316
...record,
13171317
modelDisplay: nextModel,
1318-
...(sdkDisplay.planLabel ? { planLabel: sdkDisplay.planLabel } : {}),
1319-
...(sdkDisplay.quotaLabel ? { quotaLabel: sdkDisplay.quotaLabel } : {}),
1320-
...(sdkDisplay.quotaUsageLabel ? { quotaUsageLabel: sdkDisplay.quotaUsageLabel } : {}),
1318+
planLabel: sdkDisplay.planLabel,
1319+
quotaLabel: sdkDisplay.quotaLabel,
1320+
quotaUsageLabel: sdkDisplay.quotaUsageLabel,
13211321
updatedAt: Date.now(),
13221322
});
13231323
await handleGetSessions(serverLink);

src/daemon/session-list.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ export async function buildSessionList(): Promise<SessionListItem[]> {
100100
}
101101
if (s.agentType === 'codex' || s.agentType === 'codex-sdk') {
102102
const hydrated: Partial<SessionRecord> = {
103-
...(codexRuntime?.planLabel ? { planLabel: codexRuntime.planLabel } : {}),
104-
...(codexRuntime?.quotaLabel ? { quotaLabel: codexRuntime.quotaLabel } : {}),
105-
...(codexRuntime?.quotaUsageLabel ? { quotaUsageLabel: codexRuntime.quotaUsageLabel } : {}),
103+
planLabel: codexRuntime?.planLabel,
104+
quotaLabel: codexRuntime?.quotaLabel,
105+
quotaUsageLabel: codexRuntime?.quotaUsageLabel,
106106
};
107107
if (hydrated.planLabel !== s.planLabel || hydrated.quotaLabel !== s.quotaLabel || hydrated.quotaUsageLabel != s.quotaUsageLabel) {
108108
upsertSession({ ...s, ...hydrated, updatedAt: Date.now() });

web/src/app.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,9 +1081,9 @@ export function App() {
10811081
qwenAuthLimit: s.qwenAuthLimit ?? existing?.qwenAuthLimit,
10821082
qwenAvailableModels: s.qwenAvailableModels ?? existing?.qwenAvailableModels,
10831083
modelDisplay: s.modelDisplay ?? existing?.modelDisplay,
1084-
planLabel: s.planLabel ?? existing?.planLabel,
1085-
quotaLabel: s.quotaLabel ?? existing?.quotaLabel,
1086-
quotaUsageLabel: s.quotaUsageLabel ?? existing?.quotaUsageLabel,
1084+
planLabel: s.planLabel,
1085+
quotaLabel: s.quotaLabel,
1086+
quotaUsageLabel: s.quotaUsageLabel,
10871087
};
10881088
}));
10891089
setSessionsLoaded(true);

web/src/components/SessionControls.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ export function SessionControls({ ws, activeSession, inputRef, onAfterAction, on
351351
const isTransport = activeSession?.runtimeType === 'transport';
352352
const isCodex = activeSession?.agentType === 'codex' || activeSession?.agentType === 'codex-sdk';
353353
const isQwen = activeSession?.agentType === 'qwen';
354+
const compactQuotaText = isCodex
355+
? (activeSession?.quotaLabel ?? '')
356+
: [activeSession?.quotaLabel, activeSession?.quotaUsageLabel].filter(Boolean).join(' · ');
354357
const qwenTier = getQwenAuthTier(activeSession?.qwenAuthType);
355358
const qwenTierLabel = qwenTier === QWEN_AUTH_TIERS.FREE
356359
? t('session.qwen_tier_free')
@@ -962,12 +965,12 @@ export function SessionControls({ ws, activeSession, inputRef, onAfterAction, on
962965
</div>
963966

964967
{/* Plan/quota badges — compact inline display left of model selector */}
965-
{(activeSession?.quotaLabel || activeSession?.quotaUsageLabel || activeSession?.planLabel) && (
968+
{(compactQuotaText || activeSession?.planLabel) && (
966969
<div class="session-ctx-wrap">
967-
{(activeSession.quotaLabel || activeSession.quotaUsageLabel) && (
968-
<span class="session-usage-quota-inline">{[activeSession.quotaLabel, activeSession.quotaUsageLabel].filter(Boolean).join(' · ')}</span>
970+
{compactQuotaText && (
971+
<span class="session-usage-quota-inline">{compactQuotaText}</span>
969972
)}
970-
{activeSession.planLabel && (
973+
{activeSession?.planLabel && (
971974
<span class="session-usage-quota-inline" style={{ color: '#93c5fd' }}>{activeSession.planLabel}</span>
972975
)}
973976
</div>

web/src/components/pinnedPanelTypes.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ function SubSessionContent({ panel, ctx }: { panel: PinnedPanel; ctx: PanelRende
4545
const isShell = liveSub.type === 'shell' || liveSub.type === 'script';
4646
const mode = pinnedViewMode ?? (isShell ? 'terminal' : 'chat');
4747
const modelDisplay = liveSub.modelDisplay ?? (liveSub.type === 'qwen' ? liveSub.qwenModel : undefined);
48+
const compactQuotaText = liveSub.type === 'codex' || liveSub.type === 'codex-sdk'
49+
? (liveSub.quotaLabel ?? '')
50+
: [liveSub.quotaLabel, liveSub.quotaUsageLabel].filter(Boolean).join(' · ');
4851

4952
return (
5053
<>
@@ -73,10 +76,10 @@ function SubSessionContent({ panel, ctx }: { panel: PinnedPanel; ctx: PanelRende
7376
statusText={statusText}
7477
/>
7578
)}
76-
{(liveSub.quotaLabel || liveSub.quotaUsageLabel || liveSub.planLabel) && (
79+
{(compactQuotaText || liveSub.planLabel) && (
7780
<div style={{ display: 'flex', gap: 6, alignItems: 'center', padding: '2px 8px', flexShrink: 0 }}>
78-
{(liveSub.quotaLabel || liveSub.quotaUsageLabel) && (
79-
<span class="session-usage-quota-inline">{[liveSub.quotaLabel, liveSub.quotaUsageLabel].filter(Boolean).join(' · ')}</span>
81+
{compactQuotaText && (
82+
<span class="session-usage-quota-inline">{compactQuotaText}</span>
8083
)}
8184
{liveSub.planLabel && (
8285
<span class="session-usage-quota-inline" style={{ color: '#93c5fd' }}>{liveSub.planLabel}</span>

0 commit comments

Comments
 (0)