Conversation
There was a problem hiding this comment.
Findings
- [Major]
PROVIDER_GATEWAY_INCOMPATIBLE误判到非 Anthropic provider — 当前分支在命中looksLikeGatewayMissingMessagesApi(err)时没有限制 provider,可能把 OpenAI/Google 等返回的普通501/not implemented也映射成 Anthropic Messages API 不兼容,导致 UI 给出错误引导。证据:packages/core/src/errors.ts:109。
Suggested fix:if ( provider === 'anthropic' && !(err instanceof CodesignError && err.code === ERROR_CODES.PROVIDER_GATEWAY_INCOMPATIBLE) && looksLikeGatewayMissingMessagesApi(err) ) { return new CodesignError(err.message, ERROR_CODES.PROVIDER_GATEWAY_INCOMPATIBLE, { cause: err, }); }
Summary
Review mode: initial
发现 1 个 Major 问题(provider 作用域缺失导致错误分类)。其余本次改动中未发现新增依赖、直连 provider SDK、静默 fallback 或 UI token 违规。docs/VISION.md、docs/PRINCIPLES.md 在当前 checkout 中不存在(Not found in repo/docs),因此未能基于这两份文档做交叉校验。
Testing
Not run (automation)
open-codesign Bot
| // "not implemented" while their /v1/models endpoint works. Catch that shape | ||
| // before any other classification so the UI can suggest switching wire | ||
| // instead of the misleading default "check your API key" message. | ||
| if ( |
There was a problem hiding this comment.
这里缺少 provider 作用域判断。当前逻辑会把任何 provider 的 501/not implemented 都标记为 PROVIDER_GATEWAY_INCOMPATIBLE,但该错误文案是 Anthropic Messages API 专用,存在误导风险。
建议最小修复:
if (provider === 'anthropic' && looksLikeGatewayMissingMessagesApi(err)) {
// ...
}6dff02d to
25e81de
Compare
There was a problem hiding this comment.
Findings
- [Major]
PROVIDER_GATEWAY_INCOMPATIBLE仍会误判到非 Anthropic provider — 当前分类逻辑只要命中looksLikeGatewayMissingMessagesApi(err)就直接改写错误码,没有限制provider === 'anthropic',会把其他 provider 的普通501/not implemented也映射成 Anthropic Messages API 不兼容,导致错误引导。证据:packages/core/src/errors.ts:109。
Suggested fix:if ( provider === 'anthropic' && !(err instanceof CodesignError && err.code === ERROR_CODES.PROVIDER_GATEWAY_INCOMPATIBLE) && looksLikeGatewayMissingMessagesApi(err) ) { return new CodesignError(err.message, ERROR_CODES.PROVIDER_GATEWAY_INCOMPATIBLE, { cause: err, }); }
Summary
Review mode: follow-up after new commits
仍有 1 个 Major 问题(provider 作用域缺失导致错误分类);其余本次变更中未发现新增依赖、直连 provider SDK、静默 fallback 或 UI token 硬编码。docs/VISION.md、docs/PRINCIPLES.md 在当前 checkout 不存在(Not found in repo/docs),未能据此交叉校验。
Testing
Not run (automation)
open-codesign Bot
| // instead of the misleading default "check your API key" message. | ||
| if ( | ||
| !(err instanceof CodesignError && err.code === ERROR_CODES.PROVIDER_GATEWAY_INCOMPATIBLE) && | ||
| looksLikeGatewayMissingMessagesApi(err) |
There was a problem hiding this comment.
这里仍缺少 provider 作用域。当前会把任何 provider 的 501/not implemented 都映射为 PROVIDER_GATEWAY_INCOMPATIBLE,但该文案是 Anthropic Messages API 专用,存在误导风险。
建议最小修复:
if (
provider === 'anthropic' &&
!(err instanceof CodesignError && err.code === ERROR_CODES.PROVIDER_GATEWAY_INCOMPATIBLE) &&
looksLikeGatewayMissingMessagesApi(err)
) {
return new CodesignError(err.message, ERROR_CODES.PROVIDER_GATEWAY_INCOMPATIBLE, {
cause: err,
});
}There was a problem hiding this comment.
Findings
- No new blocker/major/minor findings on the latest diff.
Summary
- Review mode: follow-up after new commits
- 本次新增提交已修复上一轮指出的误分类问题(按
wire === 'anthropic'限定 gateway incompatibility 检测),在本次变更触及范围内未发现新的正确性/安全性/约束违规问题。 docs/VISION.md、docs/PRINCIPLES.md:Not found in repo/docs(当前 checkout 不存在),因此无法基于这两份文档做交叉一致性复核。- 残余风险:
looksLikeGatewayMissingMessagesApi仍依赖上游错误文案模式匹配,后续若网关文案变化可能需要补充 pattern 与回归用例。
Testing
- Not run (automation)
open-codesign Bot
…nable error (#158) Third-party Anthropic relays (sub2api, claude2api, anyrouter…) often implement GET /v1/models but stub POST /v1/messages with "not implemented" / 501. The connection test passes but real generation fails. Previously this was treated as a retryable 5xx — users waited three rounds of exponential backoff only to see a generic "check your API key" message that points them in the wrong direction. - Add looksLikeGatewayMissingMessagesApi in @open-codesign/providers - Short-circuit retry.ts on 5xx + not-implemented bodies - Tag the error with new PROVIDER_GATEWAY_INCOMPATIBLE code in core's remapProviderError so the UI surfaces an actionable message (switch wire to openai-chat, or use a gateway that supports the Messages API) - Locale entries for en and zh-CN Signed-off-by: hqhq1025 <1506751656@qq.com>
…re (#158) The "not implemented" → PROVIDER_GATEWAY_INCOMPATIBLE remap (and the matching retry short-circuit) only makes sense for Anthropic-compatible endpoints — the actionable hint tells the user to switch wire to openai-chat, which is misleading when the user is already on an OpenAI/Google wire and just hit a transient 501. Gate both call sites on wire === 'anthropic': non-anthropic wires fall through to the generic PROVIDER_ERROR path and keep retrying 5xx normally. Adds counter-example tests on openai-chat / openai-responses. Signed-off-by: hqhq1025 <1506751656@qq.com>
3e26a3a to
87e1b9c
Compare
There was a problem hiding this comment.
Findings
- 未发现达到可报告阈值的 Blocker/Major/Minor/Nit 问题(基于本次新增/修改行)。
Summary
- Review mode: follow-up after new commits
- 已按最新 PR diff 全量复核本轮改动(12 files),未发现由本次变更引入的正确性、安全性(OWASP Top 10 相关)、约束违规(直接 SDK 导入、静默降级、UI token 违规、新增依赖许可/体积)问题。
docs/VISION.md、docs/PRINCIPLES.md: Not found in repo/docs(当前 checkout 不存在),无法据此做交叉一致性复核。- 残余风险:
looksLikeGatewayMissingMessagesApi仍为文案模式匹配,若第三方网关返回文本变体变化,需补充 pattern 与回归用例。
Testing
- Not run (automation)
open-codesign Bot
Summary
第三方中转(sub2api / claude2api / anyrouter / cpa 反代等)经常实现了 `/v1/models` 但没实现完整的 Anthropic Messages API。结果:测试连接通过,真实生成 500 not implemented。当前文案是通用 "The provider returned an error. Check your API key" —— 完全误导用户。
What changed
Test plan
Closes #158