Repository navigation
feat: share execution machines and separate CLI model catalogs - #1285
Conversation
|
Reviewed [P2] Apply project eligibility to the personal default fallback. I reproduced this with an online machine set as the owner’s personal default and a writable project that the machine was not shared with. |
|
Re-reviewed [P2] Let owners set their eligible machines as project defaults. In a writable project, the settings page only displays “在此项目使用” for machines owned by other users. I reproduced this with two machines marked usable in the project. The peer's machine had the project-default action, while my own shared machine only had the personal-default action. The local API accepted the owned machine as the project's default and left the personal default intact. An owner with different machines for different projects therefore has no matching settings action. Gate the project action on |
Robert0622
left a comment
There was a problem hiding this comment.
[P1] 机器绑定人失去项目写权限后,机器仍可承接该项目的新任务。 实测将共享机器设为项目默认,再由项目 Owner 将机器绑定人降为 viewer 或移出项目。两种情况下,机器列表仍返回 canUseInProject: true,默认接口仍指向原机器。预期该机器应退出新会话的候选列表和新 SOP 的默认选择。当前资格检查只校验提交人的权限和已保存的共享记录。共享资格检查 · 新 SOP 默认机器解析
[P2] Codex 账号登录模式下,跟随默认执行器的 SOP 仍使用个人 API Key 的模型和思考强度。 在同一台机器配置账号目录 qa-account-only / low 和个人默认 qa-gateway-only / high,分别以账号登录和 API Key 模式启动 SOP。两份运行快照都记录了 qa-gateway-only / high。账号登录时应采用机器账号目录或 CLI 默认值,否则可能把仅个人网关支持的模型传给本机 CLI。SOP 模型选择 · Runner 认证模式
实测
- 核对了 HEAD 和指定的 base...head 差异。Compose 源码构建成功,容器标签与镜像内提交号一致,健康接口返回 200,原 MySQL 容器保持健康。
- 浏览器和 API 验证了真实 Runner 绑定、多项目共享、绑定人设置项目默认、成员选择共享机器,以及未共享项目回退云端。Viewer 设置默认返回 403。显式撤销一个项目的共享后,该项目默认清除,旧草稿再次保存返回 400,另一项目的默认仍有效。
- 共享 Runner 成功执行脚本 SOP。并发上限初始为 10,1001 和 0 可保存,负数返回 400。将绑定人降为 viewer 或移出项目后,均复现机器仍可选且仍为有效默认。
- 浏览器确认 Codex 对话按认证模式显示账号目录或个人目录,清空账号目录后显示内置模型。对比两种模式的新 SOP 快照,复现账号登录模式选错模型和强度。
- 定向 Go 测试 22 项通过,其中 MySQL 集成测试 2 项。Chatbot 测试 106 项和 Web 测试 12 项通过。
- 部署上的 Runner E2E 有 4 项通过,覆盖产物传递、失败后保留产物、必填产物校验和会话鉴权。仓库子 SOP 因用例未配置远端而跳过。管理路由用例使用普通账号,在管理员专用接口收到 403,未完成该用例。
- 使用提供的测试资源查询 Git 测试仓库远端 HEAD 成功。DeepSeek 模型目录请求返回 2 项,CodeBuddy IOA 目录探测列出 36 项。
|
[P2] Check chat compatibility before assigning a shared project default On The project-default action accepts Runner Project default action · Chat admission
|
Robert0622
left a comment
There was a problem hiding this comment.
[P1] 机器绑定人失去项目写权限后,这台机器仍对其他成员可用,也仍是有效的项目默认。 CanUseRunner 只检查「机器是否共享给该项目」和「当前请求者是否有该项目写权限」,没有检查机器的绑定人(runner.OwnerUserID)现在是否还有该项目写权限。复现:bob 把 bobhost 共享给 p1,alice 设 bobhost 为 p1 默认;alice 通过 PUT /api/projects 把 bob 移出 p1 成员;之后 GET /api/runners?projectId=p1 仍返回 bobhost 的 canUseInProject: true,GET /api/runners/default?projectId=p1 仍返回 bobhost,PUT /api/runners/default 仍返回 200。此时 bob 自己已经没有 p1 的写权限,其他人却还能把代码派发到他的机器。这条是上一轮在 0d6d223/9c28075 之后于 49dd598 提的 P1,本轮仍未修复。runner_sharing.go
[P1] 机器撤销共享(或成员被降为 viewer)后,已经锁定执行机器的会话仍然发往原机器。 assistant.go 里锁定分支直接用 old.Execution() 作为目标,不重新调用 CanUseRunner;assistant_process.go 派发前只检查机器是否在线。复现:bob 在 p1 建会话 asbob1,执行目标锁定为 alice 的 laptop 并成功跑过一轮;alice 用 PUT /api/runners/laptop/shared-projects {"projectIds":["p2"]} 撤销 p1 共享;bob 在同一会话再发一轮,POST /api/assistant/generations 仍返回 202,日志显示请求已经走到 requestWorkspace(只是本机没有 daemon 才失败)。把 bob 降为 viewer 结果相同。影响是机器所有者撤销共享后,其他人既有的对话仍能继续在他的机器上执行代码。main 上会话只能用自己的机器,这是本 PR 新引入的。assistant.go · assistant_process.go
[P2] Codex 账号登录模式下,SOP 仍会使用发言人的个人 API Key 模型和思考强度。 sop_executors.go 在用户有个人 Key 时直接返回 preferred.Model/Effort,没有判断执行机器是否处于本机账号登录模式。上一轮在 49dd598 提过,本轮未修复(这一条为读代码确认,未实跑 SOP 执行)。sop_executors.go
实测
- 本轮增量
49dd598只改前端web/app/runners.js与两个 webtest:本人机器的「在此项目使用」按钮、PUT 后保留canUseInProject、当前默认机的禁用状态。逐行看过,这部分没有发现缺陷。 - 共享项目
PUT /api/runners/:id/shared-projects:alice 把自己的 laptop 共享给 p1/p2、desktop 共享给 p1 → 200;bob 共享给非成员项目 → 403;bob 改 alice 的机器 → 403;机器重新注册后共享列表保留。 - 项目默认
PUT /api/runners/default?projectId=:Owner 与 member 设可用机器 → 200;viewer、外部用户 → 403;未共享的项目 → 403;不带 projectId 设别人的机器为个人默认 → 403;撤销共享后user_project_runner_prefs中对应默认已删除。 - 复测上轮两条:
0d6d223的 P2(个人默认回退未做项目资格判断)已修复——alice 个人默认 laptop,在 p3 查询返回runnerId="";9c28075的 P2(本人机器缺少「在此项目使用」)已修复——以 alice 打开 p1,laptop 和 desktop 都出现该按钮,点击后显示「此项目默认 · desktop」,接口projectRunnerId一致。 go test定向(repo/httpapi/domain 的 Runner/Sharing/SOPExecutor/ProjectDefault/Effort 用例)通过;MySQL runner 共享集成测试 3 项通过;webtestmcp-sops-runners、runner-codebuddy-environment共 12 项通过。engine 的 2 个 SharedWorkspace 用例因容器没有bwrap失败,与本 PR 无关。- 未测:没有 runner daemon,会话与 SOP 在共享机器上真正执行、产物传递、两种登录模式下的模型快照对比都未实跑;没有 Docker 与
bwrap。
截图(p1 下的机器列表与默认机)
Robert0622
left a comment
There was a problem hiding this comment.
复测 ed78884e(fix: revalidate runner shares and SOP auth defaults)。
已修复
CanUseRunner/RunnersForUser/SetProjectDefaultRunner现在通过runnerSharedByWritableOwner同时检查机器绑定人当前是否仍有该项目写权限。实测:bob 把 bobhost 共享给 p1,alice 设 bobhost 为 p1 默认(200,projectRunnerId正确);alice 把 bob 移出 p1 后,GET /api/runners?projectId=p1返回空列表,GET /api/runners/default?projectId=p1的projectRunnerId变为空,PUT /api/runners/default?projectId=p1返回 403,SetProjectDefaultRunner400→403 一致。上一轮49dd598的 P1 已修复。- Codex/Claude Code 账号登录模式:
sopExecutorAccess.defaultsFor/runnerLoginDefaults走登录模型目录,不再套用个人默认的 model/effort。这条为读代码确认(新增sop_executors_test.go154 行覆盖)。
仍未修复(P1)
- 已锁定执行机器的会话仍不重新校验共享。
internal/httpapi/assistant.go:172-178的锁定分支直接用old.Execution(),assistant_process.go:157-160派发前只检查机器是否在线,仓库里只有assistant_execution.go:42、runners.go:437调用CanUseRunner。复现路径不变:bob 在 p1 建会话锁定到 alice 的 laptop 并跑过一轮 → alice 撤销 p1 共享 → bob 在同一会话再发一轮,POST /api/assistant/generations仍返回 202 并走到requestWorkspace(本机无 daemon 才中止)。建议在锁定分支和派发前各调一次CanUseRunner,失败时返回明确的「机器已不可用」而不是继续派发。
…ion-machines # Conflicts: # internal/domain/project.go # internal/httpapi/project_write_access.go
Robert0622
left a comment
There was a problem hiding this comment.
复测 23825c0(这次范围是 98fafaf..23825c0:合并 main 的 b0f8680,加上 23825c0 fix: honor runner project grants for scheduled chat)。上一轮的 P1 和本轮第一个 P2 都已修复,但升级后的老会话问题还在,暂不 approve。
已修复
- [P1] 撤销共享后,已锁定的会话还能继续派发。
TestLockedConversationRejectsTurnsAfterRunnerAccessChanges、TestConversationDispatchRechecksRunnerShareBeforeStarting、TestSteerKeepsRunningTurnWhenRunnerShareIsRevoked、TestConversationRunnerDefaultSkipsMachinesThatOnlySupportSOPs在 head 通过。把修复代码换回f8b1de5后,这 4 个用例全部失败。 - [P2] 定时任务用保存人的个人默认机器时,每次运行都被拒绝。现在
scheduleLoginRunner要求机器已经共享给任务所在的项目:保存时,未共享的个人机器直接返回 400;模型目录按projectId判断是否可以用本机登录;撤销共享后,固定会话改用云端新会话。TestScheduleJobUsesSaversDefaultRunnerLogin现在通过。webtestsync-schedule.test.mjs20/20 通过。
仍未修复(P2):升级后,现有项目会话如果锁定在用户自己未共享的机器上,会变成 403
复现方法和上一轮一样:机器 own-laptop 归 owner 所有、没有共享给任何项目,项目 workbench 下有一个锁定在这台机器上的会话,owner 本人调用 POST /api/assistant/chat:
- main:200
f8b1de5:200- head
23825c0:仍然是 403当前无法使用会话绑定的执行机器,请新建对话或联系机器绑定人恢复共享
在 main 上,用户可以在项目会话里直接用自己的机器(newExecutionTarget 只校验 OwnerUserID == userID)。所以升级后,这类老会话会全部不可用,必须先把机器共享给项目。docs/deployment.md:194 仍然写着 “Existing SOPs and conversations keep their bound workspaces”,和现在的行为相反。
建议从下面选一种:
- 升级时为已锁定会话的
(机器, 项目)自动补上共享。 - 在升级说明和这段文档里写明:项目内继续使用个人机器,需要先共享给项目。
定时任务这次已经改成「必须先共享」,会话这边也需要给出一致的迁移方式或说明。
实测
- 原生部署 head(Go 1.26.11,MySQL 8.4.7,按 PR 的 chatbot 重新构建前端),健康检查 200。
- 合并提交
b0f8680的冲突在internal/domain/project.go和internal/httpapi/project_write_access.go。处理方式是保留 #1264 的角色常量,并把HasWritableMember改用ProjectRoleViewer,没有残留冲突标记。 ./internal/httpapi、./internal/repo、./internal/engine中 Assistant、Runner、Schedule、Project 相关用例的失败集合,和 main(c42e224)完全一致(workspace checkpoint 和 MCP 类用例,原因是本机缺 bwrap)。./internal/repo全部通过。
…ion-machines # Conflicts: # internal/httpapi/assistant_process.go
Robert0622
left a comment
There was a problem hiding this comment.
复测 95d5999(范围 23825c0..95d5999:合并 main 的 596ced8,加上 95d5999 docs: explain how to resume project chats after upgrading)。上一轮剩下的 P2 已经按建议的第二种方式处理(在升级说明里写明需要先共享),我按文档在真实升级场景里走了一遍,没有发现新问题,通过。
上一轮 P2 的处理
- CHANGELOG 新增「Upgrade action for personal execution machines」条目,
docs/deployment.md新增 “Upgrading existing project conversations” 一节,原来那句和实际行为相反的 “Existing SOPs and conversations keep their bound workspaces” 已经改掉。 - 新增
TestOwnerResumesLegacyProjectConversationAfterSharingRunner:先断言未共享时返回 403,共享后返回 200,且会话的执行目标没有变、消息数为 4。本机通过。
升级实测(main → 本 PR,同一个库)
- 用 main(
177d881)在全新库上部署,普通用户 alice(非平台管理员)建项目workbench,用 main 构建的 Runner 接入自己的机器alice-laptop(0.12.1,没有共享给任何项目,装了 CodeBuddy CLI)。在项目里新建会话,锁定到这台机器,用 CodeBuddy +deepseek-v4.1-flash跑一轮,返回PRE-UPGRADE-OK。 - 停掉 main,在同一个库上启动本 PR 的平台,Runner 换成本 PR 构建的版本重新连上。在同一个会话里带完整历史再发一条:返回 403
当前无法使用会话绑定的执行机器,请新建对话或联系机器绑定人恢复共享。这和文档描述一致。 - 按文档操作:用 Chromium 打开「执行机器」页,点
alice-laptop卡片上的「共享项目」,弹窗标题是「共享 alice-laptop」,选项里有 Workbench,勾选后保存,按钮变成「共享项目(1)」(截图 1、2)。 - 回到原会话再发一次:返回 202,这一轮在原来那台机器上跑完,回复
POST-UPGRADE-OK。会话的executionTarget仍是{pool: runner, runnerId: alice-laptop},历史是完整的 4 条消息。 - 取消共享后再发,又变回 403;重新共享后恢复正常。
合并提交 596ced8
- 冲突在
internal/httpapi/assistant_process.go的 Runner 派发分支。处理方式是保留本 PR 重新校验共享的分支,并把 #1295 的项目凭据版本检查(SupportsProjectCredentials)放进这个分支,位置在SupportsConversationCLI之后、SupportsCLISettings之前,没有丢失检查,也没有残留冲突标记。
测试
go vet ./...通过;chatbot 493/493 通过。./internal/domain、./internal/gitwork、./internal/repo全部通过。./internal/httpapi、./internal/runtime、./internal/runner、./internal/engine的失败用例是 main(177d881)的子集,没有新增失败,都是本机缺 bwrap、Docker、Chromium 沙箱导致的。
非阻塞建议(P3)
- 机器绑定人本人遇到这个 403 时,提示里的「联系机器绑定人恢复共享」指的其实就是自己。可以考虑在提示里直接写「到 设置 → 执行机器 → 共享项目 把这台机器共享给本项目」,或者链接到升级说明。
…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>
* fix: only offer configured executors in model pickers * fix: show when no executors are available * fix: count shared and runner-login executors as configured 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> * fix(executors): resolve picker credentials on the project default machine 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> * fix(executors): offer cloud pool logins in the executor pickers 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> * test(httpapi): build the cloud-pool picker test without path/filepath #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> --------- Co-authored-by: roberttwang <roberttwang@tencent.com> Co-authored-by: roberttwang <u_dc6754cd1ee5@users.noreply.local> Co-authored-by: Claude Code <noreply@anthropic.com>





What changed
Scope
Compatibility
Validation
npm --prefix chatbot test -- tests/hooks.test.jsx tests/execution-machines.test.jsxpassed 68 tests.node --test webtest/tests/mcp-sops-runners.test.mjs webtest/tests/runner-codebuddy-environment.test.mjspassed 12 tests.python3 scripts/check-public.pypassed.main.Safety