Repository navigation
fix(chat): allow owners to use unshared execution machines - #1452
Merged
Merged
Conversation
Robert0622
approved these changes
Nov 26, 2026
Robert0622
left a comment
Collaborator
There was a problem hiding this comment.
PR #1452 — fix(chat): allow owners to use unshared execution machines
head: 952aab8 | base: main (0a026c1) | 审查时间: 2026-11-26 18:00
总结
通过。可以 Approve。
代码审查结论
PR 修复了 #1285 引入的回归:项目写权限成员把自己的机器绑定到项目后,自己再发对话时反而被拦,只因为 CanUseRunner 要求机器必须已共享给项目。
核心改动(internal/repo/runner_sharing.go,internal/httpapi/assistant_execution.go 等):
- 新增
CanUseConversationRunner:机器所有者在拥有项目写权限时,无论机器是否共享,都可在对话中使用自己的机器。公式shared || (owned && (projectID == "" || writable))覆盖了个人对话(无 projectID)和项目对话(有写权限)两种场景。 canUseBoundRunner/canUseBoundExecutionTarget新增requireShare bool参数:定时任务(Scheduled)和 SOP helper 仍走原有的CanUseRunner(要求共享),普通对话走新逻辑,权限边界清晰。resolveRunnerDefaults切换到CanUseConversationRunner,对话默认机器解析和访问检查保持一致。- 前端
useExecutionMachines.js过滤条件从canUseInProject改为canUseInConversation,新字段由后端同步返回,不影响其他页面(LOOP 调度等)仍使用canUseInProject。
主要覆盖场景:
internal/httpapi新增TestOwnerCanUseConversationRunner/TestOwnerRequiredShareForScheduled等测试,明确区分对话和定时来源的访问策略。
无安全风险:
- 只放宽了机器所有者自己对自己机器的访问,没有把任意成员到任意机器的权限放开。
- 定时任务/SOP helper 仍要求机器已共享给项目(
requireShare=true),不受影响。 - ownerless(平台拥有)机器的逻辑未变。
验证结果
go vet ./internal/httpapi ./internal/engine ./internal/repo:通过go test ./internal/repo(Runner/Sharing 相关):ok (0.999s)go test ./internal/httpapi(Runner/Steer/Execution 相关):ok (48.2s)go test ./internal/engine(Runner/AutoAssign 相关):ok (187.6s)- CI 15/15 全绿(first-run pass, e2e×5 pass, curl-install pass, secrets pass, tcmcp pass, validate×2 pass, e2e-required pass, e2e-browser pass, GITHUB_SCAN pass);browser 和 core 仍 pending(与本 PR 无关,main 同状态)
- 与最新 main (0a026c1
feat(runners): configure privileged Docker sandboxes in settings) 无冲突
本地部署实测(私有测试库,非 Tencent/LoopForge 本身)
平台:PR build 952aab8,MariaDB 全新库,端口 18152,native 沙箱,CodeBuddy deepseek-v4.1-flash。
Runner:PR build agentflow-runner 0.13.1,owned by user B(项目 member)。
| 场景 | 结果 | HTTP 状态 |
|---|---|---|
| 机器所有者(user B,项目 member)在项目对话中选择自己未共享的机器 | ✅ 正常发起(202) | 202 |
| 非所有者(user A,项目 admin)选择 user B 未共享的机器 | ✅ 被拒(400「无权使用此执行机器」) | 400 |
| user B 把机器共享给项目后,user A 再用 | ✅ 正常发起(202) | 202 |
| user B 取消共享后,user B 自己再用 | ✅ 仍可正常发起(202) | 202 |
| user B 在个人对话(无项目)中用自己的机器 | ✅ 正常发起(202) | 202 |
5/5 场景全部通过。
非阻塞
- 定时任务和 SOP helper 场景未在本轮实测(需要完整 Runner 执行链路,沙箱无 Docker),但对应代码路径有单测覆盖且逻辑保持原
CanUseRunner,无回归风险。
This was referenced Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Project sharing in #1285 made a project grant a prerequisite for a machine owner's own chat turns. Project members with write access can now select their own compatible execution machine, use it as their personal default when project settings allow, and resume conversations already bound to it. Other members use the machine through the project grant.
The picker, draft and turn validation, and Runner dispatch use the conversation permission. Project LOOP routing and scheduled execution check project grants. The deployment guide and changelog describe the new behavior.
Scope
Compatibility
The Runner list adds
canUseInConversation. The change uses existing machine bindings, chat records, database schema, and Runner version requirements.Validation
npm --prefix chatbot testpassed all 535 tests.npm --prefix chatbot run buildpassed.node --test webtest/tests/mcp-sops-runners.test.mjs webtest/tests/sync-schedule.test.mjspassed all 26 tests.go testruns passed ininternal/httpapi,internal/engine, andinternal/repo, including conversation binding and steering, issue dispatch, automatic assignment, share revocation, and MySQL admission across targets.e2e/local.sh, Docker MySQL, and a real Runner verified an unshared owner's chat draft, platform assignment, issue dispatch to the shared Runner with artifact retrieval, and queue promotion to the platform after the share was revoked.go vet ./internal/httpapi ./internal/engine ./internal/repoandpython3 scripts/check-public.pypassed.The broader Go test run reached its timeout. The broader MySQL run reached its timeout and reported failures in
TestEvolutionQueueMySQLConcurrentAdmissionandTestMySQLReadsObserveExternalChangesWithoutReload. Both failures also reproduced with the base branch code on an AutoMigrate test database.Safety