Repository navigation
[PR] fix: panel "saved $" replay cost priced at input tier instead of cache-write tier (#4956) - #4963
ranxianglei wants to merge 6 commits into
Conversation
The live-price branch of savedUsdProfileForSummary fed the fold formulas w the INPUT rate while every other user of w (kernel cache-report, stamped profiles, registry priceProfileFromRow) uses the cache-WRITE rate: the panel understated the replay term (2.7*T vs contractual 3.45*T for Anthropic-type tiers) and the number jumped when a model left the registry, where the stamped branch already carried the write rate.
- live branch returns {w: cacheWrite, r: cacheRead, q: output}
- exposed rates/moneyRates gain additive optional i (input $/Mtok); the spend/miss/input-card faces that bill new content at input print i, not w (detail page, overview input card, miss-rate lines)
- labels ov.net_rates/ov.payback_rates reworded input->write (zh+en); ov.miss_rates takes ${i}
- removed the unreachable second branch of the rates construction (defined livePrice always implies defined usdProf)
- tests: expectations re-derived at the write tier; #3617 both gate legs pinned (cache_write present => w=3.75; absent => w falls back to input)
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7381-pr.4963.2b2ed39This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4963.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 —— 检索 open/closed issue 与 PR(「panel saved dollars replay cost price tier」「savedUsd cache write tier pricing」等失败签名),无同机制在途条目;本 PR 即 #4956 的唯一修复线。 标签: bug / scope/ui / p2(面板美元数字算错——缺陷、界面域、能用但数字失真,有绕行即忽略 $ 卡)。 已开始独立审核:已拉取分支 |
(ai: vllm-qwen/qwen3.8-27b) Review 结论:可合。 独立审核完成(未复读 #4956 线程结论),代码、测试、CI 全部亲自核验。 审核过程(独立重做)
结构化八问
收工判定:可合。 修到根因(生产错误 |
# Conflicts: # src/web/i18n.ts # src/web/sessions-data.ts # tests/billing-web.test.ts
(ai: vllm-qwen/qwen3.8-27b) Synced origin/master ( |
(ai: vllm-qwen/qwen3.8-27b) CI 修复完成,新头 cbb31bd 已推送(merge ci-fixes 进 PR 分支)。八问:
重跑结果(cbb31bd):
判定:本 PR 自身范围可合;剩余 2 红为继承性 master 环境 flake,非本 PR 变更引入,不阻塞本 PR 审查结论。auto-lane 2/2 已用完,不再自动重试;若下轮重跑这两个 Windows 片仍红,走 #4599 收敛。 |
(ai: vllm-qwen/qwen3.8-27b) Re-synced origin/master ( |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Wrap-up for this merge-guard round: synced origin/master ( |
(ai: vllm-qwen/qwen3.8-27b) CI 修复完成,新头 7afc599 已推送。本轮 4 个红分片(win22-1/2/4 + ubu22-3)全部是继承性 master 红/环境 flake,与本 PR 改动无关(本 PR 只动
判定:本 PR 自身范围可合;本轮 4 红均为继承性失败,修复已随 master 同步进入分支,等重跑验证。无需 owner 决策(无设计取舍),故不开 decision request。auto-lane 1/1 已用完;若重跑仍有 Windows flake 残留,按 CI 协调政策走 #4599 收敛(已留一行结论)。 |
(ai: vllm-qwen/qwen3.8-27b)
Closes #4956
What
The panel's money mirror (savedUsd / ≈$ cards / break-even turns) computed the fold re-upload at
(input−read)·Ton the live-price path, while every other user of the fold formula'swprices the cache-WRITE re-upload: kernelcomputeFoldEconomics(kernel/src/cache-report.ts), thesavedUsdFromFoldsdocstring (src/billing.ts), andpriceProfileFromRow(src/registry.ts). The stamped-profile branch of the very same function already carried the write rate — so Anthropic-type tiers (3 / 3.75 / 0.3 / 15 $/Mt) read the replay term as 2.7·T instead of the contractual 3.45·T (net savings overstated; the issue's ~28% is the ratio 3.45/2.7), and the number jumped whenever a model left the registry.Behavior changes (disclosed)
finalize()resolvescache_write ?? input, so w was already equal to input for them.WebSessionSummary.rates/WebOverview.moneyRatesgain an additive optional fieldi(input $/Mtok). Absent on stamped-only sessions (they have no input-priced face). Fleet uniformity now also requires agreeingivalues before printing the fleet-level rate line.ov.net_rates/ov.payback_ratessay write−read instead of input−read (zh+en);ov.miss_ratesprints${i}(input) instead of${w}. The detail-page input card and the overview input-token card now annotate the input tier fromiinstead ofw— they bill at input, so printing w there would have been a new mislabel introduced by this fix if left alone (third consumer the issue did not list).summaryOfwas unreachable — a defined livePrice always yields a defined usdProf, so its guard could never hold.Not changed (deliberate, different mechanism)
w ≡ 1×inputanchoring (user ratio convention, last-resort path for sessions with no resolvable price row).billing.prices(absolute $/Mt, wins over the models.dev snapshot);compress.priceProfileremains the dimensionless stamped-path profile. (The issue's 顺带确认, answered in-thread.)Tests
tests/billing-web.test.ts: expectations re-derived at the write tier; #3617 both gate legs pinned — positive leg: fixture row carries
cache_write: 3.75 ≠ input 3⇒ rates.w must be 3.75; negative leg: override row WITHOUT cache_write ⇒ w falls back to input (6). Targeted suites green locally (billing-web 7/7, billing-prices 10/10, typecheck + build clean); full regression = CI on this head.No config-surface change. No kernel/ change. No version bump.