Repository navigation
fix: only offer configured executors in model pickers - #1291
Conversation
crispinhu27
left a comment
There was a problem hiding this comment.
审查结论:Request changes(head 21584772,base d2462fa5)
需要修改
- 一个已确认的 P2 回归,详见行内评论:
/api/executor-models的configured只认个人 Key。 - 后果是共享 CodeBuddy Key 用户和执行机账号登录用户在角色向导、SOP 预览里看不到任何可选执行器。运行时和
/api/assistant/models都认为这些执行器可用;merge-base 上这些用户也能正常选择。
已验证没有问题的部分(隔离环境、合成数据)
go test ./web/通过。- 定向
go test ./internal/httpapi/(Executor、Catalog、CLIModel、Schedule、Preview、Approval 等)共 172 项通过。 - 定向
go test ./internal/engine/通过。 internal/httpapi全量在 head 和 merge-base 上的失败集合完全相同,原因是环境里缺 bwrap、浏览器等,与本 PR 无关。- webtest 4 个相关文件 37/37 通过;chatbot vitest 487 项通过。
- 浏览器实测:个人 Key 用户的执行器过滤正确;历史执行器显示为禁用项,已存模型保留;「跟随责任人默认执行器」选项保留。
- CI 全部通过。
未做的验证
- 通知 bot 和自定义审批的完整 UI 流程需要真实 CLI / runner 才能走完,只核对了代码路径和接口返回。
- 审批审查改成
e.personal ?? e.configured后,对账号登录用户也会隐藏 codex,与assistant_approval_review.go的 runner 登录检查可能不一致。这一点没有完整复现,不作为本次阻塞项。 - 浏览器截图只保存在本地,GitHub API 不能给 review 评论上传图片,所以没有附上。
|
结论:建议合入 GitHub 拒绝了 Pull Request Review 接口(HTTP 403:Tencent 组织启用了 OAuth App 访问限制)。当前账号无法提交正式 Approve / Request changes。以下改为普通评论。 核对了角色、SOP 预览、定时任务和审批审查的执行器列表:只有当前用户自己配过凭据的执行器可选,丢了凭据的历史选项会禁用并保留原来的模型。执行器目录增加了 configured,并且不会把别人的配置状态返回给其他用户。相关前端测试覆盖了刷新、禁用和保存。CI 已全部通过,与 main 可合并。 |
The executor model catalog marked a CLI configured only when the caller saved a personal key, so users on the platform's shared CodeBuddy Key or with account login on their default runner saw no executors in the role wizard and SOP preview, although SOP runs accept them. Reuse the SOP run credential check for `configured` and report the personal key separately as `personal`. Co-Authored-By: Claude Code <noreply@anthropic.com>
crispinhu27
left a comment
There was a problem hiding this comment.
复审 6ba8748e(base main d2462fa5)。上次 REQUEST_CHANGES 6037220793 和补充说明 6037313703 都针对 21584772。
历史问题
- [P2]
configured只看个人 Key,共享 CodeBuddy Key 用户和执行机账号登录用户被当成未配置:FIXED。接口层和浏览器端都实测过,21584772上能复现,head 上不再出现,详情见原线程。
增量 21584772..6ba8748e(4 个 Go 文件)
sop_executors.go拆出hasCredential:个人 Key、共享 CodeBuddy Key 或执行机RuntimeAuthLocal三者有一个就算有凭据。- 逐分支对比过,结果与运行时
defaults()和selectSOPExecutionTarget的选择一致,defaults()本身没有改。 - 边界情况:未登录用户不会被误判为有共享 Key;保存共享 Key 的管理员本人不算借用共享 Key;执行机被删除后,退回到个人 Key 或共享 Key 的判断。这三种都与运行时一致。
- 逐分支对比过,结果与运行时
executor_models.go改用新的凭据判断,新增personal字段,接口不会返回其他用户的状态。- "没有个人 Key 的用户,CodeBuddy 模型列表为空"在 merge-base 上就是这样,不是本 PR 引入的。
验证(隔离环境,最小环境变量,不含凭据,Go 1.26.11)
go build ./...和go vet(engine/httpapi/domain/repo/web)通过。go test(engine/httpapi/domain/repo/web):head 3449 通过 / 108 失败,215847723448 通过 / 107 失败。- 多出的一项是
TestPipelinedFramePollsKeepUpWithTheBrowser,负载下的计时抖动,单独重跑 3 次都通过。 - 其余失败两边完全相同,都是本机缺 bwrap 或浏览器导致的。
- 新增和相关的执行器测试都通过。
- 多出的一项是
- 前端:chatbot 的 vitest 487/487 通过;webtest
npm run coverage235/235 通过,行覆盖率 85.38%。 - 浏览器端到端(MariaDB 隔离库,真实 Chromium):角色向导的执行器下拉框在三类用户下都符合预期。
- CI 16 项全部成功。
未单独验证:SOP 预览节点和 SOP 设计器的下拉框没有在浏览器里单独走一遍,它们和角色向导用的是同一个接口和渲染函数;通知 bot 和审批审查的完整 UI 需要真实 CLI,没有跑,这次增量也没有改它们。
非阻塞说明:选择器只看凭据,不检查默认执行机是否装了对应 CLI,没装的要到运行前检查才被拦下。这是作者说明过的设计,不算回归。
本次审查只覆盖上述 head,不代表代码没有缺陷。
# Conflicts: # internal/engine/sop_executors.go # internal/engine/sop_executors_test.go # webtest/tests/sync-schedule.test.mjs
crispinhu27
left a comment
There was a problem hiding this comment.
复审 head e47507a7(合并 main c3dd1b4d),上次 APPROVE 时的 head 是 6ba8748e。
合并核对:git diff d2462fa5 6ba8748e 和 git diff c3dd1b4d e47507a7 逐行比对过。唯一的实质冲突解决在 sop_executors.go:hasCredential 改成了 main 新增的 runnerLogin()(RuntimeAuthModeForUser),另外 sync-schedule.js 同时保留了 #1285 的 projectQuery 和本 PR 的 catch 兜底。PR 和 #1285 的改动都没有丢。
历史问题:只有共享 CodeBuddy Key、或者执行机账号登录的用户被当成未配置的 [P2],在当前 head 上复测仍为 FIXED。handler 级测试覆盖了四种情况,结果都符合预期:无凭据为空;自己默认机上账号登录时 codex/agy=true;只有共享 Key 时 codebuddy=true;别人共享过来的机器上的账号登录不算(不会泄露)。
新问题(阻塞):合入 #1285 后,执行器列表没有考虑项目默认执行机,详见行内评论 [P2]。
验证:go build ./... 和相关包的 go vet 通过。engine/httpapi 里与执行器、执行机共享、定时任务、审批审查相关的用例全部通过;其余失败都是本机缺沙箱造成的,在 main 上同样失败。webtest 286/286,chatbot vitest 494/494,CI 16 项全绿。另外在本地 MariaDB 上真实起了 head 和 main 两个平台,用 HTTP 和 Chromium 做了对照。
另外:main 已前进到 f3d4f41a(#1284),它改了 internal/engine/sop_executors.go,本 PR 现在和 main 有冲突,需要再合一次 main。
|
结论:需要修改 GitHub 拒绝了 Pull Request Review 接口(HTTP 403:Tencent 组织启用了 OAuth App 访问限制)。当前账号无法提交正式 Approve / Request changes。以下改为普通评论。 与 main 冲突(mergeable_state=dirty)。检查项均已成功。我看了 |
Co-Authored-By: Claude Code <noreply@anthropic.com>
…hine Project SOPs run on the user's project default machine (#1285), but /api/executor-models only checked the personal default, so a user whose only machine login was on the project default saw no usable CLI in the role wizard. ExecutorCredentials now resolves the machine with ResolveRunnerDefaults(user, project), and the role and SOP editors pass the current project and cache the catalog per user and project. Co-Authored-By: Claude Code <noreply@anthropic.com>
Robert0622
left a comment
There was a problem hiding this comment.
CR + 部署实测:LGTM,可以合入(head f006f3a4)
这一轮重点看了新提交 f006f3a(执行器列表改按项目默认执行机器判断,修 crispinhu27 提的 P2),以及 1501135 合并 main 7bebfa5 的结果。
代码
ExecutorCredentials(store, user, projectID)用ResolveRunnerDefaults(user, project)选机器,和selectSOPExecutionTarget新建运行时的选法一致:先用项目默认机器,再在项目可用时退回个人默认机器。/api/executor-models透传projectId。- 前端
executorModelCatalogKey()按「用户 + 当前项目」缓存目录,切换项目后不会沿用上一个项目的「已配置」结果。角色向导和 LOOP/SOP 编辑器(flows.js)共用同一个加载器,两处都带上了项目。 projectId只影响调用者本人的默认机器解析。传一个没有权限的项目时,ResolveRunnerDefaults取不到机器,结果是「未配置」,不会泄露别人的信息。
部署实测(本机原生部署 MySQL 8.4.7 + 真实执行机器,没有用本仓库做测试对象)
- 场景:成员 alice 没有个人默认执行机器。她自己的执行机器只共享给项目
p-picker,并设为该项目的默认机器;机器上 Claude Code 是本机登录。 GET /api/executor-models:不带项目时,claude为 configured=false;带?projectId=p-picker时为 true;带?projectId=welcome(项目没有默认机器)时为 false。符合预期。- Chromium 打开角色向导:在
p-picker下,执行器下拉框是「跟随责任人默认执行器 / Claude Code」,缓存键是2\np-picker;切到welcome,显示「无可用执行器」。 - 真实运行:在
p-picker里用这个角色跑一个 LOOP,任务派到了项目默认机器runner-Kh4zciZkvpfG3n0W(日志:任务下发到执行机器 …(provider=claude-code))。Claude Code 用 deepseek-flash 跑完,运行 succeeded。说明选择器判断用的机器和实际运行用的机器是同一台。 - 测试:
go test ./internal/engine -run Executor、./internal/httpapi -run 'ExecutorModels|AssistantModels|Catalog'、./web都通过;webtest 里 assets-agents、flows-editor、bots、sync-schedule 共 45/45 通过;chatbot 的 sop-designer 14/14 通过。go vet ./...干净。 - CI:当前 head 全部检查通过。
crispinhu27 的 P2 在这个 head 上已修,需要他再看一眼并解除「要求修改」。
crispinhu27
left a comment
There was a problem hiding this comment.
复审 head f006f3a4(base main 7bebfa50)。上次 REQUEST_CHANGES 6044721901 针对的是 e47507a7。
合并核对:15011358 合入 main 7bebfa50(#1284、#1279)。把 git diff c3dd1b4d e47507a7 和 git diff 7bebfa50 15011358 逐行比对,实质差异只在 sop_executors.go 及其测试:newSOPExecutorAccess 改收 TelemetryContext,同时保留了 #1284 的 execution: ec / sopRunnerAuthMode 和本 PR 的 hasCredential / ExecutorCredentials。#1279 与本 PR 没有交集,两边的改动都没有丢。
历史问题
- [P2] 执行器列表按个人默认机判断、没考虑项目默认执行机:FIXED,在 head 上按原步骤真实起平台 + Chromium 复测,详见原线程。
- 更早的 [P2](只有共享 CodeBuddy Key 或执行机账号登录的用户被当成未配置):仍为 FIXED(真实 HTTP 复测账号登录;共享 Key 用 handler 测试复测)。
新问题(阻塞):项目走云端执行池、用户没有默认机时,选择器与运行时选机不一致,详见行内评论 [P2]。
验证(隔离环境、最小环境变量、合成数据)
go build ./cmd/agentflow、go vet ./...通过。engine/httpapi/domain/repo/application/web 的 go test,head 与 main7bebfa50失败集合完全一致(都是本机沙箱类用例),执行器、执行机共享相关的定向用例全部通过。- webtest 288/288,chatbot vitest 495/495。
- 本地 MariaDB 上真实起了 head、
e47507a7、main 三个平台,用 HTTP 和 Chromium 对照。 - CI 当前 head 全部通过。
未验证:真实云端执行池的多机混合(能力不同的池机器)没有覆盖。
A project SOP whose responsible user has no default machine runs on a cloud pool runner with that runner's account login, but the pickers only looked at the default machine and showed no executor at all. Resolve credentials the same way selectSOPExecutionTarget does and count a CLI when any online pool runner logs it in. Co-Authored-By: Claude Code <noreply@anthropic.com>
Robert0622
left a comment
There was a problem hiding this comment.
CR + 部署实测:可以合入(head 0082b549)
本轮处理了 crispinhu27 在 f006f3a4 上提的 [P2](项目走云端执行池、用户没有默认机时,选择器看不到运行时会用的 CLI),修复说明见 #1291 (comment) 。
代码
(*Engine).ExecutorCredentials(userID, projectID)和selectSOPExecutionTarget的选机顺序一致:有默认机(项目默认 → 项目可用时的个人默认)只看这台;没有默认机且池覆盖该项目时,任一在线、可接池任务的池机器(无主、带池 label、版本够)对某个 CLI 是账号登录就算已配置。这样就不依赖pickPoolRunner的随机结果。池里没有在线机器时,只算个人 Key 和共享 CodeBuddy Key。/api/executor-models有 engine 时用这个方法,没有 engine 的单测装配仍走原来的ExecutorCredentials(store, …)。
部署实测(本机部署 MariaDB 11.8 + 真实 Runner,没有用本仓库做测试对象)
- 同样的数据在 f006f3a、0082b549、main 7bebfa5 三个平台上对照(池 label
pool、只覆盖p-pool,用户没有默认机也没有 Key):executor-models?projectId=p-pool:f006f3a4 全为 false(复现),0082b549 上claude=true;p-plain和不带项目时都是 false。- Chromium 角色向导:f006f3a4 只有「无可用执行器」;0082b549 是「跟随责任人默认执行器 / Claude Code」;p-plain 下仍是「无可用执行器」,已保存的 Claude Code 角色显示「(未配置)」。没有页面报错。
- 真实 LOOP:指定 Claude Code 的角色、跟随默认执行器的角色,都派到池机器(
executionPool=cloud),Claude Code + deepseek-flash 跑完,两次都 succeeded,产物已上传。 - 再配上个人 CodeBuddy Key:codebuddy 为 personal,claude 仍可选;把池机器停掉之后,claude 立即变回未配置。
- 测试:新增 engine/httpapi 回归测试(修复前失败),webtest 288/288,chatbot 495/495,
go test ./web通过;Go 全量失败集合与 main 一致,都是本机缺 Docker / Chromium 的环境用例。 - CI:16/16 通过。第一次
core挂在TestChatClarificationEdgePaths(bot 澄清,5 秒等待超时),这个 PR 没有改它,本机连跑 5 次都通过,重跑后通过。
需要 crispinhu27 再看一眼,解除「要求修改」。
crispinhu27
left a comment
There was a problem hiding this comment.
复审 head 0082b549(base main 7bebfa50,与当前 main 一致)。上次 REQUEST_CHANGES 6046876002 针对的是 f006f3a4。
审查范围:增量 f006f3a4..0082b549,4 个文件。
- 新增
(*Engine).ExecutorCredentials:有默认机时只看这台;没有默认机、池覆盖该项目时,任一台eligiblePoolRunners上账号登录就算已配置。逐分支和selectSOPExecutionTarget、cloudPoolRunner、pickPoolRunner对照过,选机顺序和资格条件(无主、带 label、在线、版本)都一致。 /api/executor-models有 engine 时改用新方法,没有 engine 的装配仍走原来的函数。其他调用方不受影响。
历史问题
- [P2] 项目走云端执行池、用户没有默认机时,选择器看不到运行时会用的 CLI:FIXED。在 head 上按原步骤用真实平台、HTTP 和 Chromium 复测,
f006f3a4上同样的数据仍能复现,详见原线程(已 resolve)。 - 更早的两条 [P2](共享 Key / 执行机账号登录被当成未配置;没考虑项目默认执行机):这次增量没有改相关路径,相关 handler 和 engine 用例在 head 上仍通过。
验证(隔离用户、最小环境变量、不含凭据,Go 1.26.11,MariaDB 11.8,合成数据)
go build ./cmd/agentflow、go vet ./internal/engine ./internal/httpapi通过。- 定向用例通过:engine
Executor|Pool,httpapiExecutorModels|AssistantModels|Catalog|CLIModel|Preview|Approval|Schedule。新增的两个回归测试放到f006f3a4上都会失败。 - 全量
go test(engine/httpapi/domain/repo/web):head 2416 通过、95 失败;f006f3a42414 通过、95 失败。失败集合完全一致,都是本机缺 bwrap、浏览器沙箱等环境原因,另有 1 项是本地没有构建 chatbot 产物。head 多出的 2 项通过就是新增的测试。 - 运行时一致性:head 上 p-pool 的 Claude Code 角色发起运行,派到池机器
pool1(executionPool=cloud),Runner 任务为claude-code、credentialSource=local,和选择器结论一致。池机器离线、有主、没有 label、版本过低时,选择器都不算已配置。未登录请求返回 401。 - CI 16/16 通过。
非阻塞说明:管理员不是 p-pool 成员时查 ?projectId=p-pool,也会看到池机器的登录(claude=true)。这只反映平台池的能力,不涉及其他用户的凭据,不影响本次结论。
未验证:没有接入真实 Runner 和模型把运行跑完(池机器是直接写库的合成记录,只验证到下发任务这一步);没有覆盖多台能力不同的真实池机器;前端没有改动,这次没有重跑 webtest 和 chatbot。
本次审查只覆盖上述 head,不代表代码没有缺陷。
#1223 replaces every filepath.Join(t.TempDir(), "workspaces") in catalog_test.go with sandboxRoot(t) and drops the path/filepath import. The new TestExecutorModelsConfiguredFollowsTheCloudPool still used filepath, so merging both PRs (in either order, no textual conflict) broke the internal/httpapi test build. The test only reads the executor catalog, so a plain t.TempDir() is enough and compiles on both bases. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Cross-PR fix pushed: While trial-merging all approved open PRs onto #1223 replaces every Verification:
CI on The push dismissed the earlier approval, so this needs a re-approval. Product code is unchanged from 0082b54. |
crispinhu27
left a comment
There was a problem hiding this comment.
复审 head 720466ab(base main 7bebfa50;上次 Approve 的 0082b549 被新推送撤销)。
审查范围:0082b549..720466ab 只有 1 个提交,只改测试:internal/httpapi/catalog_test.go 一行,TestExecutorModelsConfiguredFollowsTheCloudPool 里的 runtime.NewManager(filepath.Join(t.TempDir(), "workspaces")) 改成 runtime.NewManager(t.TempDir())。这个测试只读执行器目录,不碰工作区,改法等价。产品代码和 0082b549 完全相同,之前 [P2](云端执行池项目在选择器里看不到池机器登录的 CLI)的复测结论 FIXED 仍然适用。
验证(隔离环境,执行 PR 代码时清空了环境变量)
- 和 #1223 的语义冲突:在 main
1f10ccf7上依次合入 #1223(f32d4dc4)和本 PR。用旧 head0082b549时go vet ./internal/httpapi失败,报catalog_test.go:977:44: undefined: filepath;用720466ab时通过。 go vet ./internal/httpapi在 head、0082b549、head 合入 main1f10ccf7三份代码上都通过。go test ./internal/httpapi三份的失败集合完全一样(25 条,都是本机没有 bwrap、浏览器沙箱造成的),TestExecutorModelsConfigured*2/2 通过。- CI:
720466ab16/16 通过。
没有发现新的阻塞问题。
…tests main 058a530 does not compile internal/engine tests: #1339 added the allowAuto argument to selectSOPExecutionTarget and #1291's new tests still call the one-argument form, so go vet and the core job fail for every PR merged onto main. This is the same three-line change as #1345, so the two PRs merge cleanly in either order. Co-Authored-By: Claude Code <noreply@anthropic.com>
What changed
Role and SOP preview pickers now offer executors configured by the signed-in user. The assignee-default option remains available. A saved executor that has lost its credentials remains visible as a disabled choice, and its stored model is preserved.
Availability is resolved on the machine a new SOP run would use: the caller's project default, then the personal default when the project may use it. Without a default machine, CLIs logged in on any online cloud pool runner that serves the project also count, because the run goes to the pool.
The SOP designer, AI schedules, notification bots, and custom approval review follow their respective credential requirements. A list of saved models alone does not make an executor selectable.
Scope
Compatibility
The executor model API adds a personal configuration flag. Existing role and preview data continue to load with their saved selections. Database migrations are unnecessary.
Validation
go test ./web, four targeted web regression cases, and all 487 chatbot tests.Safety