pi-model-auto-router: 0.4.0 — 账号级 400 故障转移 + 单目标重试 #11

Merged
weisanju merged 2 commits from agent/coding-agent-qoder-default/93efc30f3bea into main 2026-09-22 17:34:04 +08:00
weisanju commented 2026-09-22 17:28:22 +08:00 (Migrated from github.com)

Summary

  • 0.3.2 账号级/模型级 400 归为 config 类:Access to Anthropic models is not allowed for this account.、"thinking.type.enabled" is not supported for this model 等 target 级错误不再落入 fatal 终止整条路由,而是 failover 到下一目标 + 12h 长冷却(可配);failover 日志记录 class/命中 marker/cooldownMs;target 支持 enabled: false 临时绕过
  • 0.4.0 单目标重试(per-target retry):新增 retry.perTargetRetries(默认 0 保持现状)与 retry.perTargetBackoffMs(默认 1500ms,翻倍,上限沿用 backoffMaxMs),瞬态错误(如 429)failover 前先在原目标上重试;状态行新增 target-retry 状态;TUI ⚙️ 重试与冷却设置新增两项

Test plan

  • 单测:classifyFailure 对两条 400 消息返回非 fatal(config)+ marker 命中 + 大小写不敏感;perTargetBackoffDelay 翻倍/封顶/默认值
  • e2e 复现用例:被拒 target 排在可用 target 之前 → 跳过、命中后续、日志含 class=config marker=... cooldownMs=43200000,冷却期内不再选中
  • e2e per-target retry:原地重试恢复无需 failover、额度耗尽后 failover、config 类不重试、状态行 target-retry 显示
  • tsc --noEmit 与 bun test 30/30 通过,dist 已重建
## Summary - **0.3.2 账号级/模型级 400 归为 config 类**:`Access to Anthropic models is not allowed for this account.`、`"thinking.type.enabled" is not supported for this model` 等 target 级错误不再落入 fatal 终止整条路由,而是 failover 到下一目标 + 12h 长冷却(可配);failover 日志记录 `class`/命中 `marker`/`cooldownMs`;target 支持 `enabled: false` 临时绕过 - **0.4.0 单目标重试(per-target retry)**:新增 `retry.perTargetRetries`(默认 0 保持现状)与 `retry.perTargetBackoffMs`(默认 1500ms,翻倍,上限沿用 `backoffMaxMs`),瞬态错误(如 429)failover 前先在原目标上重试;状态行新增 `target-retry` 状态;TUI ⚙️ 重试与冷却设置新增两项 ## Test plan - [x] 单测:`classifyFailure` 对两条 400 消息返回非 fatal(config)+ marker 命中 + 大小写不敏感;`perTargetBackoffDelay` 翻倍/封顶/默认值 - [x] e2e 复现用例:被拒 target 排在可用 target 之前 → 跳过、命中后续、日志含 `class=config marker=... cooldownMs=43200000`,冷却期内不再选中 - [x] e2e per-target retry:原地重试恢复无需 failover、额度耗尽后 failover、config 类不重试、状态行 target-retry 显示 - [x] `tsc --noEmit` 与 `bun test` 30/30 通过,dist 已重建
Sign in to join this conversation.
No description provided.