Repository navigation
ci: stop reporting cancelled desktop e2e runs as failures - #5264
Conversation
…int scope lint-staged hands every staged JS file to oxlint, and oxlint exits with an error when its ignore patterns leave no file to lint. A commit that only touches files under an ignored path such as apps/*/scripts/ therefore failed the hook. Pass --no-error-on-unmatched-pattern so such a commit goes through, while staged files in the oxlint scope are still linted with the same rules.
The result job of the Desktop E2E workflow ran with always(), so when a run was cancelled before the plan job wrote its outputs, the mode was an empty string rather than none and the job reported the cancelled plan as a failed check. Run it only when the run was not cancelled; a plan or shard that fails is still reported.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
The fork's release workflow is gated to MoonshotAI with publishing disabled, and its CI has no desktop-e2e/e2e-smoke/layered-qa workflows; record MoonshotAI#5277, MoonshotAI#5092, MoonshotAI#5088, MoonshotAI#5084, MoonshotAI#5309 and MoonshotAI#5264 accordingly.
Requirement or Bug
Desktop E2E 的运行被取消之后(新的推送按 concurrency 取消旧运行、有人手动取消,或者自动化账号取消),
Desktop E2E journeys (optional)这条检查会变红,可实际上一个 journey 都没跑。例如 #5258:它没改任何 journey,plan 的选择结果是none,但第二次推送的那次运行在 plan 阶段被取消,PR 上就留下了一个红色的 Desktop E2E 检查(运行记录),看起来像是 e2e 被触发了而且挂了。顺带修了提交这个改动时撞到的 pre-commit 问题:暂存的 JS 文件如果全在 oxlint 的忽略范围里(例如
apps/*/scripts/),hook 会直接失败。Bug Reproduction Steps
Desktop E2E 误报:
Plan the desktop journeys还没跑完时取消这次运行。Desktop E2E journeys (optional)照样运行,并以Planning the desktop journeys ended with cancelled失败。pre-commit 失败:
apps/desktop/scripts/ci/select-e2e-specs.test.mjs这类apps/*/scripts/下的文件,暂存后git commit。No files found to lint. Please check your paths and ignore patterns.后以 1 退出,只能--no-verify。Root Cause
Desktop E2E 误报:result job 的条件是
always() && needs.plan.outputs.mode != 'none'。always()在整次运行被取消后仍然成立;plan 在写出 outputs 之前就被取消了,mode是空字符串,而空字符串!= 'none'也成立,于是 result job 运行,读到PLAN=cancelled,按失败上报。这是根本修复:取消的运行不再汇总,plan 或 shard 真正失败时仍然报红。pre-commit 失败:lint-staged 把所有暂存的 JS 文件交给 oxlint,其中被
.oxlintrc.json的ignorePatterns忽略的文件会被 oxlint 丢掉;一个都不剩时 oxlint 以 1 退出。这也是根本修复:oxlint 的--no-error-on-unmatched-pattern只改变「没有文件可 lint」时的退出码,范围内的文件照样按同一套规则检查。Code Changes
两处都是在已有结构里改一个条件。
!cancelled()让 result job 在上游失败时照样运行、在整次运行被取消时跳过。guards 对汇总任务(scripts/checks/registry.json的fanIn)的要求本来就是always()或!cancelled()二选一,同文件的 alert job 也已经是!cancelled()。外面包一层${{ }},是因为 YAML 会把开头的!当成标签。package.json#lint-staged "*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}" node scripts/check-comments.mjs - oxlint --type-aware --deny-warnings + oxlint --type-aware --deny-warnings --no-error-on-unmatched-patternguards 按完整字符串核对 lint-staged 里登记的 oxlint 命令,所以
scripts/checks/registry.json里那条登记同步改成新命令,guards 继续盯着它。两个提交分开:先修 hook,再修 workflow,第二个提交暂存的正是之前让 hook 失败的那个文件。
Behavior Changes and Affected Users
Desktop E2E journeys (optional)报红none受影响的只有仓库贡献者看到的 CI 检查和本地 pre-commit hook,CLI、桌面端、VS Code 扩展和各个库的行为都没变。
测试覆盖:
apps/desktop/scripts/ci/select-e2e-specs.test.mjs:解析desktop-e2e.yml,要求 result job 的条件不含always()、含!cancelled(),并且仍然在mode为none时跳过。修复前失败。scripts/checks/guards.test.mjs:取package.json里 lint-staged 实际配置的 oxlint 命令,对一个apps/*/scripts/下的文件运行,要求以 0 退出。修复前失败,报错是No files found to lint。验证过程
pnpm lint:exit 0(guards:17 check invocations wired;2 fan-in jobs collect every result)。node --test 'scripts/checks/*.test.mjs' apps/desktop/scripts/ci/select-e2e-specs.test.mjs apps/desktop/scripts/ci/report-main-journeys.test.mjs:77 个全部通过。debugger的临时文件时报eslint(no-debugger),exit 1。临时文件已删除。pnpm run check:duplication <base>:没有新增重复。desktop-e2e.yml,会触发全量 journey,可以在这里取消一次运行来核对。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.