Skip to content

fix(openai): scope Spark quota 429 to model - #6358

Open
Wei-Shaw wants to merge 3 commits into
mainfrom
fix/openai-spark-model-429-rate-limit
Open

fix(openai): scope Spark quota 429 to model#6358
Wei-Shaw wants to merge 3 commits into
mainfrom
fix/openai-spark-model-429-rate-limit

Conversation

@Wei-Shaw

Copy link
Copy Markdown
Owner

Summary

  • 修复 Spark 独立配额窗口返回 429(100% 使用率及 5h/7d reset)时被误判为账号级限流的问题
  • 将 OpenAI OAuth/SetupToken 的 Spark 429 写入模型级 model_rate_limits,不再设置账号级 RateLimitResetAt
  • 保留普通 OpenAI OAuth 全局 429 和 API Key 429 的既有账号级处理语义
  • Spark shadow 与普通 OAuth 承接 Spark 的路径均覆盖,避免其他模型被连带停调

Regression coverage

  • 普通 OAuth 账号 Spark 429 只调用 SetModelRateLimit
  • Spark shadow 429 不产生账号级运行时阻塞
  • 7d/100% 配额头被保存为 gpt-5.3-codex-spark 模型限流
  • 定向 OpenAI 429、Spark 路由和模型限流测试通过

Verification

go test -tags=unit ./internal/service -run 'Test(OpenAI429FastPath|OpenAIHTTP429StillUsesQuotaResetHeaders|OpenAIStream429IgnoresSuccessfulQuotaSnapshotHeaders|CalculateOpenAI429ResetTime|SparkRoutingByModel|ParentHealthScheduler|.*ModelRateLimit)' -count=1
git diff --check

Related to #6208.

@Wei-Shaw
Wei-Shaw force-pushed the fix/openai-spark-model-429-rate-limit branch from 99b1c8d to b9cdf7a Compare August 29, 2026 01:55
@Wei-Shaw
Wei-Shaw force-pushed the fix/openai-spark-model-429-rate-limit branch from b9cdf7a to 5d9c7ab Compare August 29, 2026 01:57
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.

1 participant