[Bug]: 运行评测接口硬性要求 CodeBuddy Key,其他运行时无法评测
[Bug]: 运行评测接口硬性要求 CodeBuddy Key,其他运行时无法评测
Component / host: Platform — web / API
Edition: Platform
LoopForge version: v0.4.0(自托管镜像,诊断中平台版本显示为 (devel))
What happened?
用非 CodeBuddy 运行时(Pi / Codex / Claude Code 等)跑完一次 SOP,在运行详情里点「评测」, 接口直接返回:
请先在个人配置中配置自己的 CodeBuddy API Key
而这次运行与 CodeBuddy 无关。用户为了用评测功能,被迫去配置一个与本次运行不相干的凭据。
原因链(代码定位)
internal/httpapi/run_eval.go:96-100(POST /api/runs/:id/eval):
user, ok := h.repo.User(current.ID)
if !ok || strings.TrimSpace(user.CodeBuddyAPIKey) == "" {
c.JSON(http.StatusBadRequest, map[string]string{
"error": "请先在个人配置中配置自己的 CodeBuddy API Key",
})
return
}
这里没有任何"当前运行/当前会话用的是哪个运行时"的判断,一律按 CodeBuddy 判定。
同一个平台里正确写法是有的 —— internal/httpapi/assistant_engines.go:250 的 assistantTurnUser:
engine, id := assistantModelEngine(model)
if engine != assistantEngineCodeBuddy {
} else if key, _ := assistantEngineCredential(stored, engine); key == "" {
return stored, "", assistantEngineMissingKey(engine) // 报的是该运行时缺 Key
}
...
}
// 只有 CodeBuddy 才要求 CodeBuddy Key
评测路径没有复用这套判断。
影响
- 非 CodeBuddy 运行时的用户,SOP 跑完后无法评测。
- 评测是"这次跑得好不好"的唯一入口,等于该能力对这部分用户完全关闭。
- 错误提示把用户引向一个无关的配置项,用户会误以为"必须配 CodeBuddy 才能用平台"。
相关
这与 #1087(引导接口硬性要求 CodeBuddy Key)是同一类问题: 新功能入口默认按 CodeBuddy 写凭据判断,没有按运行时分支。 建议一并统一,避免后续新增入口继续复制这个模式。
期望行为
评测入口复用 assistantTurnUser 一类按运行时判定的逻辑:
- 当前运行/会话是哪个运行时,就检查哪个运行时的凭据;
- 缺凭据时报该运行时的名称(
assistantEngineMissingKey已具备这个能力); - 只有确实需要 CodeBuddy 时,才要求 CodeBuddy Key。
Reproduction
- 平台 v0.4.0,个人配置只填 Pi(或其他非 CodeBuddy 运行时)的 Key,不填 CodeBuddy Key。
- 用 Pi 跑完一次 SOP。
- 在运行详情页点「评测」。
- 返回 400:
请先在个人配置中配置自己的 CodeBuddy API Key。
对照组:同样账号在 AI 对话里正常提问,一切正常 —— 说明凭据本身没问题,是评测这条路单独判错了。
Sanitized diagnostics
{
"request": "POST /api/runs/<run>/eval",
"response": { "status": 400, "body": { "error": "请先在个人配置中配置自己的 CodeBuddy API Key" } },
"account": { "personalCodeBuddyKeyConfigured": false, "engineKeyConfigured": true }
}
Safety checks
- [x] 已移除凭证、私有端点、内部标识与个人数据。
- [x] 已检索现有 issue,未发现重复。
感谢反馈。我理解的情况是:用非 CodeBuddy 运行时跑完 SOP 后,在运行详情里点「评测」会提示先配置 CodeBuddy API Key,和这次运行实际使用的运行时无关。
已经看到这条 Issue,会按现有 Issue 排期查看。
I’m working on the evaluator runtime/credential path. The change removes the unconditional CodeBuddy-only restriction, preserves an explicitly selected evaluation model, and reuses a single concrete CLI/model recorded by the SOP when no choice was saved. Mixed/ambiguous runs require an explicit evaluator choice.
The selected CLI runs with the current user's own API Key and reports that CLI when its key is missing. This scope does not route evaluations through runner-local login or add shared CodeBuddy sponsorship. I’m validating both the real non-CodeBuddy CLI invocation path and the UI selection/POST behavior; existing digest/scoring PRs such as #1059/#1060 are separate.