Skip to content

feat(ci): single rolling pr tag + monotonic 0.0.<run>-pr versions - #1432

Merged
ranxianglei merged 13 commits into
masterfrom
2026-09-26_rolling-pr-tag
Sep 27, 2026
Merged

ranxianglei merged 13 commits into
masterfrom
2026-09-26_rolling-pr-tag

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Fixes #1385

What changed

Per the approved design in #1385 (single rolling tag + globally monotonic version sequence), PR artifact publishing no longer creates one dist-tag per PR:

.github/workflows/pr-artifact.yml

  • Version: 0.0.0-pr.<PR>.<run> → 0.0.<run_number>-pr.<PR>.<sha7>, plus -a<attempt> when github.run_attempt > 1.
  • Publish: --tag "pr-${PR_NUMBER}" → --tag pr — one moving pointer, the same mechanism latest already uses. New dist-tag growth = 0 (one-time addition of pr); the ~640 legacy pr-N tags are frozen in place and remain installable.
  • Bot comment: Option A now prints the EXACT immutable version string (npm install -g billion-context@0.0.<N>-pr.<P>.<sha7>) instead of @pr-N, and notes that @pr tracks the newest test build across all PRs. The version is passed via GITHUB_OUTPUT → step env; the fork path (publish skipped, no NPM_TOKEN) falls back to the artifact-only comment as before. Artifact tarball path (Option B, billion-context-pr<N>.tgz) is unchanged.

Release drift guards (new invariant: official releases always sort above the PR-build line)

  • .github/workflows/release-manual.yml: the Drift guard aborts if the target version matches 0.0.*.
  • .github/workflows/release.yml: the Read version step aborts if package.json's version matches 0.0.*.

Docs/changelog: CONFIGURATION.md / CONFIGURATION.zh-CN.md ACP_UPDATE_TAG row updated (rolling pr semantics + frozen legacy pr-N); CHANGELOG.md entry under [Unreleased].

Behavior changes (disclosed per AGENTS.md)

