Repository navigation
Replies: 1 comment
|
Confirmed at The fragility is wider than 401-versus-429. Because ordering is the rule, several pairs collide the same way and 401/403 is only the first instance:
Why it is text-matching at all — the adapter's own comment above the function answers it: pi-ai flattens the caught error to Available today without touching core. To be clear, that is a mitigation for third-party wrappers, not an argument against reordering the chain: the ordering is the defect, and the reorder is the right upstream change. |
Uh oh!
There was an error while loading. Please reload this page.
摘要
classifyPiAiError()用纯文本正则判断错误类别,且401|403的分支排在429之前。当错误消息正文里同时含401与429字样(或含401的包装文本)时,请求会被归类为 AUTH(不可重试),而真实原因是上游限流(应可重试)。问题位置
packages/llm/llm-pi-ai/src/stream.ts(约 42–45 行):影响
401|403既排最前、又只做文本匹配。消息里任何401字样(包括被包装进 message 的嵌套 JSON)都会抢走 429 判断,把可重试的限流误判为不可重试的认证失败——用户侧表现为"API 密钥无效",实际密钥有效。复现路径(真实案例)
provider 插件
dsh-workbuddy-connect-functy在"账号池暂时为空"时,返回带401字样的包装消息,同时底层上游是429(账号标识已脱敏为<account>):该消息同时命中
401与(上游真实)429语义,classifyPiAiError返回AUTH,宿主随即终止重试。修正来源侧后,同一诱因下分类正确变为RATE_LIMIT,重试正常启动。建议修复
429/限流判断提到401|403之前;或参考改法(最小改动):
环境
@deepseek-ai/dsh-root0.2.1-alpha.2(master,d743267…)All reactions