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.
This commit is contained in:
yousiki
2026-04-27 16:57:28 +09:00
parent 725d95b0d2
commit a90aadd202
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -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;
+4 -4
View File
@@ -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);