ci: fix failing bun test in ci.yml test job #2

Closed
opened 2026-09-17 18:01:04 +00:00 by Mark · 1 comment
Owner

Problem

ci.yml test job consistently fails at ~4 min on a real bun test failure (not CI plumbing). Repo has zero successful CI runs in its history. Forgejo 13.0.4 has no /actions/jobs/{id}/logs endpoint and run pages 404 within hours, so failure must be reproduced locally.

Approach

  1. bun install (may need apt-get install build-essential python3 for native deps: @ast-grep/napi, @tensorflow/tfjs, @atjsh/llmlingua-2)
  2. Run the test job commands locally one at a time, starting with the ~13 mock-heavy isolated bun test calls (src/plugin-handlers, src/hooks/atlas, src/features/tmux-subagent, etc.), then the larger batch invocation.
  3. Identify the failing test.
  4. Fix it (or fix the test setup / mock isolation).
  5. Verify all tests pass locally.
  6. Push to main, verify ci.yml run goes green.

Acceptance

ci.yml workflow on Mark/oh-my-opencode-compression main produces a success run on Forgejo Actions with all jobs (block-main-pr skipped, test, typecheck, build, draft-release skipped) reporting success.

Substrate note

The kilo-gsd pre-dispatch gate (.gsd/gates/pre-dispatch.sh) was already installed on main in commit c9cf4f06.

References t_495c93e9.

## Problem ci.yml test job consistently fails at ~4 min on a real bun test failure (not CI plumbing). Repo has zero successful CI runs in its history. Forgejo 13.0.4 has no /actions/jobs/{id}/logs endpoint and run pages 404 within hours, so failure must be reproduced locally. ## Approach 1. bun install (may need apt-get install build-essential python3 for native deps: @ast-grep/napi, @tensorflow/tfjs, @atjsh/llmlingua-2) 2. Run the test job commands locally one at a time, starting with the ~13 mock-heavy isolated bun test calls (src/plugin-handlers, src/hooks/atlas, src/features/tmux-subagent, etc.), then the larger batch invocation. 3. Identify the failing test. 4. Fix it (or fix the test setup / mock isolation). 5. Verify all tests pass locally. 6. Push to main, verify ci.yml run goes green. ## Acceptance ci.yml workflow on Mark/oh-my-opencode-compression main produces a success run on Forgejo Actions with all jobs (block-main-pr skipped, test, typecheck, build, draft-release skipped) reporting success. ## Substrate note The kilo-gsd pre-dispatch gate (.gsd/gates/pre-dispatch.sh) was already installed on main in commit c9cf4f06. References t_495c93e9.
Mark closed this issue 2026-09-17 20:25:01 +00:00
Author
Owner

Resolution

CI is now green on commit cc54a70d. Run #39 reports success on all jobs:

  • block-main-pr: skipped (expected)
  • test: success in 2m22s
  • typecheck: success in 2m24s
  • build: success in 2m30s
  • draft-release: skipped (expected; only runs on dev)

Three commits closed the loop:

  1. 48d97a8a — fix(env-cleaner): bun 1.4+ coerces process.env.X = undefined to the string "undefined" when iterated via Object.entries (older bun stored null and was skipped by the === undefined check). The createCleanMcpEnvironment cleaner only handled the latter, so the skips undefined values from process.env test in env-cleaner.test.ts received the literal string "undefined" and failed under bun 1.4+. Fix: also skip the literal string.

  2. ab32f611 — test(background-agent): spy on readConnectedProvidersCache and readProviderModelsCache in the BackgroundManager.handleEvent - session.error describe block to return null, making the retry-path tests hermetic. Same pattern as src/tools/delegate-task/category-resolver.test.ts.

  3. cc54a70d — fix(package): removed the orphaned self-referencing @oh-my-opencode/compression dep that was in package.json but unused (no imports anywhere in src/, bin/, script/). On bun 1.3.x this resolution fails outright; on bun 1.4+ it forces every CI run to re-resolve the upstream forgejo URL just to drop it on the next lockfile sync. Removing it lets the install match the committed lockfile and decouples CI from upstream forgejo reachability.

Reproduction that confirms the fix: bun --version 1.4.2 (744846f84) from oven-sh/setup-bun@v2.1.3 bun-version: latest, install + full CI test command on the runner image produces 2198 pass / 0 fail in 64s.

Refs t_495c93e9.

## Resolution CI is now green on commit `cc54a70d`. Run #39 reports `success` on all jobs: - `block-main-pr`: skipped (expected) - `test`: **success** in 2m22s - `typecheck`: **success** in 2m24s - `build`: **success** in 2m30s - `draft-release`: skipped (expected; only runs on `dev`) Three commits closed the loop: 1. `48d97a8a` — **fix(env-cleaner)**: bun 1.4+ coerces `process.env.X = undefined` to the string `"undefined"` when iterated via `Object.entries` (older bun stored null and was skipped by the `=== undefined` check). The `createCleanMcpEnvironment` cleaner only handled the latter, so the `skips undefined values from process.env` test in `env-cleaner.test.ts` received the literal string `"undefined"` and failed under bun 1.4+. Fix: also skip the literal string. 2. `ab32f611` — **test(background-agent)**: spy on `readConnectedProvidersCache` and `readProviderModelsCache` in the `BackgroundManager.handleEvent - session.error` describe block to return `null`, making the retry-path tests hermetic. Same pattern as `src/tools/delegate-task/category-resolver.test.ts`. 3. `cc54a70d` — **fix(package)**: removed the orphaned self-referencing `@oh-my-opencode/compression` dep that was in `package.json` but unused (no imports anywhere in src/, bin/, script/). On bun 1.3.x this resolution fails outright; on bun 1.4+ it forces every CI run to re-resolve the upstream forgejo URL just to drop it on the next lockfile sync. Removing it lets the install match the committed lockfile and decouples CI from upstream forgejo reachability. Reproduction that confirms the fix: `bun --version 1.4.2 (744846f84)` from `oven-sh/setup-bun@v2.1.3 bun-version: latest`, install + full CI test command on the runner image produces 2198 pass / 0 fail in 64s. Refs t_495c93e9.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/oh-my-opencode-compression#2
No description provided.