飞书桥接 + AWS Bedrock Provider:Claude 模型被误报为协议不匹配
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- backend-api-design
Research direction
Read the Claude-model guard in src/lib/bridge/conversation-engine.ts and compare its protocol allowlist with CLAUDE_CODE_READY_PRESETS in runtime-compat.ts. Check how the Feishu bridge resolves the provider and model, then verify that Bedrock and Vertex Claude models no longer trigger the mismatch error while unsupported protocols still do.
Written by the indexing model from the issue text.
Description
问题描述
在飞书桥接(Feishu Bridge)中,将 Provider 配置为 AWS Bedrock(protocol: 'bedrock')并使用 Claude 模型(如 global.anthropic.claude-sonnet-5)时,发送消息会报错:
Error: Provider "AWS Bedrock" uses bedrock protocol but model "global.anthropic.claude-sonnet-5" is an Anthropic model. Please configure the correct provider for this bridge channel.
即使模型 ID 是 Bedrock 上真实存在、可用的模型,该报错依然会触发,无法正常使用。
根因
src/lib/bridge/conversation-engine.ts 附近(约第 183-191 行)有一段 fail-fast 保护逻辑:
const isAnthropicModel = modelLower.includes('claude') || ['sonnet','opus','haiku'].includes(modelLower);
const isNonAnthropicProtocol = !['anthropic', 'openai-compatible', 'openrouter'].includes(resolved.protocol);
if (isAnthropicModel && isNonAnthropicProtocol) {
throw new Error(...);
}
问题在于协议白名单 ['anthropic', 'openai-compatible', 'openrouter'] 里漏掉了 bedrock 和 vertex。而 AWS Bedrock 和 Google Vertex AI 恰恰是官方支持、专门用来托管运行 Claude/Anthropic 模型的两个云协议——这一点可以从代码库自身另一处常量得到印证(runtime-compat.ts):
const CLAUDE_CODE_READY_PRESETS = new Set(['anthropic-official', 'bedrock', 'vertex']);
这里已经明确把 bedrock、vertex 和 anthropic-official 并列,认定它们都是能正常运行 Claude Code 的正规协议。
因此,只要 provider 的 protocol 是 bedrock(或 vertex),并且模型名包含 "claude"/"sonnet"/"opus"/"haiku",这条 guard 就会必定误报,把"协议本来就是用来服务 Anthropic 模型的"错误判断为"协议和模型不匹配"。
复现步骤
- 在 CodePilot 中新建一个 Provider,protocol 选择
bedrock,配置好 AWS 凭证。 - 将该 Provider 设为某个飞书桥接频道/群的默认 Provider,模型填一个真实存在的 Claude 模型 ID(例如
global.anthropic.claude-sonnet-5)。 - 在飞书里给机器人发消息。
- 收到报错:
Provider "AWS Bedrock" uses bedrock protocol but model "..." is an Anthropic model...
建议修复
将 conversation-engine.ts 中的协议白名单补全为:
const isNonAnthropicProtocol = !['anthropic', 'openai-compatible', 'openrouter', 'bedrock', 'vertex'].includes(resolved.protocol);
环境
- CodePilot 桌面版(macOS)
- 触发场景:飞书消息桥接(Feishu Bridge)+ AWS Bedrock Provider
- Dominant language
- TypeScript
- Stars
- 6.5k
- Forks
- 697
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from op7418/CodePilot
-
发生错误时提醒Error:successOpenbug P0-crash-or-interrupt
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Effort selector dropdown hidden for GLM models — blocks access to GLM-5.2 High/Max effort tiersOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug P0-crash-or-interrupt
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
无法正常应用内更新Openbug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
All issues in op7418/CodePilot
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
backnotprop/plannotator#2914 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/vscode-containers#655 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
dsh-tauri-desk/deepseek-harness-desktop#1477 · 1 comment ·