fix(devin-connect,chat): honor the 429 reset window on the streaming path — propagate resetMs + cool account-wide#224
Merged
Conversation
…DEVIN_CONNECT path
The streaming path dropped the upstream rate-limit reset window and then cooled
the account on a dimension the pool never reads, so a rate-limited account was
re-selected within seconds and kept hammering the upstream velocity limiter.
- src/devin-connect.js: both streamChat error paths (non-200 + JSON trailer) now
forward classified.resetMs onto streamError (audit F3) instead of destructuring
only {code, message}
- src/handlers/chat.js: finalizeConnectAccount RATE_LIMITED cools account-wide
(markRateLimited(apiKey, resetMs, null, 'r')) — acquireConnectAccount selects
with modelKey=null, so a model-scoped cooldown is invisible to selection;
rateLimitedUntil is the only dimension getApiKey honors there
- test/devin-connect.test.js: +2 — resetMs propagation on non-200 and trailer paths
- test/devin-connect-pool.test.js: F2 updated to assert account-wide cooldown
Owner
|
已合并,谢谢 🙏 这个 PR 最有价值的地方是把"两条链只修一条毫无可观测效果"这件事讲清楚了 —— 这正是它此前一直没被发现的原因:光看 account-wide 这个取舍我认同并已采纳:DEVIN_CONNECT 选池就是不带 modelKey 的, 传输层那两条回归测试(非 200 与 JSON trailer 双路径都断言 resetMs)补得很到位,以后谁再动 streamChat 的错误解构都会被这两条拦住。 已加入致谢名单(dashboard credits 面板 + README 中英),评级 S。 |
dwgx
added a commit
that referenced
this pull request
Jul 25, 2026
合入 warelik 六连(#224-#229):429 reset window 双链根因(resetMs 传输层透传 + 冷却落到 account-wide,原先 model-scoped 对 modelKey=null 的池选择结构性不可见)、 客户端断连不再罚账号(abort 统一识别,流式/非流式全路径不 failover 不烧配额,499)、 Grok/xAI self-ID 中和(a6-grok)、thinking signature 空串改省略、Responses usage 补 input/output_tokens_details、pair-chain 会话连续性新模块(600 行零依赖,默认关)。 合入 forrinzhao #219 的 codex content-policy 发现:落地为规则 (a7),并修根因 —— 工具描述 preamble 原本注入在 neutralizeClientIdentity 之后,导致 native 路径上 任何经由工具描述进来的触发词都绕过 a1-a6 整条防线。identity-neutralize 现覆盖 Claude Code / Cline / Grok / codex 四个客户端。 DEVIN_CONNECT cache_read_tokens=5 付费校准并改为默认解码(#220):缓存命中不再被 当作新鲜输入计费,与 #229 合起来端到端可见;'off' 可全关。setup.sh 在无 LS 二进制 的主机(macOS 典型)默认写 DEVIN_CONNECT=1 + 回环绑定。 2778/0 绿。
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.
中文 TL;DR
流式 DEVIN_CONNECT 路径丢了 429 的 reset window,并且把 cooldown 写到账号池读不到的
model 维度上,导致刚被限流的账号被立刻重选、反复打 upstream limiter。本 PR 让 resetMs
一路透传,并按 account-wide 冷却(池选择用 modelKey=null,只认 rateLimitedUntil)。
Summary
Closes #221. Two links of one chain — a
429reset window is dropped in transport,then written to a cooldown dimension the pool never reads. Both must be fixed
together for any observable effect.
Root cause
classifyUpstreamError()parsesresetMs, butstreamChat's two error pathskept only
{ code, message }→ cooldown fell back to the short burst default.acquireConnectAccount→getApiKey(triedKeys, null, ...)selects withmodelKey = null;isRateLimitedForModelonly reads_modelRateLimitswhenmodelKeyis truthy, so a model-scoped cooldown can never gate DEVIN_CONNECTselection.
rateLimitedUntil(account-wide) is the only dimension it honors.Fix
src/devin-connect.js(2 points): forwardresetMsontostreamError.src/handlers/chat.js:markRateLimited(apiKey, resetMs, null, 'r').Test plan
test/devin-connect.test.js+2:resetMson non-200 (2h30m) & JSON-trailer (1h15m) pathstest/devin-connect-pool.test.js: F2 now asserts account-widerateLimitedUntilhonors the 3h windownpm test→ 2763 pass / 0 failBranch is rebased on current
master(v3.5.0), applies cleanly.