Repository navigation
Conversation
ci.yml 的 bun install 偶发在 electron postinstall 拉二进制时撞上网关 504, 分片在安装这一步就退出,一条测试都没跑,必需 check test 跟着变红。 - 新增 scripts/ci-install-retry.sh:安装失败后间隔 15s、30s 重试,最多 3 次, 第 3 次仍失败则以该次退出码让 job 变红。ci.yml 的 5 处 bun install 和 build-linux-glibc-baseline.sh 里的那处都改走它。 - ci.yml 在 workflow 级设置 ELECTRON_SKIP_BINARY_DOWNLOAD=1,两处 docker run 用 -e 透传。这个 workflow 里没有任何 job 运行 Electron:会加载 electron 的 5 个桌面端测试都 mock 了它。 Closes #3193
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 8, 2026 10:01
oven-sh/setup-bun 从 GitHub Releases 下载 bun,缓存未命中时会撞上同一类网关 504: 最近 200 次 CI 运行里有 34 个 job(含必需的 build 与 test 分片)失败在这一步。 这个 action 没法在 workflow 里原地重试:下载失败时它不写 state,而它的 post step 会无条件解析这份 state,失败的那次尝试会在作业末尾把 job 一起带红。 - ci.yml 的 4 处 setup-bun 换成 `sh scripts/ci-install-retry.sh npm i -g [email protected]`, 与 musl job 现有的装法一致;npm registry 本来就是 bun install 的依赖,不新增下载源。 - musl job 与 build-linux-glibc-baseline.sh 里已有的 `npm i -g bun` 也改走重试脚本。 - 契约测试补一条:ci.yml 不再使用 setup-bun,凡是跑 bun install 的地方都先经重试 脚本从 npm 装 bun。两处描述 CI 如何提供 bun 的注释同步更新。 Co-Authored-By: Claude Fable 5 <[email protected]>
Owner
Author
自动评审初步意见(最终以维护者审阅为准)head 失败点
同一用例的上一条断言(large 与 small 的 argv 等长,即包装命令不进 argv)是通过的,所以超的是基线 argv 长度,与被包装命令无关。 根因(已本地复现)
旁证
可选修法(不替维护者拍板)
其余部分重试包装脚本、electron 跳过下载这两块经本地双腿实证与变异验证均成立,本 run 的两个安装步骤以及 |
Owner
Author
|
和 #3199 重复(都是 Closes #3193),保留 #3199,本 PR 关闭。 理由:
两个 PR 的 |
This was referenced Nov 8, 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.
Closes #3193
改了什么
ci.yml 里的
bun install --frozen-lockfile偶发在 electron 的 postinstall 拉二进制时撞上网关 504。分片在安装这一步就退出,一条测试都没跑,必需 checktest跟着变红,挡住与之无关的 PR。这个 PR 做三件事:ELECTRON_SKIP_BINARY_DOWNLOAD: '1'。容器不继承宿主环境,所以两处docker run(musl 任务,以及scripts/build-linux-glibc-baseline.sh)都用-e ELECTRON_SKIP_BINARY_DOWNLOAD透传。这样 504 的来源在 ci.yml 里就没有了。scripts/ci-install-retry.sh(POSIX sh),安装失败后间隔 15 秒和 30 秒重试,最多 3 次;第 3 次仍失败就用这次的退出码让 job 变红。ci.yml 的 5 处安装(build、test 分片、bun-test、bun-binary-musl、bun-binary-darwin)和 glibc 脚本里的那处都改成sh scripts/ci-install-retry.sh bun install --frozen-lockfile。这覆盖跳过 electron 之后仍然要联网的部分:registry tarball,以及 musl 任务里 node-gyp 拉的 Node 头文件。oven-sh/setup-bun从 GitHub Releases 下载 bun,缓存没命中时撞上的是同一类 504:最近 200 次 CI 运行里有 34 个 job 失败在这一步,其中有必需的build和test分片;本 PR 第一个 head 的首跑里 bun-binary-darwin 也是这样红的(连续 3 次 504,action 自带的重试只覆盖约 30 秒)。这个 action 没法在 workflow 里原地重试:按 setup-bun 源码,下载失败时它不写 state,而它的 post step 无条件JSON.parse这份 state,给失败的那次尝试套continue-on-error,post step 会在作业末尾崩掉、把 job 带红。所以 ci.yml 的 4 处 setup-bun 换成sh scripts/ci-install-retry.sh npm i -g [email protected] --loglevel=error,和 musl 任务原有的装法一样;npm registry 本来就是bun install的依赖,不新增下载源。musl 任务和 glibc 脚本里原有的npm i -g bun也改走包装脚本。命令作为参数原样传给包装脚本,所以工作流里仍然能看到字面量
bun install --frozen-lockfile,musl 和 darwin 契约测试里「先安装、再 npm version、再编译」的顺序断言不用改。与「不靠重跑掩盖 flaky」的关系:重试只包在安装步骤上,发生在任何测试之前,处理的是外部网关的临时 5xx。测试步骤仍然不重跑(分片上方的 #2464 注释不变)。electron 这个已知来源是直接去掉的,没有靠重试吃掉。
实证
electron的只有src/desktop/下 5 个模块;会加载到它们的测试只有 5 个,全部vi.mock('electron');CLI 和 daemon 侧没有模块碰得到它。二进制构建和 smoke 脚本都不引用 electron。node_modules:其余包不动,electron 换成不含dist/和path.txt的副本(和ELECTRON_SKIP_BINARY_DOWNLOAD下 postinstall 的产物一致),require('electron')会抛 "Electron failed to install correctly"。在这个形态下:test/desktop/全部加上desktop-bundle-contract,21 个文件 170 条全过。vi.hoisted或importOriginal,按test/helpers/bun-leg-selectors.ts的规则本来就推迟到 vitest,bun 腿不跑;我用真实的选择器核对过。bun run build(含 tsc 和 typecheck)通过。install.js在读到ELECTRON_SKIP_BINARY_DOWNLOAD时直接process.exit(0),不发任何请求。node_modules。在 bun 1.4.4 上实测(独立缓存目录,file:目录依赖和 tarball 依赖各测一次):trusted 依赖的 postinstall 第一次失败后,不删node_modules直接再跑bun install --frozen-lockfile,会重新执行这个脚本并成功。所以脚本不做清理,musl 和 glibc 任务重试时也不用从头重编 node-pty。npm i -g [email protected]装出原生 ELF,bun --revision为1.4.4+38afee6c8,和 CI 里 setup-bun 从缓存恢复的版本一致。GitHub runner 上 musl 任务的apk add加npm i -g bun合计不到 8 秒。test/release-darwin-codesign-gate.test.ts本来就校验各处[email protected]与packageManager一致,换装法后照常生效。bash --posix下行为一致(退出码保留、退避 15/30)。shellcheck -s sh无告警。影响面
.github/workflows/ci.yml、scripts/build-linux-glibc-baseline.sh,新增scripts/ci-install-retry.sh和test/ci-install-retry.test.ts;另外test/dashboard-endpoint.test.ts、scripts/run-bun-tests.mjs各有一处描述 CI 如何提供 bun 的注释同步改了。没有改package.json或bun.lock。scripts/build-linux-glibc-baseline.shrelease.yml 也在用。release 侧只多了安装重试;release.yml 不设ELECTRON_SKIP_BINARY_DOWNLOAD,而docker run -e VAR不带值时只在宿主机设置了这个变量才会传进容器,所以 release 侧 electron 的行为不变。actions/checkout自己的拉取,它已经内置重试(当时是连续三次失败)。测试验证
变异测试共 18 个,vitest 和 bun 两条腿都变红,每个只红对应的用例:
exit 1(丢掉原退出码)bun install(4 个)docker run去掉-e(2 个)oven-sh/setup-bunnpm i -g bun各自去掉包装脚本(3 个)Follow-up
bun install和oven-sh/setup-bun也有同样的 504 风险,这次没动:会在 PR 上跑的sandbox-network.yml(network-boundary)和feedback-postgres.yml,以及midscene-e2e.yml、minimax-long-e2e.yml、release.yml。除 release.yml 的 desktop 任务外,它们都可以直接套用ELECTRON_SKIP_BINARY_DOWNLOAD、这个包装脚本和 npm 装 bun 的做法。需要的话我另开 PR。