Repository navigation
ci: 每个发布渠道都必须在发布 sha 上完整跑完全套 CI 才能发布 - #2693
Conversation
Follow-up to the v0.1.192 carve-out (#2664): the bugfix channel shipped with only its embedded pre-flight (typecheck+test+build) — no e2e lane ever ran on the publish sha, because no PR existed and no e2e workflow triggers on bugfix-release/** pushes. Policy (2026-10-10): no matter the release channel, the COMPLETE CI lane set must be green at the exact publish sha before npm publish. - new scripts/release-ci-gate.mjs: --dispatch: idempotently workflow_dispatch every required lane that has no run at the publish sha (or a green run at an EXTRA_MATCH_SHAS, e.g. the PR head — same semantics as branch-protection required checks, so routine PR-based releases pay zero extra CI); --wait: block until every lane's latest run at the publish sha is success; any red lane / timeout / un-dispatchable lane ⇒ exit 1, publish step never runs (fail-safe). - release.yml / release-kernel.yml: dispatch early + gate before Create tag, gated on is_release; EXTRA_MATCH_SHAS=HEAD^2 reuses PR-head runs. - release-bugfix.yml: dispatch before the pre-flight (lanes run in parallel with it) + gate after it; +actions:write. - release-manual.yml: direct path (GITHUB_TOKEN push fires no events, nothing runs CI on the release commit) gets dispatch+gate before Create tag; fallback path is already gated via release.yml after merge. - required set (override with REQUIRED_CI_WORKFLOWS): ci.yml, ci-e2e.yml, ci-e2e-fake.yml, ci-e2e-dsh.yml, ci-e2e-dsh-native.yml, ci-e2e-codex-persona.yml, ci-e2e-native.yml, ci-e2e-native-opencode.yml, ci-e2e-pi-ws.yml - tests/release-ci-gate.test.ts: 8 regression tests against an inline mock of the GitHub Actions API (no network, no token).
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2924-pr.2693.0d0c4e9This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2693.tgz
npm install -g packageInstall instructions are refreshed on each push. |
… polling Review fix for #2693: a single transient GitHub Actions API error (network blip, 5xx, secondary rate limit) during --wait polling threw immediately and killed an otherwise-green release. Read-only (GET) calls now retry up to 3 times with backoff; POST dispatches are never retried (a double dispatch would burn CI on duplicate runs). Exhausted retries still exit 1 — the fail-safe direction is unchanged.
[bot] 🏷 Review 完成。结论先行:PR 代码本身可合(你的原始 commit CI 全绿,审查通过);当前 CI 红不是本 PR 造成的——master 自身在干净 checkout 上 typecheck 已红(详见第 5 问),已单独立项 #2697。 我做的工作
结构化八问
一个额外观察(不影响本 PR 正确性):6 条 every-PR e2e lane(ci-e2e-fake 等)在本 PR 分支上从未自动触发过(相邻 PR 的 13 条 workflow 均正常触发,触发器配置核实为裸 判定:可合(代码/测试/diff 全部过关;当前红为继承自 master 的损坏,与 PR 无关——#2697 修复后重跑 CI 即可)。人类合并,机器人不合并。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.240-master.a24f6b6 # this exact build
npm install -g billion-context@master # always the newest merged build
|
问题
v0.1.192(bugfix 通道,#2664)暴露的流程漏洞:该渠道只跑了内嵌 pre-flight(
npm ci && typecheck && test && build),没有任何 e2e lane 在发布 sha 上跑过 —— 因为该渠道没有 PR,而所有 e2e workflow 都不触发bugfix-release/**push。当时是靠人工核对回归证据放行的,不能作为常态机制。方案(所有发布渠道统一补全)
新增
scripts/release-ci-gate.mjs,四个发布 workflow 全部接入:EXTRA_MATCH_SHAS=HEAD^2复用 PR head 的绿 run → 常规 PR 发布零额外 CI 成本(与分支保护 required checks 语义一致)门语义(fail-safe)
--dispatch:对发布 sha 上没有 run 的 lane 逐个workflow_dispatch(幂等,已有 run 的绝不重跑);无法 dispatch(无 trigger/文件不在默认分支)→ 硬失败,拒绝发布。--wait:轮询直到每个 lane 在发布 sha 上的最新 run =success;任何 red(failure/cancelled/timed_out/startup_failure/action_required/非 success)→ exit 1;超时(默认 60min)→ exit 1。任何失败形态都阻塞 publish。必跑 lane 集(
REQUIRED_CI_WORKFLOWS可覆盖)ci.yml(含 windows×node22/24 矩阵)+ 全部 6 条 every-PR e2e lane + 2 条 path-filtered 但安全相关的 e2e lane(ci-e2e.yml / ci-e2e-dsh.yml,src/server/**)。排除:ci-zcode-real(需真实 AppImage+版本输入)、ci-windows-codex(无 dispatch trigger,ci.yml 矩阵已覆盖 windows)、theorem/image/registry(path-gated 辅助 lane)。成本
测试
tests/release-ci-gate.test.ts:8 条回归测试,内联 mock GitHub Actions API(runs 列表 + dispatch 端点),无网络无 token,覆盖:dry-run/幂等 dispatch、不可 dispatch 硬失败、wait 转绿通过、red 快速失败、发布 sha red 不被 PR-head green 覆盖、extra sha 绿 run 复用、超时阻塞。本地node --import tsx --test8/8 通过,npm run typecheck通过。风险与边界
workflow_dispatchtrigger(已逐一核实,除被排除的 ci-windows-codex)。*_release-v*触发分支由 PR 合并产生(真实账号 push),事件正常;GITHUB_TOKEN push 无事件的问题只影响 release-manual.yml 直推路径,已显式处理。人类合并,机器人不合并。