Skip to content

fix(schedule): 选号按持久化冷却条件清除本机账号级阻断 - #6320

Open
spongehah wants to merge 1 commit into
Wei-Shaw:mainfrom
spongehah:fix/runtime-block-honor-persisted-cooldown
Open

fix(schedule): 选号按持久化冷却条件清除本机账号级阻断#6320
spongehah wants to merge 1 commit into
Wei-Shaw:mainfrom
spongehah:fix/runtime-block-honor-persisted-cooldown

Conversation

@spongehah

@spongehah spongehah commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #6319

变更概述

多实例部署时,OpenAI/Grok 失败会同时写入持久化冷却字段和进程openaiAccountRuntimeBlockUntil。管理端重置/恢复会清 DB/快照,但其它网关实例仍保留本机阻断,继续跳过该账号。

本 PR 让选号以持久化冷却为准:

  • TempUnschedulableUntil / RateLimitResetAt / OverloadUntil 均未生效,则丢掉过期的本机账号级阻断
  • 使用 generation + deadline CAS,peek 之后新装上的阻断不会被删掉
  • 不清理模型级 transient,也不清理 Grok 模型配额 / team+model 限流
  • 当 SetTempUnschedulable 或 SetError 执行失败时,此时账户的冷却字段仍为空下一次请求会清理进程阻断。仍然以持久化为准,持久化失败为低概率事件,即使发生对于此场景也无伤大雅

取舍

确实违背当前传输错误路径的契约:即使 DB 写失败或账号缓存尚未同步,内存阻断也必须立即生效。改完之后,调度 Account 上冷却字段为空即 fail-open,本机账号级阻断会被丢掉。

我仍然认为以 DB/快照为准才是多实例下最合理的行为,这也是目前最简单的修复方式。如果认为这个取舍不合理,请不要合并本 PR——但 #6319 里的多实例问题仍然存在,需要重新修复。

测试

  • TestRuntimeBlockHonorsClearedPersistedCooldown
  • TestRuntimeBlockKeepsActivePersistedCooldown
  • TestRuntimeBlockConditionalClearSkipsNewerGeneration
  • TestHandleOpenAITransientError_HardDisableStillBlocksWholeAccount 已按 fail-open 更新

- Treat TempUnschedulableUntil/RateLimitResetAt/OverloadUntil as source of truth during account selection
- Drop stale local account-level runtime blocks with generation+deadline CAS
- Leave model-scoped transient and Grok quota blocks unchanged
@spongehah spongehah changed the title fix: honor persisted cooldown when dropping in-process account blocks fix: 选号按持久化冷却条件清除本机账号级阻断 Aug 28, 2026
@spongehah spongehah changed the title fix: 选号按持久化冷却条件清除本机账号级阻断 fix(schedule): 选号按持久化冷却条件清除本机账号级阻断 Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

多实例部署时,OpenAI/Grok 进程内调度阻断不会被其它网关实例清除

1 participant