Repository navigation
fix(issues): let agents create requirements without an SOP - #1411
Conversation
The issues_save tool contract is generated from docs/api/openapi.yaml, whose
Issue schema lacked sopMode. Assistants and chat Bots asked for a requirement
"not on any SOP" therefore could not express it: the save bound the project
default SOP, so the requirement looked eligible for SOP delivery.
- Document Issue.sopMode ("", none, sop) so issues_save offers it.
- A draft with sopMode none is not an SOP proposal and offers no SOP
choice on the Bot confirm page; its summary says "不使用 SOP".
- The chat draft card shows "不使用 SOP" instead of the SOP it drops.
- Requirements that never ran no longer say they run by SOP or were
started directly ("直接运行") in the list and drawer.
Co-Authored-By: Claude Code <noreply@anthropic.com>
|
部署实测 本机分别部署 main 1. 让助手建「不走 SOP」的需求,确认后看保存结果
2. 不受影响的部分(回归)
3. 界面(Chromium,同一份数据)
页面没有 JS 报错,也没有 5xx。 4. 测试
没在部署里测的:飞书/企微 Bot 的网页确认页(需要真实 IM 通道),这条路径由 合并提醒:本 PR 和 #1286(SOP→LOOP 改名)在 5 个文件上有文本冲突: token 是作者本人的账号,所以只评论、不点 Approve。 |
|
CR + 部署实测: 评审结论
部署实测(本机 MySQL 8.4.7,PR head 和 main
测试
提醒(非阻塞):本 PR 新加的用户可见文案「不使用 SOP」「尚未开始 · 这条需求不使用 SOP…」「在对话里澄清和改代码」等用的是 SOP 叫法。#1286(SOP → LOOP 改名)按约定最后合;如果本 PR 先合,#1286 下次合 main 时要把这几条一起改成 LOOP。 |
crispinhu27
left a comment
There was a problem hiding this comment.
初审 head b476128(base main 2e5176f),结论 REQUEST_CHANGES:发现 1 条 P2 和 1 条 P3,都已在隔离环境里实际复现,详见行内评论。
主体修复已验证有效:
- 在 head 上通过
/mcp的tools/list能看到sopMode(enum["", none, sop]),base 上没有。 sopMode: none保存后不绑定 SOP,automationState=ignored;同时传workflowId时会被清掉;只改标题再保存仍保持 none。- 不传
sopMode时仍然绑定项目默认 SOP,和 base 一致。 - 中文界面打开不使用 SOP 的需求:head 显示「对话处理 / 不使用 SOP / 这条需求不使用 SOP…」,base 显示「直接运行 / 触发后会按 SOP 执行」,没有页面错误。
测试对比(head 对比 base):
- Go:build、vet 都通过。httpapi、mcpserver、repo、domain、botinteraction 等包的失败集合完全一致,都是 httpapi 里缺 bwrap、浏览器这类环境原因导致的 15 项。
- chatbot vitest:head 534/534,base 533/533。
- webtest:head 308/308,base 307/307。
- 新增的 5 个测试在 base 上失败、在 head 上通过。
- CI 16/16 通过。
不阻塞、和本 PR 无直接关系的观察:飞书/企微卡片上,不使用 SOP 的草稿仍会出现「确认并启动 SOP」按钮,原因是 push_card.go 按摘要里的「(SOP:」判断。head 上点了只会保存、不会启动,比 base 的行为好,所以不算回归,可以后续再收紧。
未做的验证:没有用真实模型走 AI 助手或聊天 Bot 的完整对话链路(没有模型凭据),只直接调用了 /mcp 的 issues_save;网页 bot-approve 页面和 chatbot 草稿卡片只跑了单元测试,没在浏览器里看。
…ed SOPs - web/i18n-en.js: add the three strings this PR introduced for requirements without an SOP (trigger 对话处理, actor hint, outcome banner). English mode showed them in Chinese, and the banner was translated piecemeal into mixed Chinese and English. - repo: when an edit lifts a no-SOP choice with sopMode=sop and sends no automationState, reset the ignored state that choice set to eligible, as binding or running an SOP from the page already does. The issues_save contract now offers sopMode=sop, and before this the requirement got its SOP back but scheduled SOPs still skipped it. A requirement ignored on its own, or an automationState sent in the same save, is kept. - openapi: say that sop lets scheduled SOPs claim it again. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
处理 crispinhu27 的 P2、P3,新 head 改动
部署实测(本机同时起
页面没有 JS 报错。上一条评论里对 测试
不在本 PR 范围:英文详情页里「平台新建」「统计关联 TAPD」「继续开发分支」「自动新建」也没翻译, 脚本和结果: |
|
复测 上一轮我测了 部署实测(重新用
测试
和 #1286 合入顺序的提醒不变:本 PR 的「不使用 SOP」等文案,在 #1286 再合 main 时要一起改成 LOOP。 |
crispinhu27
left a comment
There was a problem hiding this comment.
复审 f9f1e1fd(base main 2e5176f1),对比上一轮 b4761282 上 REQUEST_CHANGES 提的两个问题。
历史问题(复测细节见原线程)
- [P2] 英文界面中,不使用 SOP 的需求文案没有翻译:FIXED。用无头 Chromium 在英文界面实测,分别对照了 head 和
b4761282。 - [P3]
sopMode:sop设回后,定时 SOP 仍然不认领:FIXED。通过/mcp issues_save和定时任务的 run 实测,对照了 head、b4761282和 base。
审查范围
- 完整 diff,以及增量
b4761282..f9f1e1fd(repo/issues.go、i18n-en.js、openapi、测试)。 - 核对了增量逻辑会不会误改以下情况:用户显式设的 ignored、带 SOP 需求的普通编辑、done 状态的需求、网页端绑定 SOP 的路径。实测这几种情况结果都正确。
验证(隔离的非特权用户、MariaDB、合成数据)
go build ./...通过。go test ./internal/{httpapi,mcpserver,repo,domain}:head 和 base 的失败集合相同(都是 httpapi 里的 15 项,原因是环境缺 bwrap 等依赖),没有新增失败。- webtest:head 309/309 通过,base 307/307 通过。
- chatbot vitest:534/534 通过。
- 新增测试单独运行全部通过。
- CI:16/16 通过。
未覆盖:没有接真实模型做端到端测试;契约部分用 /mcp 直接调用工具来验证。
以上结论只针对本次的审查范围和验证结果,不代表代码绝对没有缺陷。
Resolve the sandbox_manager.go conflict with #1412: removeMatching keeps its per-caller remove func, and both callers now delete through RemoveWorkspaceTree. DestroyRun retires a checkout and then removes it, and ReclaimExcept prunes orphans and retired copies; with os.RemoveAll a read-only Go module cache left .loopforge-reclaimed-* directories behind. Add regression tests for both paths. The second sop-mode test from #1411 builds its manager on sandboxRoot(t) like the rest of the file; this branch dropped the path/filepath import. Co-Authored-By: Claude Code <noreply@anthropic.com>
The merge of main kept the product copy for requirements without a LOOP, but comments, test fixtures and failure messages around #1411's sopMode still said SOP. Use the LOOP terminology there too; protocol values such as sopMode none/sop and Go identifiers keep their names. Co-Authored-By: Claude Code <noreply@anthropic.com>
* feat: rename SOP to LOOP across LoopForge * Apply LOOP terminology to copy merged from main and fix CHANGELOG anchor Rename the user-visible SOP copy that main added for the enterprise IM channels, observability dashboard and docs, following the same rules as the rest of this branch (routes, JSON fields and identifiers unchanged). Keep accepting the old wording where it can still arrive: notification cards skip both LOOP and SOP header lines, chat drafts recognise both (LOOP:…) and (SOP:…) notes, and the clarification command accepts "保存并启动 LOOP" as well as "保存并启动 SOP". Point the CHANGELOG link at #updating-existing-public-loops. Co-Authored-By: Claude Code <noreply@anthropic.com> * Renumber the LOOP terminology migration to 043 and re-apply the rename to main's new copy main added 042_project_credentials.sql and 042_skill_bodies_to_files.sql, so the terminology migration becomes 043_loop_terminology.sql; the installer, its test and the deployment guide follow. Rename the user-visible SOP copy from #1264, #1294, #1295, #1296 and #1298 (project roles, join requests, project credentials, workspace preview messages) with the same rules as the rest of the branch. Co-Authored-By: Claude Code <noreply@anthropic.com> * Restore the legacy (SOP:…) draft note check clobbered by the rename sweep Co-Authored-By: Claude Code <noreply@anthropic.com> * fix(chatbot): recognize proposal receipts saved before the LOOP rename Conversations saved before the rename still hold the SOP wording of the declined and timed-out proposal receipts. The chat matched only the new LOOP text, so these internal resume turns showed up as user messages. Accept both wordings. Rooms also parse LOOP「…」 authors with the correct length and keep recognizing legacy SOP「…」 authors. Co-Authored-By: Claude Code <noreply@anthropic.com> * Apply LOOP terminology to the chat attribution copy merged from main #1300 added a clarification test that expects the bot reply "已启动 SOP" and a comment that says "a SOP started". This branch already renders "已启动 LOOP", so the test failed after merging main. Co-Authored-By: Claude Code <noreply@anthropic.com> * Resume paused children marked before the LOOP rename The child-resume marker merged from #1327 now reads "等待继续子 LOOP". A parent paused on a build that stored "等待继续子 SOP" still resumes its child after admission. Co-Authored-By: Claude Code <noreply@anthropic.com> * test: cover run evaluation before approval * test: exercise five previously uncovered platform routes * fix: translate LOOP evaluation and runner allocation messages * fix(engine): name LOOP in the remaining auto-assign errors The default-executor fallback label and the no-compatible-sandbox error still said SOP after the main merge. Co-Authored-By: Claude Code <noreply@anthropic.com> * fix: name LOOP in errors merged from main Four user-visible errors that arrived with main (#1342 work branch naming, #1343/#1348 runner auto-assign, #1301 child artifacts) still said SOP. Co-Authored-By: Claude Code <noreply@anthropic.com> * fix(migrations): preserve customized LOOP template copy * test(install): copy migration 043 into the live install fixture install-schema-extensions.sh now replays migrations/043_loop_terminology.sql, but test-install-live.sh only copied 001/033/038/042 into its trimmed fixture, so every live install identity stopped at the first install with 'cat: migrations/043_loop_terminology.sql: No such file or directory'. Copy 043 as well, and add a test-install.py check that every migration the installer replays is in the live fixture's copy list, so CI catches the next one. Co-Authored-By: Claude Code <noreply@anthropic.com> * Name LOOP in comments and test copy merged from main The merge of main kept the product copy for requirements without a LOOP, but comments, test fixtures and failure messages around #1411's sopMode still said SOP. Use the LOOP terminology there too; protocol values such as sopMode none/sop and Go identifiers keep their names. 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> Co-authored-by: Codex <codex@users.noreply.github.com>


问题
在 AI 助手或聊天 Bot 里说「建一条需求,不走任何 SOP,我在对话里直接改代码」,建出来的需求仍然绑定了项目默认 SOP(
workflowId=generic-backend-delivery-<project>)。需求列表里显示「关联 SOP:后端交付 SOP」,详情页显示「触发后会按 SOP 执行」,并且会被当作可派发 SOP 的需求。网页「新建需求 → 不使用 SOP」是正常的,只有 Agent 走issues_save这条路会出问题。原因
issues_save的工具参数契约(mcpserver.ToolInputSchema)是从docs/api/openapi.yaml生成的,而components.schemas.Issue里没有sopMode字段(domain.Issue里有)。所以模型通过workbench_tool_schema看不到这个字段,只能不填workflowId或者填空字符串。IssuesRepo.prepareIssueForSave在sopMode为空时会调用bindDefaultWorkflow,于是需求被绑上了默认 SOP。模型在下一轮回复里还会说「平台按项目默认值自动填了 SOP」。另外有几处界面文案也假定需求一定走 SOP:
sopMode。sopMode=none的草稿仍然提供 SOP 选择和「创建后立即启动」,摘要写的是「项目默认 · xxx SOP」。workflowId的sopMode=none草稿会被当成「走 SOP 的建议」。复现(main f7b066d,本机部署,真实模型,项目绑定私有 GitHub 仓库)
提示词:「帮我建一条需求,标题「对话改代码-xxx」,正文「todo/app.py 增加 clear_done() 清理已完成项」。这条需求不要走任何 SOP,我会在对话里直接改代码,定时任务也不要认领它。」在卡片上点「确认保存需求」后,查看保存结果:
workflowId=generic-backend-delivery-e2e-auto,sopMode 为空sopMode=none,没有 workflowId,automationState=ignoredsopMode=noneworkflowId:"",仍然绑定默认 SOPsopMode=nonesopMode=none(模型自己猜中了字段)sopMode=nonemain,CodeBuddy 生成的卡片和需求详情(「触发后会按 SOP 执行」「触发方式:直接运行」「关联 SOP:后端交付 SOP」):
修复
docs/api/openapi.yaml:给Issue补上sopMode(enum: ["", none, sop]),并写明 none、sop 和省略时各自的语义;workflowId的说明里也指向它。issues_save的契约和公共 MCP 工具会自动带上这个字段,不用改服务端写入逻辑(prepareIssueForSave本来就会正确处理sopMode=none)。assistant_proposals.go:sopMode=none的新建需求不算「交给 SOP」,不再带 proposal。bot_drafts.go:拆出botDraftNewIssue和botDraftWithoutSOP。对不走 SOP 的新需求,确认页不提供 SOP 选择和启动选项,摘要写「(SOP:不使用 SOP)」,确认后保存为sopMode=none。chatbot/src/operations.js:草稿卡片的 SOP 一栏显示「不使用 SOP」,不再显示即将被丢弃的 workflowId 对应的名称。web/app/issue-model.js、web/app/issue-drawer.js:不使用 SOP 的需求在未开始时写「在对话里澄清需求、直接改代码;定时任务不会自动认领它」。还没有任务和运行的需求,「触发方式」显示「对话处理」或「尚未触发」,不再显示「直接运行」。影响面:只改契约文档,以及
sopMode=none时的提示和展示分支。带 SOP 的需求、已经运行过的需求,以及现有sopMode的写入语义都不变。和issues_save相关的入口(助手确认、完全权限、帮我批准审查、Bot 网页确认)都已覆盖。测试
新增测试(修复前都会失败,修复后都能通过):
internal/mcpserverTestIssueSaveContractOffersSOPMode:issues_save 的契约包含 sopMode;none、sop 和空值能通过校验,未定义的值会被拒绝。internal/httpapiTestSOPProposalValidation(扩展):sopMode=none的草稿会去掉 proposal。internal/httpapiTestBotDraftRequirementWithoutSOP:确认页不提供 SOP 选择;确认后得到sopMode=none,没有 workflowId,automationState=ignored。chatbotcomposer-operations:卡片显示「不使用 SOP」。webtestissue-conversation:未运行的需求不显示「直接运行」,不使用 SOP 的需求不显示「按 SOP 执行」。回归:
go test ./internal/httpapi ./internal/mcpserver ./internal/repo ./internal/domain:只有TestWorkspacePreparationAPISeparatesReadersAndWriters失败,原因是本机没有 bwrap。main 上同样失败,修复前后的失败集合完全一致。webtest:308/308 通过。chatbotvitest:62 个文件,534 个用例全部通过。sopMode=none,页面没有 console 或 HTTP 错误。修复后(CodeBuddy 卡片、需求详情;Cursor 卡片;GLM 需求详情):
本轮全量走查中顺带验证、没有发现问题的部分(main f7b066d)
另外记录了两点,没有在这个 PR 里改:新建 cron 定时任务后会立刻触发一次,已由 #1272 处理;GitHub 导入的 issue 沿用 GitHub 编号,会和本地需求的编号重复,比如都显示为 E2E-1。
🤖 Generated with Claude Code