Skip to content

Commit 10ec91c

Browse files
committed
chore - add session persistence for chore/bolster-install
1 parent 4b61290 commit 10ec91c

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
29+
## Key Decisions
30+
31+
### `OPENCODE_CHANNEL=flex` in `install-flex`
32+
OpenCode bakes `InstallationChannel` from the git branch at build time and uses it
33+
as the SQLite DB name suffix (`opencode-<channel>.db`). Without pinning, each
34+
rebuild from a different branch creates a fresh empty database, losing all session
35+
history. Pinning to `"flex"` ensures all Flexion builds share `opencode-flex.db`.
36+
See: `packages/opencode/src/storage/db.ts:getChannelPath()`.
37+
38+
### `OPENCODE_DISABLE_PLUGIN_DEPS_INSTALL` flag
39+
`config.ts` fires a background `@npmcli/arborist.reify()` for `@opencode-ai/plugin`
40+
in every `.opencode/` directory it discovers. In tests, 7 tests were timing out
41+
because: plugin/tool tests called `waitForDependencies()` which joined the arborist
42+
fiber (10–30 s per test on ARM64), and the resulting CPU saturation starved
43+
concurrent session/snapshot tests. The flag skips the install in tests; safe because
44+
bun resolves `@opencode-ai/plugin` from the workspace `node_modules` directly.
45+
Set unconditionally in `test/preload.ts`.
46+
47+
### Blacksmith ARM64 runner gaps
48+
`blacksmith-4vcpu-ubuntu-2404` uses ARM64 and ships a minimal Ubuntu image missing:
49+
- `unzip` — needed by `oven-sh/setup-bun@v2` to extract the downloaded bun zip
50+
- `make`/`g++` (build-essential) — needed by `node-gyp` for `tree-sitter-powershell`
51+
Both now installed in a single `Ensure build tools are available` step in
52+
`.github/actions/setup-bun/action.yml` (Linux only, no-op if already present).
53+
54+
### Test timeout bumps
55+
- `snapshot.test.ts` "revert handles large mixed batches": 30 s → 60 s
56+
(280 files + multiple git commits/patches/reverts on ARM64)
57+
- `prompt-effect.test.ts` "loop waits while shell runs": 3 s → 15 s
58+
(spawns a real `sleep 0.2` subprocess; ARM64 fork/exec overhead exceeds 3 s)
59+
60+
## Files Changed
61+
- `install-flex``OPENCODE_CHANNEL=flex` added to build command
62+
- `.github/actions/setup-bun/action.yml` — build tools prereq + ARM64/X64 URL construction
63+
- `.github/workflows/test.yml` — npm cache + pre-warm step (unit job)
64+
- `packages/opencode/src/flag/flag.ts``OPENCODE_DISABLE_PLUGIN_DEPS_INSTALL` flag
65+
- `packages/opencode/src/config/config.ts` — guard arborist install with new flag
66+
- `packages/opencode/test/preload.ts` — set `OPENCODE_DISABLE_PLUGIN_DEPS_INSTALL=true`
67+
- `packages/opencode/test/snapshot/snapshot.test.ts` — 60 s timeout on 280-file test
68+
- `packages/opencode/test/session/prompt-effect.test.ts` — 15 s timeout on shell-loop test
69+
70+
## Side Effects Applied Outside the Repo
71+
- `~/.opencode/bin/opencode` — rebuilt from this branch with `OPENCODE_CHANNEL=flex`;
72+
now reports `0.0.0-flex-<timestamp>` and uses `~/.local/share/opencode/opencode-flex.db`
73+
74+
## Next Steps
75+
- [ ] Merge PR #11 into flex: https://github.com/flexion/opencode/pull/11
76+
- [ ] After merge, other developers run `install-flex` to pick up all fixes
77+
- [ ] Consider periodically running `install-flex` to stay current with `flex` branch

0 commit comments

Comments
 (0)