Skip to content

fix: Claude 模型限制兼容回退,默认超时改为 1800 秒 - #18

Merged
Gaoshou101 merged 2 commits into
mainfrom
codex/live-compat-fixes
Nov 8, 2026
Merged

Gaoshou101 merged 2 commits into
mainfrom
codex/live-compat-fixes

Conversation

@Gaoshou101

Copy link
Copy Markdown
Owner

修复 2026-11-08 付费真实验收中发现的问题(见 docs/VALIDATION.md)。

改动

  • sonnet-5-5 上的 model(none):上游拒绝 thinking.type=disabled 并要求改用 between_tools,而 CommandCode 的请求校验对所有模型都拒绝 between_tools。插件识别这一 400 后,改用自适应思考加 effort=low 重试一次。
  • sonnet-5-5 不支持强制工具选择:tool_choice 为 tool/any 时返回 400 "not supported"。插件改为 auto 重试一次,工具列表和 disable_parallel_tool_use 保持不变。
  • 以上两项只作用于 Messages 协议模型,也只匹配上述两类上游 400,其他错误不重试。重试发生在向客户端输出任何内容之前,统计中计为一次请求。
    • 日志新增 adjustments 字段,控制台请求详情新增「兼容调整」一行。
    • 重试被接受后,本进程内记住该模型;重启或修改 base_url 后清除。重试仍失败则不记住。
  • 默认 timeout_seconds 从 600 改为 1800:grok-4.7 实测用时 658 秒。已保存过设置的实例仍使用 settings.json 里的值,需要手动修改;未做自动迁移,避免覆盖用户有意设置的值。设置页说明已同步更新。
  • tests/commandcode_live.py:
    • thinking 用例改为需要推理的题目,并设 effort=high。
    • 新增 --thinking-off 和 --request-timeout 两个参数。
    • 逐个请求记录兼容调整,出现预期之外的调整时判为失败。
  • cpa_round2.py:模拟上游按 sonnet-5-5 的方式拒绝请求,经真实 CPA 宿主做端到端验证。

本地验证

  • 新增 8 个 Go 单元测试,以及 1 个 Node 测试。
  • go test -race ./...(WSL Linux)、go vet、gofmt、Node 32 项、Prettier 均通过。
  • test_cpamp_panel_validation.py 6 项通过。
  • WSL 交叉编译 Windows DLL,在 CPA v8.0.23 和 v8.0.59 上运行宿主联测(含 v0.2.12 热升级),18/18 通过。

尚未验证

真实上游复测需等额度重置(2026-11-08T08:30Z)后进行:用新 DLL 测试 sonnet-5-5 的 (none) 和强制工具选择,并用修复后的验收脚本跑 haiku-5-5 和 sonnet-5-5。

claude-sonnet-5-5 through CommandCode rejects thinking.type=disabled (asking
for between_tools, which CommandCode's own validation rejects) and forced
tool_choice (tool/any). The bridge now recognizes these upstream 400s on
Messages-protocol models and retries once with the nearest accepted request:
adaptive thinking at low effort, or tool_choice auto with the same tools.
The change is logged in a new adjustments field and shown in the console
request details; an accepted retry is remembered per model for the process
and forgotten on restart or base_url change. Other errors are not retried.

The default timeout_seconds rises from 600 to 1800 (grok-4.7 high effort
took 658 s live). Instances with saved settings keep their stored value.

commandcode_live.py: the thinking check uses a problem that needs reasoning,
adds --thinking-off and --request-timeout, and records adjustments per
request. cpa_round2.py emulates the sonnet-5-5 rejections through real CPA.
- Real upstream retest of the sonnet-5-5 fallbacks (via a JP egress; HK egress gets 403 for Claude models)
- Record the exact upstream error texts; both match the existing rules
- Bump to 0.2.14; hot-reload gate now upgrades from v0.2.13
- Deployment notes: saved timeout stays 600, Claude 403 egress hint
@Gaoshou101
Gaoshou101 merged commit 02d19ce into main Nov 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant