Skip to content

test: repair main platform CI for Runner selection and run evaluation - #1345

Merged
Robert0622 merged 4 commits into
mainfrom
codex/fix-main-runner-evaluation-ci
Nov 25, 2026
Merged

Robert0622 merged 4 commits into
mainfrom
codex/fix-main-runner-evaluation-ci

Conversation

@Robert0622

@Robert0622 Robert0622 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

The main-branch platform CI run exposed two issues after the approved PRs were combined.

  • Pass the current SOP execution-selection flag in the three Runner credential tests. Main's test package fails to compile with the older call signature.
  • Add end-to-end coverage for requirement images and clarification models, durable run completion, conversation sandbox selection, and reply read markers. The coverage report listed these five routes as untested. Also verify that an evaluation cannot start or write recommendations while a run is waiting for approval.

Verified the focused Engine tests and all four end-to-end cases against a disposable MySQL deployment. Confirmed the five additional routes in the platform access log. The existing route coverage threshold is retained.

Follow-up on the latest main

  • Synced with main after Prevent SOP runs from hanging after artifact write failures #1301 and retained the unauthenticated-image denial assertion from main.
  • Fixed the occasional group clarification test failure in the main platform run. The test now waits for the actual queued questions and conclusion before asserting their contents. Applied the same wait where private chat, WeCom and automatic next-round tests read the asynchronous outbox.
  • Repeated the full chat clarification test group 35 times locally.

Robert0622 pushed a commit that referenced this pull request Nov 25, 2026
…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>
@Robert0622

Copy link
Copy Markdown
Collaborator Author

CR + 部署实测 6859c989:LGTM

范围:base main 058a530b,2 个提交,改了 4 个文件:internal/engine/sop_executors_test.go 和 3 个 e2e API 用例文件。没有产品代码改动。

main 上 platform CI 失败的两个原因,本 PR 都修了

  1. core:feat(sop): unify platform runner management and add project SOP auto-assignment #1339 给 selectSOPExecutionTarget 加了 allowAuto 参数,fix: only offer configured executors in model pickers #1291 新增的 3 处调用还是单参数,internal/engine 测试包编译失败。本机在 main 058a530b 上跑 go vet ./internal/engine 能复现 not enough arguments。本 PR 这 3 处改成传 true,和生产代码的非工作区路径 run_start.go:186(!workspace)、sop_executors.go:288 一致。这几个用例的项目没有开自动分配,所以传 true 不会走 auto 分支,断言的语义没变。TestExecutorCredentials* 3 条都通过。
  2. browser:路由覆盖率在 main 上是 350/412,刚好压线没过。本 PR 补了 5 个路由(需求图片下载、clarify-models、/runs/:id/wait、会话 PUT /sandbox、POST /read),另外覆盖了运行等待审批时评测的 4 个接口。

用例读下来

  • 评测用例:run 停在 waiting_approval 时,POST /eval 返回 409;GET /eval 和 /evals 都是空的;/eval/stream、/eval/apply 返回 404。批准之后 run 正常结束。断言的是「运行中不能评测、不留下半截记录」,方向正确。
  • /wait 断言的是 run 已经结束后的完整返回体(terminal:true, timedOut:false),不依赖时序。
  • 图片用例逐字节比对了下载内容和 content-type。会话沙箱用例在切换沙箱、清空沙箱前后都检查了消息还在,并用 track 清理了建出来的沙箱。

部署实测(本机 MariaDB 11.8 全新库,用本 PR 构建的平台,native 沙箱;没有对 Tencent/LoopForge 做任何操作)

项目 结果
chatbot 单测 531/531 ✅
go build / go vet ./internal/engine ./internal/httpapi 通过 ✅(main 上 vet 报 3 处参数不够)
e2e API 全量 186 个用例:168 通过,0 失败,16 跳过。新增的 4 个用例都通过 ✅
路由覆盖率 --min 85 351/412 = 85.2%,通过 ✅。平台日志里 5 个新路由都有请求记录
e2e UI 25 通过,2 跳过,1 失败。失败的是 03-workbench-settings.spec.mjs:21(会话改名后标题没更新)。本 PR 没改这部分代码,用 main 058a530b 构建的平台跑同一条用例,失败结果完全一样,属于本机环境问题;CI 上 browser 通过 ✅
CI 16/16 通过 ✅

非阻塞:覆盖率 85.2% 离门槛只多 1 个路由。之后谁新加路由却没补 e2e,browser 还会挂。可以考虑在 PR 模板里提醒一下,或者 CI 失败时把「未覆盖路由」列表打印到 job summary 里,方便定位。

