|
| 1 | +# Session: Bolster Install — Blacksmith ARM64 CI Fixes |
| 2 | + |
| 3 | +**Branch**: chore/bolster-install |
| 4 | +**Issue**: N/A |
| 5 | +**Created**: 2026-04-22 |
| 6 | +**Status**: complete — PR #11 open, awaiting merge |
| 7 | + |
| 8 | +## Goal |
| 9 | +Harden the `install-flex` automated installer and fix all Blacksmith ARM64 CI |
| 10 | +failures that were blocking the unit and e2e test jobs on the Flexion fork. |
| 11 | + |
| 12 | +## Approach |
| 13 | +Fix issues in layers as they surfaced during CI runs: |
| 14 | +1. Add `install-flex` installer script |
| 15 | +2. Pin `OPENCODE_CHANNEL=flex` to prevent per-branch SQLite DB fragmentation |
| 16 | +3. Fix missing build tools on Blacksmith ARM64 runners |
| 17 | +4. Fix unit test timeouts caused by arborist npm installs during tests |
| 18 | +5. Bump individual test timeouts that are tight on ARM64 |
| 19 | + |
| 20 | +## Session Log |
| 21 | +- 2026-04-22: Session created |
| 22 | +- 2026-04-22: Added `install-flex` script (already existed on branch), fixed DB fragmentation |
| 23 | +- 2026-04-22: CI round 1 — fixed `unzip` missing (setup-bun) |
| 24 | +- 2026-04-22: CI round 2 — fixed `make`/`g++` missing (build-essential for node-gyp) |
| 25 | +- 2026-04-22: CI round 3 — 7 test timeouts; root-caused to `@npmcli/arborist.reify()` in tests |
| 26 | +- 2026-04-22: CI round 4 — 1 remaining timeout; fixed shell-loop test 3s → 15s |
| 27 | +- 2026-04-22: All CI jobs passing. PR updated. |
| 28 | +- 2026-04-22: CI round 5 — 1 new timeout; "shell rejects with BusyError when loop running" 3s → 15s |
| 29 | + |
| 30 | +## Key Decisions |
| 31 | + |
| 32 | +### `OPENCODE_CHANNEL=flex` in `install-flex` |
| 33 | +OpenCode bakes `InstallationChannel` from the git branch at build time and uses it |
| 34 | +as the SQLite DB name suffix (`opencode-<channel>.db`). Without pinning, each |
| 35 | +rebuild from a different branch creates a fresh empty database, losing all session |
| 36 | +history. Pinning to `"flex"` ensures all Flexion builds share `opencode-flex.db`. |
| 37 | +See: `packages/opencode/src/storage/db.ts:getChannelPath()`. |
| 38 | + |
| 39 | +### `OPENCODE_DISABLE_PLUGIN_DEPS_INSTALL` flag |
| 40 | +`config.ts` fires a background `@npmcli/arborist.reify()` for `@opencode-ai/plugin` |
| 41 | +in every `.opencode/` directory it discovers. In tests, 7 tests were timing out |
| 42 | +because: plugin/tool tests called `waitForDependencies()` which joined the arborist |
| 43 | +fiber (10–30 s per test on ARM64), and the resulting CPU saturation starved |
| 44 | +concurrent session/snapshot tests. The flag skips the install in tests; safe because |
| 45 | +bun resolves `@opencode-ai/plugin` from the workspace `node_modules` directly. |
| 46 | +Set unconditionally in `test/preload.ts`. |
| 47 | + |
| 48 | +### Blacksmith ARM64 runner gaps |
| 49 | +`blacksmith-4vcpu-ubuntu-2404` uses ARM64 and ships a minimal Ubuntu image missing: |
| 50 | +- `unzip` — needed by `oven-sh/setup-bun@v2` to extract the downloaded bun zip |
| 51 | +- `make`/`g++` (build-essential) — needed by `node-gyp` for `tree-sitter-powershell` |
| 52 | +Both now installed in a single `Ensure build tools are available` step in |
| 53 | +`.github/actions/setup-bun/action.yml` (Linux only, no-op if already present). |
| 54 | + |
| 55 | +### Test timeout bumps |
| 56 | +- `snapshot.test.ts` "revert handles large mixed batches": 30 s → 60 s |
| 57 | + (280 files + multiple git commits/patches/reverts on ARM64) |
| 58 | +- `prompt-effect.test.ts` "loop waits while shell runs": 3 s → 15 s |
| 59 | + (spawns a real `sleep 0.2` subprocess; ARM64 fork/exec overhead exceeds 3 s) |
| 60 | +- `prompt-effect.test.ts` "shell rejects with BusyError when loop running": 3 s → 15 s |
| 61 | + (fiber fork + session init before `llm.wait(1)` exceeds 3 s on ARM64) |
| 62 | + |
| 63 | +## Files Changed |
| 64 | +- `install-flex` — `OPENCODE_CHANNEL=flex` added to build command |
| 65 | +- `.github/actions/setup-bun/action.yml` — build tools prereq + ARM64/X64 URL construction |
| 66 | +- `.github/workflows/test.yml` — npm cache + pre-warm step (unit job) |
| 67 | +- `packages/opencode/src/flag/flag.ts` — `OPENCODE_DISABLE_PLUGIN_DEPS_INSTALL` flag |
| 68 | +- `packages/opencode/src/config/config.ts` — guard arborist install with new flag |
| 69 | +- `packages/opencode/test/preload.ts` — set `OPENCODE_DISABLE_PLUGIN_DEPS_INSTALL=true` |
| 70 | +- `packages/opencode/test/snapshot/snapshot.test.ts` — 60 s timeout on 280-file test |
| 71 | +- `packages/opencode/test/session/prompt-effect.test.ts` — 15 s timeout on shell-loop test |
| 72 | + |
| 73 | +## Side Effects Applied Outside the Repo |
| 74 | +- `~/.opencode/bin/opencode` — rebuilt from this branch with `OPENCODE_CHANNEL=flex`; |
| 75 | + now reports `0.0.0-flex-<timestamp>` and uses `~/.local/share/opencode/opencode-flex.db` |
| 76 | + |
| 77 | +## Next Steps |
| 78 | +- [ ] Merge PR #11 into flex: https://github.com/flexion/opencode/pull/11 |
| 79 | +- [ ] After merge, other developers run `install-flex` to pick up all fixes |
| 80 | +- [ ] Consider periodically running `install-flex` to stay current with `flex` branch |
0 commit comments