Repository navigation
fix(quota): ignore stale quota readings for 0.9.6 - #33
Merged
Merged
Conversation
…imates Several Claude Code sessions write their own last-seen quota, so the seven-day percent briefly drops by 1-5 points within a cycle. Each drop was treated as an upstream reset, collapsing the weekly estimate to a tiny recent segment (e.g. $21 instead of ~$1,360). Small drops are now ignored, millisecond reset jitter stays in one cycle, and first arrivals of rounded integer percents count as k-0.5 so early estimates are not biased low. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
首页七天额度预估会突然跌到几十美元,例如已用 43%、本周期已花 $599.93 时预估只显示 $21.04。
同时开着多个 Claude Code 会话时,各会话会写入自己较早看到的额度,使同一周期内的百分比暂时回落 1 到 5 个点。旧算法把任何回落都当作上游重新计数,丢掉此前全部观测,只用回落后几分钟的消费外推整周额度。每个周期会出现 6 到 10 次,每次让预估在数小时内跌到几美元至几百美元。重置时间带毫秒抖动的快照也会被拆成单独周期。
周期初期还有系统性偏低。上游百分比四舍五入为整数,刚显示 1% 时实际约 0.5%,粗估在 1%、2%、3% 时分别低估约 45%、22%、14%。
改动
docs/reporting.md预估说明与 CHANGELOG,版本 0.9.6。验证
quotaView。截图时刻预估由 $21 变为 $1,360;此前每次回落后的 $6 至 $500 全部消失,曲线平滑。本周期 1% 至 7% 的预估由 776、1095、1202、1275、1312、1392 变为 1553、1565、1529、1475、1466、1445,与后期 1,360 至 1,500 一致。bun test tests437 通过,bun run typecheck、bun run build、Prettier 与git diff --check通过。🤖 Generated with Claude Code