Skip to content

Commit 6ed6c18

Browse files
t3dotggclaude
andcommitted
fix(usage): sort filter selectors the same in every locale
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent d69ecf7 commit 6ed6c18

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎apps/server/src/usage/usageAggregation.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ const selectorKey = (selector: UsageModelSelector) =>
107107

108108
const canonicalSelectors = (selectors: readonly UsageModelSelector[]) =>
109109
[...new Map(selectors.map((selector) => [selectorKey(selector), selector]))]
110-
.sort(([a], [b]) => a.localeCompare(b))
110+
// Code-unit order, so servers in different locales echo the same form.
111+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
111112
.map(([, selector]) => selector);
112113

113114
/** Equal filters get one form, so they share scans and clients can compare echoed filters. */

‎docs/user/usage.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ To count only some models, or to leave some out, add `usageModelFilter` to the s
104104
`include` keeps only the listed models and `exclude` leaves the listed models out. `provider` is
105105
one of `claude`, `codex`, `cursor`, `grok`, `opencode`, `antigravity`, `pi`, or `muse`; omit it
106106
to match a model ID from any provider. If the setting is invalid, Usage ignores it and shows every
107-
model. Filters match the model ID your provider
108-
recorded, before **Map to** applies, so a model you leave out is not counted under its mapped
109-
name. Usage applies each environment's own filter. Remove the setting to show every model again.
107+
model. Use the model ID that Usage shows without **Map to**, such as a provider-prefixed ID for
108+
Pi. Filters apply before **Map to**, so a model you leave out is not counted under its mapped name.
109+
Usage applies each environment's own filter. Remove the setting to show every model again.
110110

111111
## Track subscription limits
112112

0 commit comments

Comments
 (0)