Skip to content

fix: 处理轮换时间不变时的额度回升 - #7

Merged
DuskLin merged 1 commit into
mainfrom
codex/quota-renewal-baseline
Sep 23, 2026
Merged

DuskLin merged 1 commit into
mainfrom
codex/quota-renewal-baseline

Conversation

@DuskLin

@DuskLin DuskLin commented Sep 23, 2026

Copy link
Copy Markdown
Owner

订阅续期可能让额度回升,但上游的 5h/7D 重置时间仍保持不变。原估算会继续累计续期前的请求金额,导致后续总额和可用金额偏高。

本次按同一账号、同一窗口、同一重置时间下的额度回升建立新的用量基线,并持久化观测以支持重启恢复。满额观测也会建立基线;若轮询时新额度已经部分消耗,则按基线之后的用量比例差值估算。金额与缓存命中率使用一致的时间边界,上游轮换时间保持原值,旧后台任务不会覆盖新结果。

检测依据是额度变化,并非订阅事件;上游用量修正也可能触发,轮询间发生但未表现为额度回升的续期无法识别。

验证:

  • 23 项额度估算、后台统计和请求历史相关测试通过,覆盖满额恢复、部分消耗、跨边界请求、重启、账号及窗口隔离、自然轮换和后台任务竞争。
  • npm run typecheck 通过。
  • git diff --check 通过。

@DuskLin
DuskLin merged commit 2424b72 into main Sep 23, 2026
5 checks passed
@DuskLin
DuskLin deleted the codex/quota-renewal-baseline branch September 23, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant