缺陷 / 高 / LLM 适配器
electron/harness/adapters/base-adapter.ts
mapError 通过 err.message.includes('401') 判断认证失败,includes('429') 判断限流。 这会误匹配:
err.message.includes('401')
includes('429')
gpt-4-29b
误判后:
if (err.response?.status === 401) { return new MetonaError('AUTH_FAILED', 'Authentication failed', false); } if (err.response?.status === 429) { return new MetonaError('RATE_LIMITED', 'Rate limited', true); }
/\b401\b/
文件: electron/harness/adapters/base-adapter.ts
修复: mapError 优先读取 error.status(throwHttpError 已设置)判断 401/429,移除 msg.includes('401')/msg.includes('429') 数字字符串匹配,保留 'unauthorized'/'rate limit' 单词匹配作为兜底。避免误匹配 URL 端口号等数字。
error.status
msg.includes('401')
msg.includes('429')
'unauthorized'
'rate limit'
验证: tsc --noEmit 类型检查通过。
tsc --noEmit
No dependencies set.
The note is not visible to the blocked user.
问题类型
缺陷 / 高 / LLM 适配器
文件位置
electron/harness/adapters/base-adapter.ts问题描述
mapError 通过
err.message.includes('401')判断认证失败,includes('429')判断限流。这会误匹配:
gpt-4-29b误判后:
影响
建议修复
/\b401\b/使用单词边界修复说明
文件:
electron/harness/adapters/base-adapter.ts修复: mapError 优先读取
error.status(throwHttpError 已设置)判断 401/429,移除msg.includes('401')/msg.includes('429')数字字符串匹配,保留'unauthorized'/'rate limit'单词匹配作为兜底。避免误匹配 URL 端口号等数字。验证:
tsc --noEmit类型检查通过。