Surface Old New Why
Install command in PR comments billion-context@pr-N (tag) exact version string reproducible installs (#1108); the tag is now global
pr-N tags moved on every push to PR N frozen at PR N's last build stop unbounded per-PR tag growth
New dist-tags per build 1 (pr-N) 0 (re-points rolling pr) registry tag count stops growing (~643 live at review time)
Version namespace 0.0.0-pr.P.RUN 0.0.SEQ-pr.P.SHA[-aN] monotonic ordering; rerun-safe (E409 fix)
Release guards none for < 0.1.0 targets abort on 0.0.* keeps the official line above the PR-build line forever

Not affected: latest / release flow, auto-update default channel (latest), semver-range resolution of PR builds (still impossible — prerelease property kept), fork-PR behavior (publish skipped), artifact downloads. Instances explicitly configured with ACP_UPDATE_TAG=pr-N freeze at that tag's final build (the tag still resolves; nothing breaks, no forced migration — see #1385 discussion).

Pre-flight

Touches release workflow machinery → human review required (§7.4 auto-merge gate).

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-26_rolling-pr-tag (e055209)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.1394-pr.1432.7d03bcd

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr1432.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei
ranxianglei force-pushed the 2026-09-26_rolling-pr-tag branch from 6c56414 to 6e7e95c Compare September 26, 2026 14:54
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 收到,开始 review。PR head 6e7e95c6 已确认 rebase 在当前 master(825f1529,v0.1.158)之上,diff 与描述一致(6 文件 +48/−16,无 src/ 改动)。正在逐项核对三个 workflow 的完整上下文、YAML 有效性与 CI 状态,结论稍后回复。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review 完成,结论:可以合并(触碰 release workflow 机制,按 §7.4 属人工合并类——我不执行合并)。

① 原 issue(#1385)方向

owner 已在 #1385 floor 4 拍板批准(单滚动 pr tag + 全局单调序号)。实现与批准方案逐项一致:run_number 作 SEQ、-a<attempt> 防 E409、滚动 pr tag、bot comment 精确版本串、release drift guard、文档同步。修的是根因(tag 无界增长的机制本身),不是症状。方向正确。

② 回归审查 —— 触碰路径的既有行为清单

.github/workflows/pr-artifact.yml

既有行为 结论
fork PR 跳过 publish(无 NPM_TOKEN,#670) ✅ 保持(if 条件未动);fork comment 文案微调("PR-tag publish"→"publish"),纯措辞
artifact tarball + upload(Option B,billion-context-pr<N>.tgz) ✅ 保持,diff 未触碰
comment create-or-update 逻辑(找 Bot + "📦 Built Package Artifact" 更新旧评论) ✅ 保持,仅 Option A 内容变化
publish 失败 → job 在 comment 前挂掉,不留过期评论 ✅ 保持(新旧同构);GITHUB_OUTPUT 在 publish 成功后无条件写入,showNpmOption 的 false 分支只可能来自 fork/skip,无"同仓 PR 却无版本串"的空洞
npm version --no-git-tag-version 后 npm pack(tarball 内为 pr 版本号) ✅ 保持,原有模式
Option A 内容 / publish tag / 版本命名空间 ⚠️ 有意变更,已披露(PR 描述表格与我的独立核对一致)

.github/workflows/release-manual.yml:drift guard 新增 0.0.* abort,位置在 Bump/push/publish 之前 ✅。auto-bump 路径(npm latest ≥0.1.x 取 next-patch)不可能产出 0.0.*;显式输入先过 semver 正则再过 guard;dev/prerelease 流(0.1.x-beta)不匹配 0.0.*,不受影响。唯一新拒绝面 = 人为输入 <0.1.0 目标,正是本 PR 目的。

.github/workflows/release.yml:Read version 加同款 abort,位于 Build-and-test 之后、tag/publish 之前(fail-fast 对准发布动作,测试照跑);下游步骤消费的 steps.version.outputs.version 输出契约不变 ✅。

文档:CONFIGURATION.md:600 / .zh-CN.md:599 的新文案与 src/update.ts 实际行为一致(normalizeUpdateTag 接受任意 tag,pr 滚动、pr-N 冻结但可解析);CHANGELOG [Unreleased] 条目准确。全仓 grep 无遗留旧方案引用(workflow 里仅剩 artifact 名的 pr-N,那是有意保留的 Option B)。

③ 代码审查

  • shell:[ "$RUN_ATTEMPT" != "1" ] 覆盖 attempt≥2 ✅;case ... 0.0.*) glob 正确、引号无误;
  • 版本串 0.0.<N>-pr.<P>.<sha7>[-aN] 全部 prerelease identifier 均为字母数字,合法 semver —— 且已被 npm registry 实际接受(见下);
  • JS:showNpmOption = !isFork && publishedVersion !== '' 门控正确;模板拼接无注入面;日志/comment 不含 secret;
  • 排序性质复核:0.0.<N>-… < 0.1.0(minor 0<1 恒成立)、> 存量 0.0.0-pr.*(patch N≥1>0)、pre 属性保留 → 任何普通 semver range 仍不可命中(与 [opencode 2.x] bare npm spec ("billion-context") triggers managed-service restart loop; pinning an exact version avoids it #1108 防护面一致)。

④ 测试有效性 —— 本 PR 自带真实 e2e 证据(workflow 类改动最强验证)

新代码在本 PR 自己身上已经跑了两次真实发布:

  • run 1347(head 6c56414d)→ 发布 0.0.1347-pr.1432.8689cb5,创建评论含精确版本串;
  • run 1351(rebase 后 head 6e7e95c6)→ 发布 0.0.1351-pr.1432.97ac88e,单调新号、无 E409,重指 pr tag,并原地刷新了同一条评论(GitHub API 实测 updated_at 14:54:41Z,正文已是新版本串;本地 mirror 显示旧文是平台同步滞后,非 bug);
  • registry 实测:dist-tags.pr = 0.0.1351-pr.1432.97ac88e,pr-1432 不存在 → "新增 dist-tag = 0" 不变式成立;
  • CI:head 6e7e95c6 上 12/12 check runs success(test ×4 OS/Node 矩阵、version-guard、hermetic registry e2e、各 lane e2e、build-artifact);base = 当前 master 825f1529(v0.1.158),mergeable=true。

⑤ diff 整洁度

6 文件 +48/−16,单提交,rebase 在最新 master,每行都服务 #1385;无空行/重排噪音、无 lockfile/生成物 churn。干净。

一个非阻塞观察(记录在案,不改)

pull_request 事件下 GITHUB_SHA 是 merge commit(refs/pull/N/merge)而非裸 head SHA:run 1351 构建并发布的就是 merge commit 97ac88ec(我核对了 PR API 的 merge_commit_sha,与版本串后缀一致)。这其实比字面方案更准确——checkout 检出的、被打进 tarball 的树正是该 merge commit;唯一性由 run_number 兜底,不受影响。副作用仅是 cosmetic:comment 头部显示 head 短 SHA(6e7e95c)而安装命令内嵌 merge 短 SHA(97ac88e),细心读者可能对比一下。不值得为此改动。


中文摘要:实现了 owner 批准的"单滚动 pr tag + 单调 0.0.<run>-pr.<PR>.<sha> 版本号"方案以停止 dist-tag 无界增长,并为正式 release 线补了 <0.1.0 abort 守卫;新代码已在本 PR 上两次真实发版验证(单调无冲突、零新增 tag、评论精确版本串端到端正确),CI 12/12 绿,diff 干净且全部行为变更均已披露——可以合并(release workflow 机制变更,按 §7.4 请人工合并)。

ework-agent and others added 11 commits September 27, 2026 09:28
…search.planAware)

Re-rank search_context candidates against in-context plan state (latest planning-tool snapshots + most recent user turn) when matches exceed limit; append a [plan-aware] steering section (top fetch targets + repeat-retrieve hint). Byte-identical output when off or when no plan state is present; foreign-session searches stay read-only lexical. Retrieval-quality stats (whole-block restores vs cheaper precise path available) surface in acp_status. Default off until measured.

Fixes #1336
The feature commit rewrote the historical-session note text in
executeSearchContext without gating it on compress.search.planAware.
That breaks two documented properties:

1. The PR's own contract that foreign-session searches stay
   "byte-identical to before" when the new flag is off — the rewrite
   fires for every foreign lookup regardless of config.
2. The pinned assertions in tests/search-context-cross-session.test.ts
   ("Read-only search of historical session ..."), which fail with the
   new wording even though the PR does not touch that test file.

Revert to the original wording (verified byte-identical to master).
…ofile (#1279 follow-up)

When no level sets compress.priceProfile, the session stamp now falls back to the request model's models.dev price row (absolute $\/Mtok: w = cost.input, r = cost.cache_read ?? 0.1*input, q = cost.output ?? 1.5*input). Known-provider hosts get their own listing; unknown relays take the first matching listing with a one-time conflict warning. Live catalog.json wins when reachable, bundled snapshot is the offline floor (snapshot rebuilt to carry 7126 cost rows). User config at any level still wins wholesale; unresolvable models keep the kernel relative defaults.
…lback to kernel 4x, legacy-disk price fallthrough, e2e teardown hygiene (review round 2)
…w B)

Correct the claim in pr-artifact.yml and CHANGELOG: github.run_number is
unique+monotonic per WORKFLOW; uniqueness of 0.0.x versions rests on this
workflow being the sole 0.0.x publisher (rename/duplicate would restart the
counter silently).
@ranxianglei

Copy link
Copy Markdown
Owner Author

Deep-review complete — Approve; one doc correction applied on-branch (rebased onto current master).

Verified

  1. Rolling tag discipline: the only publish site uses explicit --tag pr; npm never moves latest on explicitly-tagged publishes; repo-wide grep confirms exactly 3 publish sites, both release paths latest/dev only. Live check: latest/dev clean.
  2. Monotonic 0.0.x namespace: 0.0.<run>-pr.<pr>.<sha7> never intersects 0.1.x; both release paths now hard-guard the floor (release.yml case 0.0.*, release-manual.yml target check — manual 0.0.5-beta inputs rejected too). Defense-in-depth, unreachable in normal flow.
  3. No build-time baking: version injected by npm version --no-git-tag-version in the runner workspace after build; every runtime surface (src/version.ts, src/plugin.ts PROXY_VERSION, src/update.ts readDiskVersion) reads the on-disk package.json, so installed PR builds self-report correctly. Branch package.json untouched (0.1.158) — §4 compliant.
  4. Idempotent re-runs: -a<attempt> appends on attempt ≥2 → fresh version instead of E409, and sorts correctly above the base build (dot-separated prerelease identifier ordering checked). Bot comment updated in place, artifact names run-scoped.
  5. Secrets/forks unchanged: NPM_TOKEN scoped to the publish step; fork PRs skip publish; hidden empty Option A.

Fixed on-branch

B (doc): "run_number is repo-wide unique and monotonic" was factually wrong — it is unique+monotonic per workflow. Uniqueness of the 0.0.x namespace rests on this workflow being the sole 0.0.x publisher; renaming/duplicating the workflow file would silently restart the counter. Corrected in pr-artifact.yml comment + CHANGELOG.

Info (no action)

No src/ changes → no runtime/typecheck surface. Ready to merge. Fixes #1385.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Verified the updated head (47b6d72d) — everything checks out; ready for you to merge.

Doc fix (B) — confirmed on-branch. 47b6d72d touches exactly .github/workflows/pr-artifact.yml (comment) + CHANGELOG.md ([Unreleased] entry), +3/−2: "repo-wide unique and monotonic" → "unique+monotonic per workflow … sole 0.0.x publisher". And your correction is right — I have direct round-1 evidence for it: the pr-artifact.yml run list showed perfectly consecutive run numbers 1343→1352 across ~10 minutes while CI-test/e2e/release workflows were firing on the same pushes. A repo-wide shared counter would show gaps between consecutive build-artifact runs there; consecutive numbering is empirical proof of per-workflow counters. The stated consequence (rename/duplicate silently restarts the counter) is accurate — and worth noting the collision mode is fail-fast: a restarted counter hitting an already-published 0.0.N-pr.* fails loudly with E409, never silent corruption.

Final-head state:

No changes requested. Merging stays human-only (§7.4 — release-workflow machinery).

中文摘要:已核实分支上的文档修正(run_number 按工作流唯一而非全仓库唯一,提交 47b6d72d 仅改注释与 CHANGELOG)、新 head CI 13/13 全绿、对当前 master 的内容差异仍为原 6 个文件且可合并、docs-only push 再次端到端验证了滚动 pr tag 与单调版本号(0.0.1378-pr.1432.3e9fea0)——无遗留问题,可以合并。

@ranxianglei
ranxianglei merged commit a2dbca3 into master Sep 27, 2026
12 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 27, 2026
@ranxianglei
ranxianglei deleted the 2026-09-26_rolling-pr-tag branch October 15, 2026 05:32
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.

Design: PR artifact publishing — stop dist-tag growth with single rolling tag + monotonic 0.0.x-pr versions

1 participant