Conversation
ViceEye
marked this pull request as draft
October 3, 2026 13:22
ViceEye
force-pushed
the
codex/fix-hybrid-quota-native
branch
from
October 3, 2026 16:18
180aee9 to
537ef27
Compare
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.
问题
启用「官方登录 + 混入 API Key」时,即使自定义中转 API 仍有充足额度,官方订阅额度耗尽也会导致普通发送按钮(Composer submit)被前端禁用,只能编辑已有消息后发送。
此前 PR #2286 尝试通过 CDP 条件断点和注入脚本在前端 React 状态层强行改写状态,但存在明显局限:
enhancementsEnabled: true时才能工作,无法满足追求纯净、无注入模式的用户需求;anchor_missing)引发主线程高频扫描;修复
改为在底层协议代理(Protocol Proxy)与网络路由层原生放行,彻底摆脱对 CDP 断点与页面 JavaScript 注入的依赖:
officialMixApiKey: true)写入config.toml时,自动将chatgpt_base_url挂载至本地协议代理(http://127.0.0.1:{port}/backend-api/);/backend-api/*(如/wham/usage、/rate_limits等)的配额查询请求时,对混合模式直接返回合法的未超限响应(rate_limit: { allowed: true, limit_reached: false });"allowed":false),在混合模式下纳秒级重写为"allowed":true;r.rate_limit?.allowed !== false自然成立,发送按钮永久可用;enhancementsEnabled: false),该特性依然 100% 稳定生效,零性能损耗、零卡顿风险;chatgpt_base_url。验证
hybrid_mode_writes_chatgpt_base_url_for_quota_bypass,验证混合模式下chatgpt_base_url正确生成,且持久化保存时不产生脏端口快照;detects_backend_api_and_wham_paths及sanitizes_rate_limit_text_for_hybrid_mode单元测试,覆盖各种 JSON 结构清洗场景;cargo test -p codex-plus-core --test relay_config全部 175 项测试通过;cargo test -p codex-plus-core --test protocol_proxy全部 135 项测试通过;