结论:LGTM,这个 PR 合进去后 main 的 platform CI 就能恢复。#1332 afa86043 带了同样的 3 行测试修复,两个 PR 谁先合都不冲突。token 是作者本人的账号,所以只评论,不点 Approve。

crispinhu27
crispinhu27 previously approved these changes Nov 25, 2026

@crispinhu27 crispinhu27 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

初审结论:APPROVE(审查的版本:head 6859c98,base main 058a530)

审查范围

  • 4 个测试文件:internal/engine/sop_executors_test.go,以及 e2e/api/20-issues、30-runs、69-assistant-sessions。
  • 本 PR 没有改生产代码、CI 配置或 scripts。路由覆盖率门禁仍是 --min 85,没有降低。

和 main CI 失败的对应关系(058a530b)

  • core: sop_executors_test.go:446/531/556 报 not enough arguments in call to selectSOPExecutionTarget。本 PR 在这三处补了第二个参数 true,和生产代码 sop_executors.go 里的调用一致。
  • browser: 只有路由覆盖率没过(350/412 = 85.0% is below 85%)。本 PR 的 CI 里是 355/412 = 86.2%,新覆盖的正好是描述里列的 5 个路由:clarify-models、issues/:id/images/:imageId、runs/:id/wait、assistant/sessions/:id/read、assistant/sessions/:id/sandbox。
  • 当前 head 的 CI: 16 项全部通过,包括 core、browser、platform-required。

本地隔离验证(原生 MySQL 8.4.7 + 本地构建的平台,只用合成数据)

  • 编译对照: base 上 go vet ./internal/engine/ 编译失败,报错和 main CI 一样;head 上通过。TestExecutorCredentialsFollowTheProjectDefaultRunner 和 TestExecutorCredentialsFollowTheCloudPool 都通过。
  • engine 全量测试: head 上 go test ./internal/engine/ 只有 9 个失败,原因都是容器里没有 bwrap。补上 bwrap 后单独重跑这 9 个,全部通过,属于环境问题,和本 PR 无关。
  • e2e 三个文件: 在 head 上连跑 3 次,每次 42 个用例:40 通过、0 失败、2 个 todo。把 4 个新增或改过的用例单独挑出来跑,也全部通过,说明不依赖执行顺序。平台访问日志确认这 5 个路由确实被请求到了。

非阻塞说明

  • 30-runs 新用例里的 eval/apply 返回 404,原因是评测本来就没建出来,并没有专门测到「run 等待审批时不能写回建议」这条拦截。所以这条断言偏弱,但没有写错。

没有在本地跑整个 e2e / Playwright 套件和 Go ./... 全量测试,这部分以 PR CI 全绿为准。本次 Review 不代表代码没有任何缺陷。

@Robert0622

Copy link
Copy Markdown
Collaborator Author

CR + 部署实测:6859c989,LGTM,没有发现问题。

  • sop_executors_test.go:3 处 selectSOPExecutionTarget(&execution, true) 改的就是 main 上 internal/engine 测试编译不过的问题。和 feat(sop): review runs in Chatbot node conversations #1332 afa86043 里那 3 行完全一样,两边谁先合都不冲突。
  • 新增的 e2e 用例:需求图片上传/下载(PNG 原样返回、content-type: image/png)、clarify-models;审批前评测返回 409,eval/evals 没有残留,eval/stream 返回 404,eval/apply 返回 404;/wait 拿到终态;会话沙箱选择、已读标记。断言跟接口实际行为一致。

部署实测(本机平台 + MariaDB 11.8 新库,没有对 Tencent/LoopForge 做部署测试):API e2e 0 失败(包括这次新增的 4 个用例)。本机路由覆盖 351/412 = 85.2%,过线。UI 失败 2 个,都跟本 PR 无关:会话改名是 MariaDB 不支持 CAST(... AS JSON);凭据向导在负载下超时,单独重跑能过。PR 没有改 UI 和服务端代码。

@crispinhu27 crispinhu27 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复审结论:APPROVE(审查版本:head e2d0b4acbbeb48b3885daf03ed88f6c89a8e0ad7,base main 6f3f0b8f,当前 main 832e2bef)。之前在 6859c989 上的 APPROVE 6059419873 已被新推送撤销;那次没有提过问题,所以这次没有需要复测的历史问题。

