fix(codex): 修复 WebSocket 普通账号额度停滞 - #656
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: QUIET Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthrough本次变更调整 Codex WebSocket 额度窗口的解析、保留、匹配和去重规则。解析器现在按窗口周期及重置时间识别顶层账号窗口和附加窗口,并隔离损坏字段。被动快照测试覆盖跨重置周期更新、账户额度保护和窗口来源清理。WebSocket 会话测试覆盖窗口数量变化、复用会话刷新账号百分比,以及 Spark-only 事件。 Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The WebSocket quota updates keep account and named quota windows separate, with ambiguous updates safely ignored. No unresolved merge risk was identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6dcddb595e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: QUIET
Plan: Advanced
Run ID: 5bdacbb9-05d2-4821-bb48-dccd9c49dc67
📒 Files selected for processing (6)
internal/execution/cpa/websocket_quota_test.gointernal/subscription/passive_quota_flush.gointernal/subscription/passive_quota_websocket_test.gointernal/subscription/providers/codex/websocket_quota.gointernal/subscription/providers/codex/websocket_quota_test.gointernal/subscription/providers/observation/snapshot.go
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ff818b056
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: QUIET
Plan: Advanced
Run ID: 3dc90928-cbec-4525-9626-a0c57e389142
📒 Files selected for processing (4)
internal/subscription/passive_quota_flush.gointernal/subscription/passive_quota_websocket_test.gointernal/subscription/providers/codex/websocket_quota.gointernal/subscription/providers/codex/websocket_quota_test.go
Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.
关联 Issue / Related Issue
无
变更内容 / Change Content
Codex WebSocket 的顶层
rate_limits可能没有来源标识:普通模型请求返回账号额度,Spark 请求则可能重复附加额度。原实现丢弃无来源的顶层窗口,导致普通账号百分比停留在旧值。现在逐窗口比较同一事件中的顶层与全部附加额度。周期相同且原始
reset_at或同事件的reset_after_seconds对齐(允许 1 秒精度差)时,丢弃顶层副本;确实没有附加窗口,或能在共同时间基准下排除全部附加副本时,按兼容规则归属普通账号。缺少共同基准、周期损坏或副本判断冲突时跳过未知顶层;明确来源仍直接更新。来源比较不使用本地接收时间,已归属额度的展示时间仍支持相对倒计时换算。每个来源和窗口独立校验:用量损坏不会抹掉用于来源比较的原始时间信息,也不会阻断其他有效窗口。非额度事件先做轻量类型检查,只有额度事件完整解析。整个过程不新增上游请求、历史周期推断、账号缓存或配置;被动更新只更新唯一匹配的已有窗口,不创建或删除窗口。
验证:
make check,包含全量后端测试、Go vet、编译及前端静态检查与构建。自查清单 / Checklist
make check,或在说明中写明无法运行的原因和未验证范围。 / I ranmake check, or documented why it could not run and what remains unverified.