Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 53 additions & 24 deletions .github/workflows/release-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,17 @@ jobs:
exit 1
fi

- name: Pre-flight gate
# keep the claude-native live e2e subtests in this pre-publish gate (#1248)
env:
ACP_TEST_CLAUDE_NATIVE: "1"
- name: Pre-flight gate (fast sanity)
# #3539: the full `npm test` used to serialize here (~30-40 min on one
# shared 2-core runner) and then run AGAIN as the sharded CI matrix —
# the same suites twice per release chain. The full suite is now owned
# exclusively by the CI lanes dispatched at the exact publish sha
# below (policy 2026-10-10 unchanged); the Full CI gate blocks publish
# until they are all green, so coverage is identical — only the
# executor moved from this job to the parallel lane matrix.
run: |
npm ci
npm run typecheck
npm test
npm run build

- name: Commit and push to master
Expand Down Expand Up @@ -162,10 +165,13 @@ jobs:
# npm publish. The direct-push commit lands on master via GITHUB_TOKEN,
# which fires no push events — nothing runs CI on it. Dispatch every
# missing lane at master (idempotent); the Full CI gate step below
# blocks publish until all lanes are green.
# blocks publish until all lanes are green. The script first refuses
# to dispatch if master's head is no longer the release commit
# (#3539) and cancels stale in-flight runs from this attempt.
if: steps.push.outputs.direct == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_RUN_STARTED_AT: ${{ github.run_started_at }}
run: |
GITHUB_SHA="$(git rev-parse HEAD)"
GITHUB_REF_NAME="master"
Expand All @@ -175,44 +181,45 @@ jobs:
- name: Full CI gate (all lanes green at the release commit)
# Hard precondition for publish: every required lane green at the
# publish sha. Any red lane or timeout ⇒ release fails, nothing is
# published. NOTE: dispatches above landed at master's head — if
# another push lands first, the runs' head_sha no longer matches this
# commit, the gate times out and publish is blocked (fail-safe).
# published. The dispatch step above already refused to fire when
# master's head was not this commit (#3539); a later push does not
# invalidate runs already landed at it.
if: steps.push.outputs.direct == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_RUN_STARTED_AT: ${{ github.run_started_at }}
CI_GATE_TIMEOUT_MIN: "60"
run: |
GITHUB_SHA="$(git rev-parse HEAD)"
GITHUB_REF_NAME="master"
export GITHUB_SHA GITHUB_REF_NAME
node scripts/release-ci-gate.mjs --wait

- name: Dispatch CI on fallback branch
- name: Dispatch full CI on fallback branch
if: steps.push.outputs.needs_pr == 'true'
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_BRANCH: ${{ steps.push.outputs.pr_branch }}
RELEASE_RUN_STARTED_AT: ${{ github.run_started_at }}
CI_FULL_DISPATCH: "1"
run: |
# GITHUB_TOKEN ref updates deliver no push events, so the push
# trigger in ci.yml never fires on this branch. An explicit
# workflow_dispatch on the same ref produces check runs on the head
# sha → required status checks pass → the auto-PR is mergeable
# without approving its gated pull_request runs (#772, #1744).
RESP_FILE="$(mktemp)"
HTTP_CODE="$(curl -sS -o "$RESP_FILE" -w '%{http_code}' -X POST \
-H "Authorization: Bearer $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
-H "Content-Type: application/json" \
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/ci.yml/dispatches" \
-d "{\"ref\": \"${PR_BRANCH}\"}")"
echo "POST /dispatches (ci.yml, ref=${PR_BRANCH}) → HTTP ${HTTP_CODE}"
if [ "$HTTP_CODE" != "204" ]; then
echo "::warning::could not dispatch CI on ${PR_BRANCH} (HTTP ${HTTP_CODE}: $(cat "$RESP_FILE")). The fallback PR stays gated until someone approves its workflow runs manually."
else
echo "::notice::CI dispatched on ${PR_BRANCH}; once its check runs are green the fallback PR satisfies required checks and is mergeable."
fi
# #3539: dispatch the COMPLETE lane set (ci.yml FULL matrix + every
# e2e lane) in one pass — previously only ci.yml CORE landed here
# and release.yml re-ran the rest after merge, paying for the same
# suites up to three times per chain. With everything green at the
# PR head, release.yml's gate reuses the runs and publishes without
# extra CI. The script verifies the branch head matches before
# dispatching and cancels stale in-flight runs from this attempt.
GITHUB_SHA="$(git rev-parse HEAD)"
GITHUB_REF_NAME="$PR_BRANCH"
export GITHUB_SHA GITHUB_REF_NAME
node scripts/release-ci-gate.mjs --dispatch

