Skip to content

ci: stop reporting cancelled desktop e2e runs as failures - #5264

Merged
RealKai42 merged 2 commits into
mainfrom
fix/desktop-e2e-cancelled-result
Nov 23, 2026
Merged

RealKai42 merged 2 commits into
mainfrom
fix/desktop-e2e-cancelled-result

Conversation

@RealKai42

Copy link
Copy Markdown
Collaborator

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 误报:

  1. 在任意 PR 上,趁 Desktop E2E 的 Plan the desktop journeys 还没跑完时取消这次运行。
  2. Desktop E2E journeys (optional) 照样运行,并以 Planning the desktop journeys ended with cancelled 失败。

pre-commit 失败:

  1. 只改 apps/desktop/scripts/ci/select-e2e-specs.test.mjs 这类 apps/*/scripts/ 下的文件,暂存后 git commit。
  2. hook 报 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

两处都是在已有结构里改一个条件。

 Desktop E2E / result job(Desktop E2E journeys (optional))
-  if: always() && needs.plan.outputs.mode != 'none'
+  if: ${{ !cancelled() && needs.plan.outputs.mode != 'none' }}

!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-pattern

guards 按完整字符串核对 lint-staged 里登记的 oxlint 命令,所以 scripts/checks/registry.json 里那条登记同步改成新命令,guards 继续盯着它。

两个提交分开:先修 hook,再修 workflow,第二个提交暂存的正是之前让 hook 失败的那个文件。

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
Desktop E2E 运行被取消(concurrency、手动、自动化账号) result job 运行,Desktop E2E journeys (optional) 报红 result job 跳过,不产生红色检查 无。这是可选检查,不阻断合并;main 上开 issue 的 alert job 本来就在取消时跳过 重跑这次运行即可拿到真实结果
Desktop E2E 的 plan job 自身出错 报红 报红(不变) — —
Desktop E2E 的 shard 失败 报红 报红(不变) — —
plan 选择 none 跳过 跳过(不变) — —
pre-commit:暂存的 JS 全在 oxlint 忽略范围内 hook 失败 通过;注释检查照常运行 无 —
pre-commit:暂存的 JS 有在 oxlint 范围内的 按 CI 规则 lint,有违规就失败 不变 — —

受影响的只有仓库贡献者看到的 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。
  • 已有的 guards 检查继续核对 result job 的接线和 lint-staged 里的 oxlint 命令。
验证过程
  • 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 个全部通过。
  • 两个新测试都在修复前单独跑过,均失败。
  • 用新的 hook 命令做了对照:只传被忽略的文件时 exit 0;同时传一个含 debugger 的临时文件时报 eslint(no-debugger),exit 1。临时文件已删除。
  • pnpm run check:duplication <base>:没有新增重复。
  • 未验证:GitHub Actions 上取消运行后的实际表现。本地无法运行 Actions,也没有 actionlint;这个 PR 改了 desktop-e2e.yml,会触发全量 journey,可以在这里取消一次运行来核对。

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

…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.
@changeset-bot

changeset-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c0d1006

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T07:06:05.410546Z c0d1006 PR opened
🔒 Security Review ✅ Completed 2026-11-23T07:08:13.373341Z c0d1006 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 23, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@c0d1006
npx https://pkg.pr.new/@moonshot-ai/kimi-code@c0d1006

commit: c0d1006

@RealKai42
RealKai42 merged commit 2601b49 into main Nov 23, 2026
27 of 30 checks passed
@RealKai42
RealKai42 deleted the fix/desktop-e2e-cancelled-result branch November 23, 2026 07:51
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 24, 2026
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.
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.

1 participant