From d3f86f5d16250d42c8c800bcb3393e334930da53 Mon Sep 17 00:00:00 2001 From: Aditya Vikram Singh <247195684+avs-io@users.noreply.github.com> Date: Wed, 19 Aug 2026 20:44:18 +0530 Subject: [PATCH 1/5] fix(models): alias bare MiMo 2.5 ids to the LiteLLM Xiaomi rows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hermes and token-plan sessions store mimo-v2.5-pro. The snapshot row is xiaomi/mimo-v2.5-pro. Same class as the existing mimo-v2-flash alias. No invented rate. Looking up the display name on the stripped leaf before following a pricing alias, so cline-pass/mimo-v2.5-pro cannot recurse strip → alias → last-segment forever. --- src/models.ts | 16 ++++++++++++---- tests/models.test.ts | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/models.ts b/src/models.ts index c0e6746f..1b910469 100644 --- a/src/models.ts +++ b/src/models.ts @@ -297,6 +297,10 @@ const BUILTIN_ALIASES: Record = { 'k3-agent': 'kimi-k3', 'k2d6-agent': 'kimi-k2p6', 'mimo-v2-flash': 'xiaomi/mimo-v2-flash', + // Hermes / Xiaomi token-plan sessions store the bare id. LiteLLM's row is + // namespaced. Same class as mimo-v2-flash above — do not invent a rate. + 'mimo-v2.5-pro': 'xiaomi/mimo-v2.5-pro', + 'mimo-v2.5': 'xiaomi/mimo-v2.5', 'kat-coder-pro-v1': 'kwaipilot/kat-coder-pro', // Cursor emits dot-version tier-last names plus tier/reasoning suffixes // that LiteLLM does not index (`-high`, `-low`, `-medium`, `-thinking`, @@ -983,13 +987,17 @@ function deriveClaudeShortName(canonical: string): string | undefined { export function getShortModelName(model: string): string { if (autoModelNames[model]) return autoModelNames[model] - const canonical = resolveAlias(getCanonicalName(model)) + const stripped = getCanonicalName(model) + // Pricing aliases may re-namespace a leaf (mimo-v2.5-pro → xiaomi/…). + // Display names live on the leaf. Look that up before following the alias + // or we recurse forever: strip → alias → last-segment → strip. + for (const [key, name] of SORTED_SHORT_NAMES) { + if (stripped === key || stripped.startsWith(key + '-')) return name + } + const canonical = resolveAlias(stripped) const claude = deriveClaudeShortName(canonical) if (claude) return claude for (const [key, name] of SORTED_SHORT_NAMES) { - // Match on a version boundary, not a bare prefix: an unlisted future minor - // (e.g. gpt-5.6) must NOT collapse into the base "gpt-5" entry — it should - // fall through to its raw id rather than show a wrong name/tier. if (canonical === key || canonical.startsWith(key + '-')) return name } // getCanonicalName only strips the leading provider prefix, so a raw diff --git a/tests/models.test.ts b/tests/models.test.ts index 3e2b1655..080dec4a 100644 --- a/tests/models.test.ts +++ b/tests/models.test.ts @@ -737,6 +737,8 @@ describe('provider pricing suffix variants', () => { describe('observed provider model aliases', () => { const cases: Array<[string, string]> = [ ['MiMo-V2-Flash', 'xiaomi/mimo-v2-flash'], + ['mimo-v2.5-pro', 'xiaomi/mimo-v2.5-pro'], + ['MiMo-v2.5-Pro', 'xiaomi/mimo-v2.5-pro'], ['KAT-Coder-Pro-V1', 'kwaipilot/kat-coder-pro'], // Kimi Code wires report bare `k3` in llm.request.model; it must price // through the kimi-k3 table entry, not fall through to $0. From d5ced78595d6196ef48d5af089c65f2f9ef8c30b Mon Sep 17 00:00:00 2001 From: Aditya Vikram Singh <247195684+avs-io@users.noreply.github.com> Date: Wed, 19 Aug 2026 21:10:33 +0530 Subject: [PATCH 2/5] fix(models): cycle-safe short names; keep user-alias display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extra High MERGE AFTER FIX on d3f86f5. mimo-v2.5 aliased to xiaomi/mimo-v2.5 then last-segment recursed forever. Looking up SHORT_NAMES before resolveAlias also froze user remaps of known ids (gpt-4o still displayed as GPT-4o). Follow user aliases first. Break strip→alias→leaf cycles. Do not invent a Kimi rate. Do not paper over this with a mimo-v2.5 SHORT_NAMES row. --- src/models.ts | 60 +++++++++++++++++++++++++++++--------------- tests/models.test.ts | 16 ++++++++++++ 2 files changed, 56 insertions(+), 20 deletions(-) diff --git a/src/models.ts b/src/models.ts index 1b910469..907c2327 100644 --- a/src/models.ts +++ b/src/models.ts @@ -985,32 +985,52 @@ function deriveClaudeShortName(canonical: string): string | undefined { return `${CLAUDE_FAMILY[family]} ${major}${minor ? `.${minor}` : ''}` } -export function getShortModelName(model: string): string { - if (autoModelNames[model]) return autoModelNames[model] - const stripped = getCanonicalName(model) - // Pricing aliases may re-namespace a leaf (mimo-v2.5-pro → xiaomi/…). - // Display names live on the leaf. Look that up before following the alias - // or we recurse forever: strip → alias → last-segment → strip. - for (const [key, name] of SORTED_SHORT_NAMES) { - if (stripped === key || stripped.startsWith(key + '-')) return name - } - const canonical = resolveAlias(stripped) - const claude = deriveClaudeShortName(canonical) +function lookupShortName(id: string): string | undefined { + const claude = deriveClaudeShortName(id) if (claude) return claude for (const [key, name] of SORTED_SHORT_NAMES) { - if (canonical === key || canonical.startsWith(key + '-')) return name + if (id === key || id.startsWith(key + '-')) return name } - // getCanonicalName only strips the leading provider prefix, so a raw - // path-style id (e.g. accounts/fireworks/models/glm-5p2) still has slashes - // here. Take the last path segment and re-resolve it: the segment may itself - // be a known model slug (Fireworks fleet ids), earning a friendly name; a - // genuinely unmapped slug resolves to itself, preserving the raw-segment - // fallback for everything else. + return undefined +} + +export function getShortModelName(model: string, seen: Set = new Set()): string { + if (autoModelNames[model]) return autoModelNames[model] + if (seen.has(model)) { + const leaf = model.includes('/') ? model.slice(model.lastIndexOf('/') + 1) : model + return lookupShortName(leaf) ?? leaf + } + seen.add(model) + + // User aliases win over built-in display names. A remap of gpt-4o must + // show the target, not "GPT-4o". + if (Object.hasOwn(userAliases, model)) { + return getShortModelName(userAliases[model]!, seen) + } + + const stripped = getCanonicalName(model) + if (stripped !== model) { + if (Object.hasOwn(userAliases, stripped)) { + return getShortModelName(userAliases[stripped]!, seen) + } + const knownStripped = lookupShortName(stripped) + if (knownStripped && !Object.hasOwn(BUILTIN_ALIASES, stripped) && !Object.hasOwn(BUILTIN_ALIASES, stripped.toLowerCase())) { + return knownStripped + } + } + + const canonical = resolveAlias(stripped) + const known = lookupShortName(canonical) + if (known) return known + if (canonical.includes('/')) { const segment = canonical.slice(canonical.lastIndexOf('/') + 1) - return segment ? getShortModelName(segment) : canonical + if (!segment || seen.has(segment) || segment === stripped) { + return lookupShortName(segment) ?? segment + } + return getShortModelName(segment, seen) } - return canonical + return lookupShortName(canonical) ?? canonical } // Pricing is process-global state assembled at CLI startup from the cached diff --git a/tests/models.test.ts b/tests/models.test.ts index 080dec4a..2c81f74f 100644 --- a/tests/models.test.ts +++ b/tests/models.test.ts @@ -310,6 +310,13 @@ describe('user aliases via setModelAliases', () => { expect(getModelCosts('anthropic--claude-4.6-opus')).toEqual(getModelCosts('claude-sonnet-4-5')) }) + it('user alias whose source already has a short name displays the target', () => { + setModelAliases({ 'gpt-4o': 'claude-opus-4-6' }) + expect(getModelCosts('gpt-4o')).toEqual(getModelCosts('claude-opus-4-6')) + expect(getShortModelName('gpt-4o')).toBe('Opus 4.6') + setModelAliases({}) + }) + it('resetting aliases restores builtins', () => { setModelAliases({ 'anthropic--claude-4.6-opus': 'claude-sonnet-4-5' }) setModelAliases({}) @@ -739,6 +746,8 @@ describe('observed provider model aliases', () => { ['MiMo-V2-Flash', 'xiaomi/mimo-v2-flash'], ['mimo-v2.5-pro', 'xiaomi/mimo-v2.5-pro'], ['MiMo-v2.5-Pro', 'xiaomi/mimo-v2.5-pro'], + ['mimo-v2.5', 'xiaomi/mimo-v2.5'], + ['MiMo-v2.5', 'xiaomi/mimo-v2.5'], ['KAT-Coder-Pro-V1', 'kwaipilot/kat-coder-pro'], // Kimi Code wires report bare `k3` in llm.request.model; it must price // through the kimi-k3 table entry, not fall through to $0. @@ -760,6 +769,13 @@ describe('observed provider model aliases', () => { expect(getShortModelName('k3')).toBe('Kimi K3') }) + it('does not recurse on vendor-requalified MiMo aliases', () => { + expect(getShortModelName('mimo-v2.5')).toBe('mimo-v2.5') + expect(getShortModelName('MiMo-v2.5')).toBe('mimo-v2.5') + expect(getShortModelName('cline-pass/mimo-v2.5')).toBe('mimo-v2.5') + expect(getShortModelName('cline-pass/mimo-v2.5-pro')).toBe('MiMo v2.5 Pro') + }) + it('does not map dated Qwen3 Max to a reseller price without provider context', () => { expect(getModelCosts('qwen3-max-2026-01-23')).toBeNull() expect(calculateCost('qwen3-max-2026-01-23', 1_000_000, 1_000_000, 0, 0, 0)).toBe(0) From 827a41241cbf77ec8501ae19f9e3ec6b8d33148f Mon Sep 17 00:00:00 2001 From: Aditya Vikram Singh <247195684+avs-io@users.noreply.github.com> Date: Wed, 19 Aug 2026 21:27:13 +0530 Subject: [PATCH 3/5] fix(models): keep getShortModelName unary for Array.map CI typecheck failed: sessions-report maps getShortModelName, and the Extra High cycle Set was a second parameter. Array.map fed the index as `seen`. Cycle tracking stays on an internal helper. Display and alias behavior unchanged. No second Extra High. --- src/models.ts | 13 +++++++++---- tests/models.test.ts | 8 ++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/models.ts b/src/models.ts index 907c2327..d429ab47 100644 --- a/src/models.ts +++ b/src/models.ts @@ -994,7 +994,12 @@ function lookupShortName(id: string): string | undefined { return undefined } -export function getShortModelName(model: string, seen: Set = new Set()): string { +// Public API stays unary so Array.map/forEach cannot feed index as cycle state. +export function getShortModelName(model: string): string { + return shortModelName(model, new Set()) +} + +function shortModelName(model: string, seen: Set): string { if (autoModelNames[model]) return autoModelNames[model] if (seen.has(model)) { const leaf = model.includes('/') ? model.slice(model.lastIndexOf('/') + 1) : model @@ -1005,13 +1010,13 @@ export function getShortModelName(model: string, seen: Set = new Set()): // User aliases win over built-in display names. A remap of gpt-4o must // show the target, not "GPT-4o". if (Object.hasOwn(userAliases, model)) { - return getShortModelName(userAliases[model]!, seen) + return shortModelName(userAliases[model]!, seen) } const stripped = getCanonicalName(model) if (stripped !== model) { if (Object.hasOwn(userAliases, stripped)) { - return getShortModelName(userAliases[stripped]!, seen) + return shortModelName(userAliases[stripped]!, seen) } const knownStripped = lookupShortName(stripped) if (knownStripped && !Object.hasOwn(BUILTIN_ALIASES, stripped) && !Object.hasOwn(BUILTIN_ALIASES, stripped.toLowerCase())) { @@ -1028,7 +1033,7 @@ export function getShortModelName(model: string, seen: Set = new Set()): if (!segment || seen.has(segment) || segment === stripped) { return lookupShortName(segment) ?? segment } - return getShortModelName(segment, seen) + return shortModelName(segment, seen) } return lookupShortName(canonical) ?? canonical } diff --git a/tests/models.test.ts b/tests/models.test.ts index 2c81f74f..44461252 100644 --- a/tests/models.test.ts +++ b/tests/models.test.ts @@ -776,6 +776,14 @@ describe('observed provider model aliases', () => { expect(getShortModelName('cline-pass/mimo-v2.5-pro')).toBe('MiMo v2.5 Pro') }) + it('stays unary so Array.map cannot feed the index as cycle state', () => { + expect(['mimo-v2.5', 'gpt-4o', 'cline-pass/mimo-v2.5-pro'].map(getShortModelName)).toEqual([ + 'mimo-v2.5', + 'GPT-4o', + 'MiMo v2.5 Pro', + ]) + }) + it('does not map dated Qwen3 Max to a reseller price without provider context', () => { expect(getModelCosts('qwen3-max-2026-01-23')).toBeNull() expect(calculateCost('qwen3-max-2026-01-23', 1_000_000, 1_000_000, 0, 0, 0)).toBe(0) From ef040a4c4d1a0fc11758a6b7a24a1726492bd7a6 Mon Sep 17 00:00:00 2001 From: iamtoruk Date: Wed, 19 Aug 2026 11:26:22 -0700 Subject: [PATCH 4/5] test(models): pin the shipped MiMo v2 Flash crash; name the base 2.5 row The `mimo-v2-flash -> xiaomi/mimo-v2-flash` alias shipped before this branch and already cycled through display-name resolution, so getShortModelName threw RangeError on every real MiMo v2 Flash session. The new cycle-safe resolver fixes it, but nothing pinned the ids that actually crashed in production: cover the four spellings found in a real session cache, including the unnamespaced `mimo/mimo-v2-flash`. Add the base `mimo-v2.5` display name so the row reads next to "MiMo v2.5 Pro" instead of showing a raw slug; SORTED_SHORT_NAMES is longest-first, so the Pro tier still wins its own entry. --- CHANGELOG.md | 1 + src/models.ts | 1 + tests/models.test.ts | 26 ++++++++++++++++++++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bee3bad..37e4ed57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - **The resident `codeburn serve` child.** The first real panel request is also the cache warm-up, so startup never runs an artificial warm-up query beside a duplicate one-shot child; each served command carries its own read-only option allowlist, and anything outside it falls back to a normal spawn; the child exits when its stdin closes, so it can never outlive the app. Requests whose response exceeds the 16 MiB frame limit still replace the child, but that deliberate kill no longer spends the resident's unexpected-death budget. (#972) ### Fixed +- **MiMo sessions price from the LiteLLM Xiaomi rows, and MiMo v2 Flash no longer crashes the display path.** Hermes / Xiaomi token-plan sessions store the bare id (`mimo-v2.5-pro`, `mimo-v2.5`) while LiteLLM namespaces its row (`xiaomi/…`), so those models reported $0. They now alias to the existing snapshot rows — no invented rate, and `kimi-k3` still has none — which means a session Hermes left costless is priced from the shared tables and carries the estimated marker, exactly as `mimo-v2-flash` already did. The same change fixes a **pre-existing** crash that this alias did not introduce: the shipped `mimo-v2-flash -> xiaomi/mimo-v2-flash` alias already cycled through display-name resolution — strip the namespace, alias it back, take the leaf, repeat — so `getShortModelName` blew the stack on any real MiMo v2 Flash session and took every surface that names a model down with it, the `models` table included. Display-name resolution is now cycle-safe, and the base `mimo-v2.5` row is named rather than shown as a raw slug. - **A date-ranged run no longer republishes the month shards it never read.** A scoped load leaves an out-of-range month on disk, so the files it holds have no visible cache entry and the reconcile re-parses them — re-deriving the entry the shard already stores. That re-parse marked the unloaded month dirty, and the save merged and republished it under a fresh nonce name on every single run, byte-identical content and all, so a repeated `codeburn status --format json` churned old months (on a real corpus: claude/2026-03, cursor/2026-02 and warp/2026-03 renamed every run) and left the retired shards for the sweeper. A merge into an unloaded month that neither adds, changes nor removes an entry now keeps the published shard, so unchanged months keep their names and their bytes. (#1032) - **`models` and `audit` no longer show two identical `Grok 4.5` rows.** `grok-4.5-build` — the Grok Build harness's variant id — fell into the `grok-4.5` display entry by prefix, and since rows bucket by model id, not display name, the two came out as visually identical rows with different numbers. The variant now shows as `Grok 4.5 (build)`. Display only: no id is rewritten and no cost moves. (#1029) - **An upgrade no longer loses history for days whose transcripts have only PARTLY aged out.** The never-lose contract carried a cached (day, provider) slice forward only when the re-derivation found NOTHING for it, but transcripts expire per FILE rather than per day: on a day whose sources are mostly gone, a handful of turns from surviving later files still bucket onto it, so the fresh slice came back non-empty but truncated and REPLACED the full cached one. On a real cache upgrading from the last shipped daily-cache version, 2026-07-16 fell from $1,685.17 / 12,530 calls to $385.44 / 560 calls, and 13 days lost $2,765.75, 19,209 calls and 520 sessions in total. A fresh slice now replaces a settled baseline slice only when it carries at least as many CALLS - the same or more evidence; fewer calls means the source set demonstrably lost data, and the baseline is kept whole. The comparison is on calls alone: cost and tokens are re-priced accounting on the same evidence, which is exactly what a legitimate re-derivation changes (the Grok accounting fix keeps its per-day calls and is unaffected), and session counts drift down by a few on days whose sources are entirely intact. Days inside a 7-day settle window stay authoritative - their session files are still on disk, so a shrink there is a real change rather than expiry. The trade-off is deliberate and matches the direction this cache has always chosen: a future fix that legitimately REDUCES calls on a settled day keeps the older, higher value until that day is re-derived at an equal or greater call count. The timezone-change re-derive gets the exact form of the same rule - what the fresh parse can no longer explain under the old bucketing is added on top of the fresh slice instead of being dropped - and the cross-file adoption union is unchanged, where the newer schema still wins per (day, provider). diff --git a/src/models.ts b/src/models.ts index d429ab47..616185e4 100644 --- a/src/models.ts +++ b/src/models.ts @@ -960,6 +960,7 @@ const SHORT_NAMES: Record = { // table, the same way it handles `accounts/fireworks/models/`. 'qwen3.7-max': 'Qwen 3.7 Max', 'mimo-v2.5-pro': 'MiMo v2.5 Pro', + 'mimo-v2.5': 'MiMo v2.5', // Both spellings occur in the wild: OpenRouter gap-filled keys are lowercase // slugs while sessions report the capitalized name (see the case-insensitive // pricing index above). SHORT_NAMES matching is case-sensitive, so map both. diff --git a/tests/models.test.ts b/tests/models.test.ts index 44461252..dbaf0183 100644 --- a/tests/models.test.ts +++ b/tests/models.test.ts @@ -770,15 +770,33 @@ describe('observed provider model aliases', () => { }) it('does not recurse on vendor-requalified MiMo aliases', () => { - expect(getShortModelName('mimo-v2.5')).toBe('mimo-v2.5') - expect(getShortModelName('MiMo-v2.5')).toBe('mimo-v2.5') - expect(getShortModelName('cline-pass/mimo-v2.5')).toBe('mimo-v2.5') + expect(getShortModelName('mimo-v2.5')).toBe('MiMo v2.5') + expect(getShortModelName('MiMo-v2.5')).toBe('MiMo v2.5') + expect(getShortModelName('cline-pass/mimo-v2.5')).toBe('MiMo v2.5') expect(getShortModelName('cline-pass/mimo-v2.5-pro')).toBe('MiMo v2.5 Pro') }) + // The `mimo-v2-flash -> xiaomi/mimo-v2-flash` alias shipped before this + // change and already cycled: strip the namespace, alias it back, take the + // leaf, repeat. Every display surface (overview's model table included) + // threw RangeError on a real MiMo v2 Flash session. Pin the shipped ids. + it('resolves the already-shipped MiMo v2 Flash alias without blowing the stack', () => { + for (const id of ['mimo-v2-flash', 'MiMo-V2-Flash', 'cline-pass/mimo-v2-flash', 'mimo/mimo-v2-flash']) { + expect(() => getShortModelName(id)).not.toThrow() + expect(getShortModelName(id)).toBe('mimo-v2-flash') + expect(getModelCosts(id)).toEqual(getModelCosts('xiaomi/mimo-v2-flash')) + } + }) + + it('names the base MiMo 2.5 row without swallowing the Pro tier', () => { + expect(getShortModelName('mimo-v2.5')).toBe('MiMo v2.5') + expect(getShortModelName('mimo-v2.5-pro')).toBe('MiMo v2.5 Pro') + expect(getModelCosts('mimo-v2.5')).not.toEqual(getModelCosts('mimo-v2.5-pro')) + }) + it('stays unary so Array.map cannot feed the index as cycle state', () => { expect(['mimo-v2.5', 'gpt-4o', 'cline-pass/mimo-v2.5-pro'].map(getShortModelName)).toEqual([ - 'mimo-v2.5', + 'MiMo v2.5', 'GPT-4o', 'MiMo v2.5 Pro', ]) From bb5b71dff1eb8be24c3b29769fe29fb922ffdc8e Mon Sep 17 00:00:00 2001 From: iamtoruk Date: Wed, 19 Aug 2026 11:33:13 -0700 Subject: [PATCH 5/5] feat(models): name the MiMo v2 Flash row It was the only MiMo row still rendering as its raw slug next to "MiMo v2.5" and "MiMo v2.5 Pro". SORTED_SHORT_NAMES is longest-first, so the two v2.5 entries keep their own labels. --- CHANGELOG.md | 2 +- src/models.ts | 1 + tests/models.test.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37e4ed57..0479fe82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,7 @@ - **The resident `codeburn serve` child.** The first real panel request is also the cache warm-up, so startup never runs an artificial warm-up query beside a duplicate one-shot child; each served command carries its own read-only option allowlist, and anything outside it falls back to a normal spawn; the child exits when its stdin closes, so it can never outlive the app. Requests whose response exceeds the 16 MiB frame limit still replace the child, but that deliberate kill no longer spends the resident's unexpected-death budget. (#972) ### Fixed -- **MiMo sessions price from the LiteLLM Xiaomi rows, and MiMo v2 Flash no longer crashes the display path.** Hermes / Xiaomi token-plan sessions store the bare id (`mimo-v2.5-pro`, `mimo-v2.5`) while LiteLLM namespaces its row (`xiaomi/…`), so those models reported $0. They now alias to the existing snapshot rows — no invented rate, and `kimi-k3` still has none — which means a session Hermes left costless is priced from the shared tables and carries the estimated marker, exactly as `mimo-v2-flash` already did. The same change fixes a **pre-existing** crash that this alias did not introduce: the shipped `mimo-v2-flash -> xiaomi/mimo-v2-flash` alias already cycled through display-name resolution — strip the namespace, alias it back, take the leaf, repeat — so `getShortModelName` blew the stack on any real MiMo v2 Flash session and took every surface that names a model down with it, the `models` table included. Display-name resolution is now cycle-safe, and the base `mimo-v2.5` row is named rather than shown as a raw slug. +- **MiMo sessions price from the LiteLLM Xiaomi rows, and MiMo v2 Flash no longer crashes the display path.** Hermes / Xiaomi token-plan sessions store the bare id (`mimo-v2.5-pro`, `mimo-v2.5`) while LiteLLM namespaces its row (`xiaomi/…`), so those models reported $0. They now alias to the existing snapshot rows — no invented rate, and `kimi-k3` still has none — which means a session Hermes left costless is priced from the shared tables and carries the estimated marker, exactly as `mimo-v2-flash` already did. The same change fixes a **pre-existing** crash that this alias did not introduce: the shipped `mimo-v2-flash -> xiaomi/mimo-v2-flash` alias already cycled through display-name resolution — strip the namespace, alias it back, take the leaf, repeat — so `getShortModelName` blew the stack on any real MiMo v2 Flash session and took every surface that names a model down with it, the `models` table included. Display-name resolution is now cycle-safe, and the `mimo-v2-flash` and `mimo-v2.5` rows are named rather than shown as raw slugs. - **A date-ranged run no longer republishes the month shards it never read.** A scoped load leaves an out-of-range month on disk, so the files it holds have no visible cache entry and the reconcile re-parses them — re-deriving the entry the shard already stores. That re-parse marked the unloaded month dirty, and the save merged and republished it under a fresh nonce name on every single run, byte-identical content and all, so a repeated `codeburn status --format json` churned old months (on a real corpus: claude/2026-03, cursor/2026-02 and warp/2026-03 renamed every run) and left the retired shards for the sweeper. A merge into an unloaded month that neither adds, changes nor removes an entry now keeps the published shard, so unchanged months keep their names and their bytes. (#1032) - **`models` and `audit` no longer show two identical `Grok 4.5` rows.** `grok-4.5-build` — the Grok Build harness's variant id — fell into the `grok-4.5` display entry by prefix, and since rows bucket by model id, not display name, the two came out as visually identical rows with different numbers. The variant now shows as `Grok 4.5 (build)`. Display only: no id is rewritten and no cost moves. (#1029) - **An upgrade no longer loses history for days whose transcripts have only PARTLY aged out.** The never-lose contract carried a cached (day, provider) slice forward only when the re-derivation found NOTHING for it, but transcripts expire per FILE rather than per day: on a day whose sources are mostly gone, a handful of turns from surviving later files still bucket onto it, so the fresh slice came back non-empty but truncated and REPLACED the full cached one. On a real cache upgrading from the last shipped daily-cache version, 2026-07-16 fell from $1,685.17 / 12,530 calls to $385.44 / 560 calls, and 13 days lost $2,765.75, 19,209 calls and 520 sessions in total. A fresh slice now replaces a settled baseline slice only when it carries at least as many CALLS - the same or more evidence; fewer calls means the source set demonstrably lost data, and the baseline is kept whole. The comparison is on calls alone: cost and tokens are re-priced accounting on the same evidence, which is exactly what a legitimate re-derivation changes (the Grok accounting fix keeps its per-day calls and is unaffected), and session counts drift down by a few on days whose sources are entirely intact. Days inside a 7-day settle window stay authoritative - their session files are still on disk, so a shrink there is a real change rather than expiry. The trade-off is deliberate and matches the direction this cache has always chosen: a future fix that legitimately REDUCES calls on a settled day keeps the older, higher value until that day is re-derived at an equal or greater call count. The timezone-change re-derive gets the exact form of the same rule - what the fresh parse can no longer explain under the old bucketing is added on top of the fresh slice instead of being dropped - and the cross-file adoption union is unchanged, where the newer schema still wins per (day, provider). diff --git a/src/models.ts b/src/models.ts index 616185e4..4413d084 100644 --- a/src/models.ts +++ b/src/models.ts @@ -961,6 +961,7 @@ const SHORT_NAMES: Record = { 'qwen3.7-max': 'Qwen 3.7 Max', 'mimo-v2.5-pro': 'MiMo v2.5 Pro', 'mimo-v2.5': 'MiMo v2.5', + 'mimo-v2-flash': 'MiMo v2 Flash', // Both spellings occur in the wild: OpenRouter gap-filled keys are lowercase // slugs while sessions report the capitalized name (see the case-insensitive // pricing index above). SHORT_NAMES matching is case-sensitive, so map both. diff --git a/tests/models.test.ts b/tests/models.test.ts index dbaf0183..6ec6d9d4 100644 --- a/tests/models.test.ts +++ b/tests/models.test.ts @@ -783,7 +783,7 @@ describe('observed provider model aliases', () => { it('resolves the already-shipped MiMo v2 Flash alias without blowing the stack', () => { for (const id of ['mimo-v2-flash', 'MiMo-V2-Flash', 'cline-pass/mimo-v2-flash', 'mimo/mimo-v2-flash']) { expect(() => getShortModelName(id)).not.toThrow() - expect(getShortModelName(id)).toBe('mimo-v2-flash') + expect(getShortModelName(id)).toBe('MiMo v2 Flash') expect(getModelCosts(id)).toEqual(getModelCosts('xiaomi/mimo-v2-flash')) } })