Repository navigation
fix(domestic): 兼容 Chat Completions developer 消息,修复上游 11128 - #15
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
DeepSeek Harness 等客户端可以通过 OpenAI Chat Completions 传入
developer角色,但国内 CodeBuddy 上游copilot.tencent.com实测可能拒绝包含该角色的请求,返回 HTTP 400 / code 11128。现有
responses_adapter.py已在 Responses 协议转换时将developer映射为system,但/v1/chat/completions直接进入forward_chat,缺少这一兼容处理。修复
forward_chat调用上游前,对国内官方网关的developer消息做 copy-on-writedeveloper → system转换。backend=domestic且目标 hostname 为copilot.tencent.com;不修改国际站或其他自定义上游。--desensitize之前转换角色,确保既有 harness 压缩与 system 脱敏按预期工作。upstream_role_compat诊断日志,不记录提示词内容。role_compat.py、10 项专项测试,以及中英文 README 说明。合并最新主干及冲突解决
本地原始提交:
05a3712。从本地92698b7创建分支后,合入远端main(28061d4,含 PR #7 和 #14);仅__main__.py的 import 区域出现冲突,已同时保留forward_billing与role_compat,合并提交:68d44e5。验证(Windows 本地)
test_backend_profiles.py::test_session_profiles_are_isolated_and_saved_with_metadata:Windowsstat.S_IMODE返回0666,断言要求 POSIX0600,与此次修改无关。test_developer_role_compat.py与test_checkin_proxy.py:37 passed。git -c core.whitespace=cr-at-eol diff --check通过,合并后工作区干净。developer消息的请求返回 200 / SSE DONE;本次整合以 Mock 测试为主,未额外触发生产服务重启。该 PR 仅包含上述 5 个文件的角色兼容修复;最新签到接口功能来自合入的 main,不在 PR diff 中。