Skip to content

fix: prefer five-hour usage in composer indicator - #1201

Merged
wibus-wee merged 3 commits into
mainfrom
lody/2cac56a2-ad6
Oct 3, 2026
Merged

wibus-wee merged 3 commits into
mainfrom
lody/2cac56a2-ad6

Conversation

@wibus-wee

Copy link
Copy Markdown
Member

Related issue

Problem / pressure

When a provider reports weekly usage of 29% and five-hour usage of 11%, the composer shows 29% because its indicator reads the first window after the detail popover sorts by descending duration.

Summary

Select the five-hour window independently for the compact indicator. Keep the existing longest-window fallback, context/compacting priority, and detail order. Add behavioral regressions and the bilingual display Spec and decision note.

Visual explanation

Indicator:
  compacting → compacting state
  valid context → context percentage
  enabled subscription display → five-hour window, else longest valid window
  otherwise → hidden
Details:
  all valid windows → descending duration

Before / after

Before After
Weekly 29%, five-hour 11% → indicator 29% Indicator 11%; details remain weekly then five-hour
Weekly 29%, five-hour 0% → indicator 29% Indicator 0%
Only weekly usage, or valid context usage Existing fallback and context priority retained

Test plan

Validation used an independent clone with initialized ACP submodules because the authoring worktree has no dependencies.

  • Usage suites: 20 passed. Both new cases failed before the fix; coverage includes input order, zero usage, accessible text, detail order, weekly-only fallback, and context updates.
  • Repository typechecks, lint, pnpm format, i18n/import/platform/public-boundary guards, and pnpm run docs check --base 93545f01b: passed.
  • Electron tests: 199 passed.
  • pnpm check: stops at one existing component failure, boot-shell.test.tsx → “falls back to the mark alone when storage is unavailable”; 4592 component tests passed. Reproduced after restoring the original usage component on Node 26.10.0.
  • No manual application UI verification. Existing SessionUsagePopover/QuotaOnly story supplies both windows.

@wibus-wee
wibus-wee marked this pull request as ready for review October 1, 2026 14:45
@wibus-wee
wibus-wee marked this pull request as draft October 1, 2026 14:46
@wibus-wee
wibus-wee marked this pull request as ready for review October 1, 2026 14:46
@wibus-wee

Copy link
Copy Markdown
Member Author

@copilot refine note

Co-authored-by: wibus-wee <62133302+wibus-wee@users.noreply.github.com>

Copilot AI commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

@copilot refine note

Updated the bilingual note to clarify the reproduced baseline test failure and fixed the Chinese PR link spacing. Commit: 4934992.

@wibus-wee
wibus-wee merged commit 6d19a97 into main Oct 3, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants