sub2api icon indicating copy to clipboard operation
sub2api copied to clipboard

[BUG] FilterThinkingBlocksForRetry 未移除 thinking_strategy 字段导致重试仍然 400

Open EnvyGithub opened this issue 9 months ago • 1 comments

问题描述

当请求包含 thinking_strategy(如 clear_thinking_20251015)时,sub2api 的 signature 错误重试机制会失败。

复现步骤

  1. 客户端发送包含 thinking blocks(带 signature)和 thinking_strategy: clear_thinking_20251015 的请求
  2. Anthropic 返回 400: invalid signature in thinking block
  3. sub2api [SignatureCheck] 正确检测到 signature 错误
  4. sub2api 调用 FilterThinkingBlocksForRetry 过滤 thinking blocks 并重试
  5. 重试请求中 thinking_strategy 字段未被移除
  6. Anthropic 返回 400: clear_thinking_20251015 strategy requires thinking to be enabled or adaptive
  7. 此错误被标记为 non-retryable,最终返回 400 给客户端

日志证据

[SignatureCheck] Detected signature error
Account 1: detected thinking block signature error, retrying with filtered thinking blocks
[SignatureCheck] Checking error message: `clear_thinking_20251015` strategy requires `thinking` to be enabled or adaptive
[Forward] Upstream error (non-retryable): Account=1 Status=400

期望行为

FilterThinkingBlocksForRetry 在移除 thinking blocks 和顶层 thinking 配置的同时,也应移除 thinking_strategy 字段(如 clear_thinking_20251015),确保重试请求结构一致。

环境

  • sub2api: latest (image date: 2026-02-18)
  • 上游: Anthropic API
  • 触发场景: Claude Code CLI 多轮对话中跨账号 thinking signature 不匹配

EnvyGithub avatar Feb 22 '26 16:02 EnvyGithub

我也遇到了这个问题,你解决了吗

MengFanLu1 avatar Feb 25 '26 06:02 MengFanLu1