fix(maker-core): 兜底模型映射链不改写命名空间自定义 Provider id(#3764) - #3768
Merged
MagicLizi merged 2 commits intoSep 2, 2026
Merged
Conversation
目录窗口未知时的 legacyToSdkModelString 用 includes('sonnet') 含糊匹配
追加 [1m]:自定义 Anthropic 兼容 Provider 的 cindy/claude-sonnet-5 被改写
成 …[1m],而 cindy/claude-opus-5 透传 —— 同一 Provider 两个模型的 wire id
形态不对称,上游按白名单逐一 403,且 UI 显示不变、改写不可见(官方
Claude Code CLI 对同上游逐字发送、两个模型均可用)。
含命名空间前缀(provider/…)的 id 是自定义/网关 Provider 的路由键,不属
于兜底链的官方裸 id 知识范围:除既有显式命名空间条目(codex/*、
deepseek/*、z-ai/glm-5.2)外一律逐字透传。裸 id 兜底链与窗口已知路径
(toSdkModelString 按目录窗口决定 [1m])行为不变。
Signed-off-by: ficowang <fico@xd.com>
|
| Filename | Overview |
|---|---|
| packages/maker-core/src/agents/claude-code/index.ts | 将命名空间模型从裸模型兜底匹配中隔离,同时保留所有已知的历史兼容映射;未发现可达的行为回归。 |
| packages/maker-core/src/agents/claude-code/tests/models.test.ts | 覆盖多个自定义 Provider 的 Sonnet/Opus 对称透传,并确认窗口已知时仍由 contextWindow 决定 [1m]。 |
Reviews (1): Last reviewed commit: "fix(maker-core): 兜底模型映射链不改写命名空间自定义 Provi..." | Re-trigger Greptile
Signed-off-by: ficowang <fico@xd.com>
MagicLizi
approved these changes
Sep 2, 2026
MagicLizi
left a comment
Contributor
There was a problem hiding this comment.
代码重审通过:命名空间自定义 Provider id 在兜底链逐字透传,官方裸 id 与既有显式条目不变;当前 head 没有 P0/P1。
Contributor
|
合了。自定义 Provider 的 sonnet/opus 现在对称透传,不会再被兜底链偷偷加 [1m] 弄成一边能用一边 403。 |
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.
这次改了什么
摘要
fix #3764。自定义 Anthropic 兼容 Provider(非 Cindy 网关)下,同一把 key 在官方 Claude Code CLI 里 Sonnet 5 / Opus 5 都能用,在 Cindy 里两个模型轮流 403。根因在目录窗口未知时的兜底映射链
legacyToSdkModelString:model.includes('sonnet')的含糊匹配把任意含 sonnet 的 id(含命名空间形式cindy/claude-sonnet-5)都追加[1m],而cindy/claude-opus-5不命中任何分支、逐字透传——同一 Provider 的两个模型 wire id 形态不对称,上游白名单按收到的字符串逐一拒绝;UI 仍显示「Sonnet 5 / Opus 5」,改写对用户不可见。修复:含命名空间前缀(
provider/…)的 id 是自定义/网关 Provider 的路由键,不属于兜底链的官方裸 id 知识范围——除既有显式命名空间条目(codex/*不带[1m]、deepseek/*与z-ai/glm-5.2的历史兼容后缀)外,一律逐字透传,与官方 CLI 行为一致、Sonnet/Opus 对称。裸 id 兜底链(官方 sonnet/opus/fable/gpt 映射)与窗口已知路径(toSdkModelString按目录 contextWindow 决定[1m],含 #3497 方向的自定义 Provider 窗口)行为不变。变更类型
feat新功能fix缺陷修复refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
UI 变化
无 UI 变化。
怎么验证的
自动验证
结果:14 过(新增 1 条对称性回归:cindy/claude-sonnet-5 与 cindy/claude-opus-5 均逐字透传;winky/claude-sonnet-4-6 与 winky/claude-opus-4-8 同;窗口已知时仍按窗口决定 [1m]。既有官方裸 id 映射、codex/deepseek/z-ai 条目、防漂移别名用例全部照过)。反证:stash index.ts 后恰好该条新用例失败,其余 13 条照过。
maker-core typecheck 过。
结果:exit 0,全过(零失败)。
手工验证
无(改写语义由单测穷举锁定;官方 CLI 的逐字发送行为以 issue 提报人实测为据)。
未执行的验证
风险
风险分类
低风险。命名空间分支只透传不改写;所有既有显式条目原样迁移进该分支(输出逐字节不变,有回归锁定);裸 id 链不动。
影响与回滚
影响面:maker-core 的 Claude Code SDK 模型串生成(仅目录窗口未知的兜底路径)。远程与移动端适配:模型串在宿主 maker-core 生成后随会话下发,远端会话同样受益,无需额外适配。回滚:revert 单 commit,无 schema 变更。
提交前检查
pnpm test:unit:related(失败项已逐一归因)