Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

ci-bun-install: admin installs resolve the wrapper from admin/; the scan checks every path

garrytan8ed7a43bcd42
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index db293fa7d0..feeb3dc8cf 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -292,7 +292,7 @@ jobs:
run: bun scripts/ci-bun-install.ts --frozen-lockfile --ignore-scripts
- name: Install dependencies (bounded, retried once)
timeout-minutes: 8
- run: bun scripts/ci-bun-install.ts --frozen-lockfile --ignore-scripts
+ run: bun ../scripts/ci-bun-install.ts --frozen-lockfile --ignore-scripts
working-directory: admin
- name: bun audit (root + admin)
env:
@@ -922,7 +922,7 @@ jobs:
run: bun scripts/ci-bun-install.ts --frozen-lockfile --ignore-scripts
- name: Install dependencies (bounded, retried once)
timeout-minutes: 8
- run: bun scripts/ci-bun-install.ts --frozen-lockfile --ignore-scripts
+ run: bun ../scripts/ci-bun-install.ts --frozen-lockfile --ignore-scripts
working-directory: admin
- name: Install the pinned Chromium browser and OS dependencies
run: bunx playwright install --with-deps chromium
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 38b9bd3072..b04db0b78f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,7 +19,7 @@ identifiers and attribution are available in the pre-removal Git revision
- **`scripts/ci-bun-install.ts`** runs `bun install` with the flags it's given. An attempt that's still running after 180 s is killed and named in a `::warning::`, then retried once after 10 s. A second failure stops the step with `::error::bun install … stalled: no result after 180s … on attempt 2 of 2; giving up`. A failure that isn't a stall (a frozen-lockfile mismatch, an unreachable registry) keeps Bun's own output, is retried once, and is then reported with Bun's exit code. The script needs no dependencies, since it runs before they're installed, and spawns asynchronously, so it behaves the same on Linux, macOS and Windows. Its shape follows `scripts/ci-install-openclaw.sh`.
- **Every root-package install in `.github/workflows/` uses it** (48 steps across nine workflows, plus the native musl container run). Each such step gets `timeout-minutes: 8` as a backstop; job timeouts are unchanged. The admin bundle install in `release.yml` stays as it is, since `test/release-workflow.test.ts` pins it as a supply-chain contract.
- **Proof.**
- - `test/scripts/ci-bun-install.test.ts` uses a stub `bun` whose first attempt really sleeps far past a 1 s bound. The case where the second attempt installs passes in about 1 s; with two stalls, it stops with the named error in about 2 s. Bun's own error and exit code come through on a non-stall failure, and a clean install runs once and prints no annotation. A workflow scan fails if a root `bun install --frozen-lockfile` step goes unwrapped, or if a wrapped step lacks the 8-minute backstop.
+ - `test/scripts/ci-bun-install.test.ts` uses a stub `bun` whose first attempt really sleeps far past a 1 s bound. The case where the second attempt installs passes in about 1 s; with two stalls, it stops with the named error in about 2 s. Bun's own error and exit code come through on a non-stall failure, and a clean install runs once and prints no annotation. A workflow scan fails if a root `bun install --frozen-lockfile` step goes unwrapped, if a wrapped step lacks the 8-minute backstop, or if the wrapper's path does not resolve from the step's `working-directory` (the two `admin/` installs in `test.yml` call `bun ../scripts/ci-bun-install.ts`).
- A real `bun install` pointed at a registry that accepts connections and never answers was killed at a 5 s bound, retried, and stopped with the named error in 11 s.
- A real install of this repository through the wrapper finished in 0.1 s.
diff --git a/test/scripts/ci-bun-install.test.ts b/test/scripts/ci-bun-install.test.ts
index 058ecfc12a..a11f81957a 100644
--- a/test/scripts/ci-bun-install.test.ts
+++ b/test/scripts/ci-bun-install.test.ts
@@ -83,13 +83,16 @@ test('every workflow install of the root package goes through the bounded wrappe
const workflows = new Bun.Glob('.github/workflows/*.yml');
const direct: string[] = [], bounded: string[] = [];
for (const file of workflows.scanSync(ROOT)) {
- const doc = load(readFileSync(join(ROOT, file), 'utf8')) as { jobs?: Record<string, { steps?: Array<{ run?: string; 'timeout-minutes'?: number }> }> };
+ const doc = load(readFileSync(join(ROOT, file), 'utf8')) as { jobs?: Record<string, { steps?: Array<{ run?: string; 'timeout-minutes'?: number; 'working-directory'?: string }> }> };
for (const [job, spec] of Object.entries(doc.jobs ?? {})) for (const step of spec.steps ?? []) {
for (const line of (step.run ?? '').split('\n')) {
if (/^\s*bun install --frozen-lockfile/.test(line)) direct.push(`${file} ${job}: ${line.trim()}`);
- if (/bun scripts\/ci-bun-install\.ts/.test(line) && step.run!.trim().startsWith('bun scripts/ci-bun-install.ts')) {
+ const wrapped = /^bun ((?:\.\.\/)*scripts\/ci-bun-install\.ts)\b/.exec((step.run ?? '').trim());
+ if (/scripts\/ci-bun-install\.ts/.test(line) && wrapped) {
bounded.push(`${file} ${job}`);
expect(step['timeout-minutes'], `${file} ${job}`).toBe(8);
+ // The path is relative to the step's working directory (admin installs run in admin/).
+ expect(existsSync(join(ROOT, step['working-directory'] ?? '.', wrapped[1])), `${file} ${job}: ${wrapped[1]}`).toBe(true);
}
}
}