Skip to content

fix(copilot): keep tool-free Claude requests on Auto - #9998

Merged
farion1231 merged 1 commit into
farion1231:mainfrom
allenxu09:codex/copilot-auto-warmup
Nov 29, 2026
Merged

farion1231 merged 1 commit into
farion1231:mainfrom
allenxu09:codex/copilot-auto-warmup

Conversation

@allenxu09

@allenxu09 allenxu09 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Human Note / 本人说明

修复 Copilot 供应商在 Claude Code 下无工具时报错的问题,在本机用 Copilot Pro + Claude Code 实测后无误。

Summary / 概述

Claude Code sends anthropic-beta on regular requests even when started with --tools ''. CC Switch classified those requests as warmup, skipped Copilot Auto, and sent them to gpt-5-mini. A real Copilot account returned HTTP 400 for that request.

Require the one-token request shape used by Claude Code's startup and model-validation probes before applying the warmup downgrade. The forwarding regression test covers both a probe and a regular request with an empty tool list.

Related Issue / 关联 Issue

Follow-up to #9564. Related to #8197.

Verification / 验证

  • cargo fmt --all --check passed.
  • All 64 Copilot optimizer tests and the Auto forwarding regression test passed.
  • With warmup downgrade enabled, a real account returned CCS_AUTO_OK from claude --bare --print --model copilot-fusion-auto --tools '' --no-session-persistence 'Reply with exactly CCS_AUTO_OK.'. The proxy log showed Auto selected mai-code-2-flash and used /responses.

@github-actions github-actions Bot added backend Backend (Rust/Tauri) proxy Related to proxy/API forwarding labels Nov 26, 2026
@allenxu09
allenxu09 marked this pull request as ready for review November 26, 2026 01:47

@funkpopo funkpopo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢跟进修复和真机验证!把 is_warmup_request 收紧到 Claude Code 的单 token 探针形态(max_tokens == 1 + "." 或带 ephemeral 的 "Hi"),并在空 messages 时直接返回 is_warmup: false,避免了常规无工具请求带 anthropic-beta 时被误降级;即使后续上游探针形态变化也能安全退化回正常路径。forwarder/tests.rs 同步覆盖了探针与无工具常规请求两种场景,三平台后端 CI 也已通过。

顺带记一个非阻塞的边界点(属于 #9564 既有策略,不需在本 PR 处理):在仅支持 Auto、直接调用 gpt-5-mini 会返回 400 的账号上(见 #8197),如果客户端在 copilot-fusion-auto 下发出真实单 token 探针,forwarder.rs 仍会跳过 /auto 走 warmup_model。后续如果收到 Free / 学生账号在真实探针上 400 的反馈,再单独开 follow-up 评估即可。

没有阻塞项,LGTM。

funkpopo
funkpopo previously approved these changes Nov 26, 2026
@allenxu09

Copy link
Copy Markdown
Collaborator Author

cc @SaladDay

@farion1231

Copy link
Copy Markdown
Owner

感谢 @allenxu09 的修复和 Copilot Pro 真机验证!把预热判定收紧到 Claude Code 的单 token 探针以后,不带工具的普通请求就不会再被悄悄换成 gpt-5-mini 了;你也及时 rebase 解掉了和 #10080 的测试冲突。我已在最新 main 上本机跑过 fmt / clippy / 全量测试,全部通过,这就合并。

@farion1231
farion1231 merged commit 5eeac32 into farion1231:main Nov 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend (Rust/Tauri) proxy Related to proxy/API forwarding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants