Repository navigation
feat(auth): 隔离原生登录与网关多账号订阅额度 - #2909
Open
Yuimi-chaya wants to merge 6 commits into
Open
Yuimi-chaya wants to merge 6 commits into
Yuimi-chaya wants to merge 6 commits into
Conversation
Owner
|
感谢这么大的投入!不过这个 PR 现在不能合,主要是会改变老用户的默认行为:
建议拆小:先只做「订阅账号的额度阈值 / 自动预取」并且默认不拦,不复制原生登录;原生登录隔离另开一个 PR 单独讨论。这是新功能,合不合最终由维护者决定。 |
Contributor
Author
|
感谢维护者详细指出这些兼容性问题,也感谢你的建议。 关于“网关授权”设置:这个开关是我在 agent 侧额外引入的控制项,并不是现有网关供应商模型所必需的设置。它确实会让旧版 gateway.json 中没有该字段的订阅供应商在升级后被错误地拦截为 403。现在已按意见移除这层额外授权要求:供应商接入并启用即可使用;额度窗口、使用阈值以及超额后的路由策略仍然保留,未知用量也默认沿用旧版可用行为。 关于 auth.json:目前 Codex++ 在切换供应商时确实存在覆盖原生登录凭证的实际风险,这也是我希望通过这个 PR 一并解决的原因。额度查询、原生登录选择和网关供应商共用了凭证解析/刷新路径,如果只修额度逻辑,仍可能出现复制原生凭证、轮换原生 refresh_token,或多个供应商相互覆盖的问题。当前修正包括:
所以我理解拆分 PR 的建议,但仍希望在本 PR 内完成这组兼容修复,因为它们共享同一条 auth/quota 路径,拆开会暂时保留 auth.json 覆盖和 refresh token 风险。上述问题已按意见逐项修正,麻烦后续再帮忙 review 检查。谢谢! |
Owner
|
感谢这么完整的实现和验证记录。合并前有几点想先对齐:
|
Yuimi-chaya
force-pushed
the
codex/explicit-auth-subscription-quota
branch
from
November 6, 2026 16:22
c7cad89 to
0b09e54
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.
背景
供应商切换会改写 Codex 原生
auth.json。多账号场景需要分别管理原生登录身份与网关供应商的订阅凭证,避免主动选择的账号被其他供应商覆盖。本 PR 保留旧版默认切换行为,仅在用户明确选择原生账号或「不登录」后启用显式身份管理。改动
subscription_policy才按各官方窗口累计已用阈值拦截,并应用停止、下一个订阅账号或 API 回退策略;未知用量默认允许。验证
main的daecde9e。gateway_e2e、其他 4 个独立测试、data 500 项和 launcher 38 项通过。commands::tests::multi_instance_missing_receipt_uses_native_birth_scan_and_port_ownership_checks(实际starting、期望stopped);该测试及其调用的commands.rs、multi_worker、windows_integration、watcher文件相对main无差异,未修改断言或工作流。边界
未配置策略的旧供应商保留原有可用性和 API 失败转移,不因升级自动增加额度拦截。
阈值拦截新网关请求,不预留或修改官方额度;上游读数延迟和在途请求仍可能导致超过阈值。本应用的互斥锁不能约束外部客户端,外部写入仍依赖凭据代际检查;同一旋转会话跨 Magpie、Codex 等客户端的并发同步不在本 PR 范围内。