From a90aadd202737ecc2e1124d9bc99c5007d63d6c7 Mon Sep 17 00:00:00 2001 From: yousiki <18757689+yousiki@users.noreply.github.com> Date: Mon, 27 Apr 2026 16:57:28 +0900 Subject: [PATCH] fix(cliproxy): tighten Codex window classification on incomplete metadata Apply Copilot review feedback on PR #1113: - getCodexWindowKind: require cadence alongside category; fall through to label sniffing when missing instead of silently defaulting to 5h. - getCodexWindowDisplayLabel (CLI): for category 'additional', fall back through featureLabel -> window.label -> 'Additional' so partial cached windows preserve user-visible context. --- src/commands/cliproxy/quota-subcommand.ts | 2 +- ui/src/lib/utils.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/cliproxy/quota-subcommand.ts b/src/commands/cliproxy/quota-subcommand.ts index 3466e1e7..567a3ccb 100644 --- a/src/commands/cliproxy/quota-subcommand.ts +++ b/src/commands/cliproxy/quota-subcommand.ts @@ -302,7 +302,7 @@ function getCodexWindowDisplayLabel( } if (window.category === 'additional') { - const pretty = prettifyCodexFeatureLabel(window.featureLabel || 'Additional'); + const pretty = prettifyCodexFeatureLabel(window.featureLabel || window.label || 'Additional'); if (window.cadence === '5h') return `${pretty} (5h)`; if (window.cadence === 'weekly') return `${pretty} (weekly)`; return pretty; diff --git a/ui/src/lib/utils.ts b/ui/src/lib/utils.ts index a05576a8..eacab42f 100644 --- a/ui/src/lib/utils.ts +++ b/ui/src/lib/utils.ts @@ -343,16 +343,16 @@ export type CodexWindowKind = export function getCodexWindowKind(labelOrWindow: string | CodexQuotaWindow): CodexWindowKind { if (typeof labelOrWindow === 'object' && labelOrWindow !== null) { const w = labelOrWindow; - if (w.category === 'additional') { + if (w.category === 'additional' && w.cadence) { return w.cadence === 'weekly' ? 'additional-weekly' : 'additional-5h'; } - if (w.category === 'code-review') { + if (w.category === 'code-review' && w.cadence) { return w.cadence === 'weekly' ? 'code-review-weekly' : 'code-review-5h'; } - if (w.category === 'usage') { + if (w.category === 'usage' && w.cadence) { return w.cadence === 'weekly' ? 'usage-weekly' : 'usage-5h'; } - // No category metadata -> fall through to label sniffing. + // Missing or incomplete category metadata -> fall through to label sniffing. return getCodexWindowKindFromLabel(w.label); } return getCodexWindowKindFromLabel(labelOrWindow);