Repository navigation
Conversation
上游 429 code 14003(msg "too many requests"、displayMsg「模型繁忙,请换模型 或稍后重试」)此前只有 6004 被认成模型级,14003 落进账号级软冷却:soft_rate 600s 起、翻倍到 2h。一次请求轮转几个号,每个号都中 14003,几十秒内整池冷 10 分钟(国际版线上形态)。 - upstream: modelRateLimitCodes = "6004|14003",新增 IsModelBusy 区分二者 - pool: CooldownSoftForModel 无重置时间时写 modelCooldowns[model],不再退化 成账号级;新增 CooldownModelBusy(60s 起、封顶 3m、窗口内不延长) - handler: 模型级先判,14003 无时间时走 CooldownModelBusy - README: 同步错误处置表与 429 冷却语义 - tests: 覆盖 14003 模型级短窗口、6004 无时间模型级、窗口不延长/封顶/保留更长冷却
Author
|
推错目标仓库,关闭。本项目实际部署/维护的是 |
Huiaei
pushed a commit
to Huiaei/workbuddy2api-panel
that referenced
this pull request
Oct 25, 2026
…69#238) 上游停更(73a7560)后仍有三个 PR 挂在 linguo2625469 仓库上、因停更而未合 (linguo2625469#237 已关、linguo2625469#238 已关、linguo2625469#234 已关)。逐个核过落地性,结论如下: 采纳 linguo2625469#237(promo 折扣透出): - 我方 ModelInfo 早有 PromoFactor,但它只在 discount.factor 机器可读时才有 值。「错峰使用」类条目上游只有 hover 文案(如「周一至周五 09:00–12:00、 14:00–18:00 属高峰原价,非高峰期积分5折」),factor 藏在文本里,我方一律 留 nil ⇒ 客户端只拿到牌价 credits,错峰时段实付 x0.085 却显示 x0.17, 选型被误导(对方实测 deepseek-v4-flash 差 2 倍)。 - 新增 internal/upstream/promo_note.go 从 hover 文案派生时段与折扣比例, 派生值标记 PromoDerived=true 与上游机器可读字段区分置信度。 - /v1/models 增透 promo_* 一组字段(遵循空值省略约定)。 采纳 linguo2625469#238(试用/限免模型自动熔断)但改掉两处: - 落盘原本是 tmp + os.Rename。Windows 上任何其他进程持有句柄时裸 Rename 会返 ERROR_ACCESS_DENIED 而失败,状态从此写不进去 ⇒ 改走 internal/atomicfile。 - 默认监控名单原本硬编码 hy4-preview-f / step-5-preview / hy3——那是提交者 自己环境里的三个模型,换台机器就是别人的模型,默认禁掉用户从没配置过的 模型属静默误伤 ⇒ 改为留空,必须显式列 TRIAL_GUARD_WATCH 才生效。 - 新增 empty_watch_test.go 钉死「不配置 = 完全不动」。 不采纳 linguo2625469#234(14003 停车):我方 10e1353 已实现且更细——对方 60s 起/封顶 3m 且不区分瞬时与确定性;我方 10s 起/翻倍/封顶 1m,并按瞬时(14003/6004)与 确定性(11102/11158)分流末端语义。
Smirk1921
added a commit
to Smirk1921/workbuddy2api-panel
that referenced
this pull request
Oct 27, 2026
429 code 14003(too many requests / 模型繁忙)与 6004 一样是模型级信号: - IsModelRateLimit 同时识别 6004/14003;新增 IsModelBusy 区分瞬时繁忙。 - 14003 无 Retry-After 走 CooldownModelBusy:只停 (账号, 模型),60s 起、按命中翻倍、 封顶 3 分钟;窗口内不延长,已有更晚冷却不缩短,不写账号级 until。 - 6004 无重置时间也从账号级冷却改为只停 (账号, 模型),按 soft_rate 基数退避。 - 其余 429 仍走账号级 soft_rate 阶梯。 移植自上游 PR linguo2625469#234 / misakano7545#37(两者均被关闭,未进上游主线)。 新增/更新测试:IsModelBusy、CooldownModelBusy 短窗口、6004 无重置时间模型级、 14003 端到端换模型可用。
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.
问题
上游 429
code 14003(msgtoo many requests、displayMsg.zh=「模型繁忙,请换模型或稍后重试」)是模型级信号:同号换模型立刻可用,body 里也没有恢复时刻。但网关此前只把6004认成模型级,14003 掉进账号级软冷却。线上形态:一个请求打中 14003 → 整号
CooldownSoftRate(soft_rate=600s);轮转 500ms 后换下一个号,上游是同一出口/同一模型的繁忙,新号也 14003 → 再罚 600s。4 个国际号 8 次命中,9 分钟内整池不可用 10 分钟(实测 11:27:52–11:36:48,4 个号各 2 次)。改动
internal/upstream/client.gomodelRateLimitCodes = "6004|14003",IsModelRateLimit同时认两者IsModelBusy(仅 14003),供 handler 选短窗口internal/pool/cooldown.goCooldownSoftForModel无重置时间时写modelCooldowns[model](不再退化成账号级until+soft_streak)CooldownModelBusy:14003 独立短窗口 60s 起、按命中翻倍、封顶 3 分钟;窗口内不延长;已有更晚冷却不缩短internal/server/handler.goCooldownModelBusy;6004/14003 有墙钟或 Retry-After →CooldownSoftForModelsoft_rate阶梯README.md:错误处置表与 429 冷却语义同步测试
新增/更新用例:
TestIsModelRateLimit+ 14003TestIsModelBusy(14003 true / 6004 false / requestId 不误判)TestChat14003StaysModelScopedShortWindow(账号不冷却、模型 ≤3m、换模型可用)TestChat6004WithoutResetStaysModelScoped(原账号级退避用例改为模型级停车)TestCooldownModelBusyShortWindow/TestCooldownModelBusyKeepsLaterCooldown兼容性
state.json结构不变(modelCooldowns已有字段)soft_rate