- name: Open fallback PR (best effort)
if: steps.push.outputs.needs_pr == 'true'
Expand Down Expand Up @@ -289,6 +296,28 @@ jobs:
echo "::warning::Finish the release with one click: ${LINK} (then merge to publish v${VER})"
exit 0

- name: Wait for full CI green on fallback branch (track head)
if: steps.push.outputs.needs_pr == 'true'
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_BRANCH: ${{ steps.push.outputs.pr_branch }}
RELEASE_RUN_STARTED_AT: ${{ github.run_started_at }}
WAIT_TRACK_HEAD: "1"
CI_GATE_TIMEOUT_MIN: "60"
run: |
# Certifies "fallback PR ready": every required lane green at the
# CURRENT branch head. If master gets merged into the release branch
# mid-wait (the v0.1.198 queue stomp, #3534), the head moves: stale
# in-flight runs at the old head are cancelled and missing lanes are
# re-dispatched at the new head instead of burning runners on a
# superseded sha. On timeout the PR stays open with CI still running
# — watch the PR, nothing is lost.
GITHUB_SHA="$(git rev-parse HEAD)"
GITHUB_REF_NAME="$PR_BRANCH"
export GITHUB_SHA GITHUB_REF_NAME
node scripts/release-ci-gate.mjs --wait

- name: Check if prerelease
id: pre
if: steps.push.outputs.direct == 'true'
Expand Down
30 changes: 29 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@ jobs:
export GITHUB_SHA EXTRA_MATCH_SHAS
node scripts/release-ci-gate.mjs --dispatch