增量范围(6859c989..e2d0b4ac)

  • dd83fc55:合入 main。--remerge-diff 显示只有 e2e/api/20-issues.test.mjs 一处冲突。解决方式保留了 main 新增的图片上传用例(含未登录返回 401 的检查),并用 created.id 补上了本 PR 的 clarify-models 检查,是对的。同一提交把 bot_clarify_test.go 里的 f.posts 换成了 waitPosts,轮询等待已入队的澄清消息。
  • e2d0b4ac:合入 merge-audit/release-current-main。它的第二个父提交 6f3f0b8f 已经在 main 上,--remerge-diff 为空,没有带进 main 以外的代码。
  • 现在仍然只改测试,共 4 个文件。sop_executors_test.go 已经不在 diff 里,因为 main 上已有同样的修改。

为什么 waitPosts 改得对:finishBotClarifyRound 先保存会话状态,再由 postBotClarify 把消息入队。所以 waitStatus 返回的时候,消息可能还没写进去。新 helper 用的超时和轮询间隔与 waitStatus 一样(10s / 20ms)。等到消息之后,原来那些「恰好 1 条、kind 和内容都对」的断言照样会跑,断言没有放松。

验证(隔离环境,环境变量清空)

  • go test ./internal/httpapi -run TestChatClarification:先 -count=3;再在 -cpu 1,2,8 下跑 60 次、-cpu 2,4,8 下跑 100 次,同时加压。
    • base 6f3f0b8f 复现了这次修的竞态:bot_clarify_test.go:505 越界 panic,:231 和 :538 断言失败。
    • head 上这几类失败一次都没出现。
  • internal/httpapi 全量测试:head 和 base 失败的都是同样 13 项,都是环境原因(没有 bwrap 等),没有新增失败。
  • go vet ./internal/httpapi:通过。
  • git merge-tree 和当前 main 832e2bef 合并无冲突。在合并结果上把澄清测试跑了 10 次,全部通过。
  • e2e API 用例需要 Docker 里的 MySQL,本地没跑;用到的路由都存在,CI 的 browser job 在这个 head 上跑过这些用例并通过。CI 16/16 通过。

不阻塞、供参考:同一文件里的 TestChatClarificationEdgePaths(head 上在 :621)在高并发加压时,偶尔会报 "analysis not cancelled"。base 上也能出现,本 PR 没有引入、也没改到它,所以不算这次的问题。

这次没有发现需要修改的问题,但不代表代码一定没有缺陷。

@Robert0622

Copy link
Copy Markdown
Collaborator Author

CR + 部署实测:e2d0b4ac,LGTM

这次新增的两个提交:合入 main 78cdab43,以及合入 merge-audit/release-current-main(对应 main 6f3f0b8f)。原来修 engine 测试签名的 3 行已经随 main 进来,所以本 PR 相对最新 main 832e2bef 只剩测试改动:

  • internal/httpapi/bot_clarify_test.go:posts() 改成 waitPosts(count),在 10s 内轮询,等异步入队的澄清消息到齐,修 CI 偶发失败;
  • e2e 新增 3 处断言(/api/issues/:id/clarify-models、/api/runs/:id/wait、会话切换沙箱 + 未记录回复的 read 返回 404),用来补路由覆盖率。

部署实测(本机 MariaDB 11.8 全新库,用本 PR 构建的平台;没有对 Tencent/LoopForge 做任何部署实测操作)

项目 结果
go build / go vet ./... 通过 ✅
TestChatClarification* -count=10 10 次全部通过 ✅(main 上本机也是 10/10,CI 上偶发的失败本机没复现,但改成等待后不再依赖时序)
go test ./internal/httpapi/... 只有 2 个 Chromium 浏览器用例失败,main 上同样失败,属于本机环境问题
e2e API 全量 187 个用例:169 通过,0 失败,16 跳过。新增断言都通过 ✅
路由覆盖率 --min 85 357/416 = 85.8%,通过 ✅
e2e UI 25 通过,2 跳过,1 失败。失败的是 03-workbench-settings.spec.mjs:21(会话改名),是之前几轮在 main 上也会出现的 MariaDB 改名 500 问题,与本 PR 无关;CI 上 browser 通过
chatbot 单测、webtest、check-public 通过 ✅
CI 16/16 通过 ✅

结论:LGTM。token 是作者本人的账号,所以只评论,不点 Approve。

@Robert0622
Robert0622 merged commit 910f531 into main Nov 25, 2026
16 checks passed
@Robert0622
Robert0622 deleted the codex/fix-main-runner-evaluation-ci branch November 25, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants