Repository navigation
Conversation
ViceEye
marked this pull request as draft
October 3, 2026 13:22
ViceEye
force-pushed
the
codex/fix-hybrid-quota-native
branch
3 times, most recently
from
October 4, 2026 12:25
45f36fe to
f7f3c5e
Compare
Owner
|
2026-10-08 当前仍Draft且launcher与c07a337d冲突。正文的协议原生方案与实际CDP独立Query缓存注入不符,请更新正文与实际验证,补断线重连、启动后模式切换、退出清理和官登恢复,再rebase评审。当前head构建通过不能证明无注入或长期持续生效。 |
ViceEye
force-pushed
the
codex/fix-hybrid-quota-native
branch
from
October 8, 2026 11:18
f7f3c5e to
6eb87d0
Compare
ViceEye
force-pushed
the
codex/fix-hybrid-quota-native
branch
from
October 8, 2026 13:20
51ba812 to
31bdafd
Compare
Contributor
Author
已按建议进行完整重构并重新 Rebase:
|
ViceEye
marked this pull request as ready for review
October 8, 2026 13:56
…ota-native # Conflicts: # crates/codex-plus-core/src/launcher.rs
This branch has not been deployed
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.
问题
在未启用增强模式(
enhancementsEnabled: false)的独立场景下,启用「官方登录 + 混入 API Key」时,官方账户订阅额度耗尽仍会导致发送功能被阻塞。此前 PR #2286 使用的源码定位与条件断点方案,在面对官方客户端打包结构和变量名混淆变动时容易因锚点缺失失效;且之前尝试修改
chatgpt_base_url的协议层反代会破坏官方 OAuth 2.0 鉴权与 Session Cookie 校验。修复
复用增强模式成熟的 TanStack Query 缓存拦截机制,并在独立模式下建立轻量、受控的生命周期:
通过 Fiber 发现 Codex 的
QueryClient,拦截用量查询原型的Query.setData与client.setQueryData。在用量数据通知 React 界面之前完成处理,使已有缓存、后续轮询和推流更新均能生效。仅在启用供应商配置且当前配置为
official + officialMixApiKey时,放行rate_limit.allowed = true与rate_limit.limit_reached = false。百分比、积分、消费上限保持原样,并显式排除image-generation查询。使用 WeakMap 保存真实服务端数据快照,兼容缓存的结构共享。切回纯官登、关闭供应商配置或设置超时未响应时,立即还原真实锁定状态。
在 Rust 侧实现
supervise_isolated_api_quota_gate,内置 500ms~5s 指数退避重试。CDP 会话因页面导航或刷新断开后自动探测并重连;运行期切换 Relay Profile 时通过 Runtime binding 脱敏推送,聚焦窗口即可动态生效。会话销毁时清理在页面注册的脚本;仅在
focus、visibilitychange及DOMContentLoaded时按需获取设置,空闲时完全静默,不消耗任何定时器轮询。验证
cargo test -p codex-plus-core --test api_quota_gate --test native_api_quota_gate全部通过。upstream/main完成 Rebase,无代码冲突。