- name: Probe full-suite reuse (#3539)
# One-shot, non-blocking: is the full suite ALREADY proven green at
# the PR head (every required lane has a green run there)? Together
# with "master did not move since", that lets Build-and-test skip its
# local full pass — the one-click fallback chain then pays for the
# full suite exactly once. Any doubt falls back to running it.
if: steps.check.outputs.is_release == 'true'
id: reuse
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
GITHUB_SHA="$(git rev-parse HEAD)"
EXTRA_MATCH_SHAS="$(git rev-parse HEAD^2 2>/dev/null || true)"
export GITHUB_SHA EXTRA_MATCH_SHAS
node scripts/release-ci-gate.mjs --probe-reuse

- name: Setup
if: steps.check.outputs.is_release == 'true'
run: npm ci
Expand All @@ -62,7 +79,18 @@ jobs:
ACP_TEST_CLAUDE_NATIVE: "1"
run: |
npm run typecheck
npm test
# #3539: skip the local full pass only when it is provably redundant —
# every required lane already green at the PR head (reuse probe above)
# AND master did not move since (HEAD^2..HEAD empty), i.e. the PR-head
# tree IS this tree. Human-cut release PRs (core lanes only) never
# skip: their e2e lanes are absent at the PR head, so this runs
# exactly as before. The Full CI gate below still blocks publish.
MASTER_ONLY="$(git rev-list --count HEAD^2..HEAD 2>/dev/null || echo 1)"
if [ "${{ steps.reuse.outputs.allLanesReused }}" = "yes" ] && [ "$MASTER_ONLY" -eq 0 ]; then
echo "full suite already green at the PR head and master did not move since — skipping the local full pass (#3539)"
else
npm test
fi
npm run build

- name: Read version
Expand Down
49 changes: 34 additions & 15 deletions reference/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,15 @@ The Agent does steps 1–6, the human does step 7 (merge).
- PR title: `release v{VERSION}`; body lists changes since last tag.
7. **Human merges the PR** (Agent MUST NOT merge).
8. **CI publishes automatically** — no manual `npm publish`:
- On merge, `release.yml` detects the `*_release-v*` branch name +
`release v{VERSION}` commit message.
- It runs `npm ci` + `typecheck` + `test` + `build`, then
`npm publish --tag latest` (using the `NPM_TOKEN` repo secret), creates git
tag `v{VERSION}`, and creates a GitHub Release.
- On merge, `release.yml` detects the `*_release-v*` branch name +
`release v{VERSION}` commit message.
- It runs `npm ci` + `typecheck` + `build`, plus the full test suite UNLESS a
reuse probe proves it redundant: every required CI lane already green at the
PR head AND master did not move since the PR head (#3539 — the full suite is
then paid for exactly once per chain; human-cut PRs with core lanes only never
skip). The full-CI gate still blocks publish until every lane is green at the
publish sha (fresh or reused). Then `npm publish --tag latest` (using the
`NPM_TOKEN` repo secret), git tag `v{VERSION}`, GitHub Release.
9. **Verify** the published version is live:
```bash
npm view billion-context version
Expand Down Expand Up @@ -137,8 +141,15 @@ The workflow then:
prerequisite above.
2. Bumps ONLY `package.json` + `package-lock.json` and commits `release v{VERSION}` —
the same one-version-one-commit discipline as `AGENTS.md` Version Bumps.
3. Runs the full pre-flight gate (`npm ci` + typecheck + test + build).
3. Runs the fast pre-flight gate (`npm ci` + typecheck + build). The FULL test suite
deliberately does NOT run here anymore (#3539): it runs exactly once, as the sharded
CI lanes dispatched at the exact publish sha in the next steps, and the full-CI gate
blocks publish until they are all green — same coverage, parallel shards instead of
~30-40 min serial on one shared runner.
4. Pushes the release commit directly to `master` (GITHUB_TOKEN, fast-forward only).
On success the run dispatches every missing CI lane at the release commit — refusing
first if master's head has moved past it — and blocks until all lanes are green
before publishing.
If branch protection blocks direct pushes, the release lands on a release branch
instead and the run tries to open the release PR itself (best-effort — if the account
forbids Actions-created PRs the run still finishes green with a one-click "open the
Expand All @@ -148,15 +159,23 @@ The workflow then:
publishes via the standard flow; red is reserved for real failures (guard trips,
gate failures, or a failed branch push). GitHub suppresses push-event delivery for
ref updates made with GITHUB_TOKEN, so the push trigger never fires on the fallback
branch; instead the run explicitly dispatches `ci.yml` on that branch
(`POST …/actions/workflows/ci.yml/dispatches`, ref = branch; requires the
`workflow_dispatch` trigger that `ci.yml` declares for exactly this purpose). Those
check runs land on the same head sha — once green, required checks pass and the
auto-PR is mergeable without approving its `action_required` pull_request runs
(bot-authored PRs are gated there) (#772, #1744). If the dispatch fails (transient
API error), the fallback PR stays gated until someone approves those runs manually.
(Push-triggered CI on release branches still works for branches pushed with a real
account token — e.g. agent-driven standard-flow release branches.)
branch; instead the run invokes `scripts/release-ci-gate.mjs --dispatch` with
`CI_FULL_DISPATCH=1`, which fires the COMPLETE lane set at the branch head in one
pass — `ci.yml` in FULL matrix scope plus every e2e lane (each requires the
`workflow_dispatch` trigger the workflows declare for exactly this purpose). Those
check runs land on the same head sha — once green, required checks pass and the
auto-PR is mergeable without approving its `action_required` pull_request runs
(bot-authored PRs are gated there) (#772, #1744). Because the full set goes green
at the PR head, `release.yml` reuses every run at merge time instead of re-running
the suites (#3539: one full pass per chain). The dispatch refuses to fire if the
branch head no longer matches the release commit, cancels stale in-flight runs from
the attempt, and a follow-up track-head wait step certifies "PR ready": if master
gets merged into the release branch mid-wait, stale runs at the old head are
cancelled and missing lanes re-dispatched at the new head instead of burning
runners on a superseded sha (the v0.1.198 queue stomp, #3539/#3534). If the dispatch
fails (transient API error), the fallback PR stays gated until someone approves
those runs manually. (Push-triggered CI on release branches still works for branches
pushed with a real account token — e.g. agent-driven standard-flow release branches.)
5. Publishes to npm (`latest`, or `dev` for prerelease), tags `v{VERSION}`, and creates
the GitHub Release with notes generated from `git log` since the last tag.

Expand Down
Loading
Loading