From 5396d5f097654e62776490e3b4ce2d09fb3e6b3c Mon Sep 17 00:00:00 2001 From: SSU-WEI HUANG Date: Tue, 28 Jul 2026 11:48:14 +0800 Subject: [PATCH] fix(web): only show Codex Fast badge for effective fast tier (#1007) --- .../AssistantChat/StatusBar.test.ts | 12 ++++++++++- .../components/AssistantChat/StatusBar.tsx | 21 ++++++------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/web/src/components/AssistantChat/StatusBar.test.ts b/web/src/components/AssistantChat/StatusBar.test.ts index 0a52dca5..5a46657d 100644 --- a/web/src/components/AssistantChat/StatusBar.test.ts +++ b/web/src/components/AssistantChat/StatusBar.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { shouldShowComposerStatusBar } from './StatusBar' +import { shouldShowCodexFastBadge, shouldShowComposerStatusBar } from './StatusBar' describe('shouldShowComposerStatusBar', () => { it('hides the composer status bar for Cursor sessions', () => { @@ -12,3 +12,13 @@ describe('shouldShowComposerStatusBar', () => { expect(shouldShowComposerStatusBar(null)).toBe(true) }) }) + +describe('shouldShowCodexFastBadge', () => { + it('uses only the effective service tier', () => { + expect(shouldShowCodexFastBadge('codex', undefined)).toBe(false) + expect(shouldShowCodexFastBadge('codex', 'standard')).toBe(false) + expect(shouldShowCodexFastBadge('codex', 'fast')).toBe(true) + expect(shouldShowCodexFastBadge('codex', 'priority')).toBe(true) + expect(shouldShowCodexFastBadge('claude', 'fast')).toBe(false) + }) +}) diff --git a/web/src/components/AssistantChat/StatusBar.tsx b/web/src/components/AssistantChat/StatusBar.tsx index 32582ef1..8942e0e8 100644 --- a/web/src/components/AssistantChat/StatusBar.tsx +++ b/web/src/components/AssistantChat/StatusBar.tsx @@ -125,14 +125,11 @@ function formatTokenCount(value: number): string { return String(value) } -function isCodexFastMode(model?: string | null, effort?: string | null): boolean { - const normalizedEffort = effort?.trim().toLowerCase() - if (normalizedEffort === 'none' || normalizedEffort === 'minimal' || normalizedEffort === 'low') { - return true - } - - const normalizedModel = model?.trim().toLowerCase() ?? '' - return normalizedModel.includes('mini') || normalizedModel.includes('fast') +export function shouldShowCodexFastBadge( + agentFlavor: string | null | undefined, + serviceTier: string | null | undefined +): boolean { + return agentFlavor === 'codex' && isFastServiceTier(serviceTier) } /** Cursor native ACP does not emit usage_update; hide the bar to avoid empty/misleading UI. */ @@ -210,13 +207,7 @@ export function StatusBar(props: { const codexReasoningLabel = shouldShowCodexReasoningLabel(props.agentFlavor) ? formatCodexReasoningLabel(props.modelReasoningEffort) : null - // Prefer the explicit service tier (the real Fast-mode toggle) when set; - // fall back to the effort/model heuristic only when the tier is unknown. - const codexFastMode = props.agentFlavor === 'codex' - ? (props.serviceTier != null - ? isFastServiceTier(props.serviceTier) - : isCodexFastMode(props.model, props.modelReasoningEffort)) - : false + const codexFastMode = shouldShowCodexFastBadge(props.agentFlavor, props.serviceTier) const goalLabel = props.agentFlavor === 'codex' && props.threadGoal ? props.threadGoal.status === 'active' ? 'goal'