Repository navigation
fix: 修复额度拒绝与同账号重试的调度合同 - #1007
Merged
Merged
Conversation
ranxi2001
marked this pull request as ready for review
November 22, 2026 15:31
This was referenced Nov 22, 2026
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.
解决的问题与行为变化
维护者复核(458358332)。
e7e4c5bf3在 WS 退避结束、取得槽位后复核截止时间;严格会话重试沿用共享绑定核验,并新增当前绑定匹配、变化及缺失的测试。裸 SSE 错误保留原有冷却语义,明确的response.failed额度代码走有限换号。458358332修正测试格式。在
backend执行go test -p 2 -tags unit ./internal/handler ./internal/service -run '^(TestGrokUnknown403ChatHasOneBackup|TestOAuthRetryOwnerBusyAfterSlotRelease|TestStrictSameAccountRetryRequiresCurrentBinding)$' -count=1,两个包均通过。最终提交的远端记录见主 CI。下表保留初版审查记录,覆盖范围和待验证的生产行为按对应条目理解。补充修复、日志核对和定向复验由 Codex 完成,精确模型 ID 与推理档位未提供。初版独立源码审查(328ce034c):BLOCKED。 当时的两个反例是 WS 内层重试在退避或抢槽后越过原截止时间,以及重试 pin 分支绕开严格会话的共享绑定核验。
普通 OAuth A 收到暂态错误后,网关会释放并发槽并重新调度;A 在退避期间变忙时,原“同账号重试”可能发送 B,且没有经过切号计数。本次把实际发送账号带入请求上下文,由调度器执行单账号准入、有限排队或停止,并在抢槽后复查取消与截止时间。
同时修复共享请求级停止条件吞掉 Grok 一次备用机会、无 reset 的明确 quota 被送入两分钟重试窗口,以及包装并发 401 不打断 IP401 streak 的问题。
原审查六个 gap 的状态逐项保留:
关联记录与来源
c76d8d3de146408e35b79814955088b355c66135;已合并 fix: recover quota refusals and preserve OAuth retry affinity #1000 为426dc42d673ce2376073739cb03866ae6d586009。fix/pr1000-postmerge-contracts-20261122,328ce034c0ac8a039fdf01976b7efb5fbc8b7e13。两次普通本地提交,保留全部已合并工作;不是 stacked PR。管理员新功能提示
复现与验收
openai_retry_owner_test.go、openai_same_account_retry_test.go、openai_gateway_credential_failover_loop_test.go、openai_encrypted_history_quota_failover_test.go、openai_agent_quota_failover_test.go、openai_ip_unauthorized_streak_test.go、openai_account_runtime_block_fastpath_test.go、openai_oauth_eof_affinity_test.go、openai_upstream_session_error_test.go。未覆盖项见六 gap 表。协议、调度或传输改动补充(相关时填写)
实际验证
git diff --check c76d8d3de146408e35b79814955088b355c66135 HEADgit status --short --branchrg -n OpenAIAgentRecoveryNoReplay backend/internal/service backend/internal/handlergit diff --name-only c76d8d3de146408e35b79814955088b355c66135 HEAD -- .github frontend backend/internal/service/openai_agent_message_delivery.go backend/internal/service/openai_tool_provenance.go首个未满足的动态 gate 是精确 successor SHA 的远端编译与定向回归。下一步由父级独立复核两个提交、push 后创建早期 Draft 并读取真实 CI 原始证据;旧 #1000 绿色 CI 不能替代新 SHA。
兼容性与运行影响
文档与用户可见变化
无新增页面或管理员设置;修复用户请求在额度、暂态拒绝和并发争抢时的恢复行为。PR 合并、Release 与生产部署由后续独立流程处理。
Agent 使用声明
readonly_contract_review负责 scheduler/fixture 静态交叉审查,未写任何文件。独立 Codex reviewer 完成固定 head 审查,结论 BLOCKED B1/B2。原恢复 reviewer 遇上游 502/503→409 退出,未形成源码结论;新的只读 reviewer 完成上述审查。其三个只读子审查 owner_retry_review、quota_integrity_review、grok_auth_review 的完整模型/推理档位未知。gpt-6.1-sol/ultra;子线程有效模型与推理强度未知,未独立读取。独立 reviewer 启动配置同为gpt-6.1-sol/ultra,metadata 待补;不把配置当成完成审查。gpt-6.1-sol,推理强度不适用(接口未提供)。提交前自查