Skip to content

test runtime: agent-hook server tests run on Node (orca #48, slice 1) - #49

Merged
nachumi-a2zoperations merged 1 commit into
blowzer/fork-onlyfrom
nachumi-a2zoperations/issue-48-agent-hooks-red
Nov 15, 2026
Merged

nachumi-a2zoperations merged 1 commit into
blowzer/fork-onlyfrom
nachumi-a2zoperations/issue-48-agent-hooks-red

Conversation

@nachumi-a2zoperations

Copy link
Copy Markdown

Refs #48 (slice 1 of the fork-wide red unit step: the agent-hooks group, 31 of the 113 files). #48 stays open for the other groups.

Root cause

The agent-hook server saves last status through node:sqlite in WAL mode and reads it back read-only when it starts (KeyedJsonRowCache, src/main/sqlite/row-cache/keyed-json-row-cache.ts:137; the test fixture readSavedStatus does the same). Bun's macOS SQLite refuses a read-only open of a closed WAL database ("unable to open database file"). Node opens it.

Probe outside Orca (MacBook) Node bun 1.4.4
rollback journal, read-only OK OK
rollback journal, read-write OK OK
WAL, read-only, after the writer closed OK FAIL: unable to open database file
WAL, read-write OK OK

These tests reach SQLite only through the server. The import scan (vitest-sqlite-runtime-scan.mjs) routes a test to the Node runtime only when it imports a SQLite module or a named harness directly, so they stayed on Bun. Every server test that restarts the server or reads the saved rows then failed: either directly, or as a restored server with no saved state (a null attestation, a stale status). The fork already knows this bug for the session search index (SQLITE_HARNESSES: "Bun's macOS SQLite refuses a WAL file then"). Linux CI does not hit it.

Fix

One line in vitest-node-runtime-files.mjs: src/main/agent-hooks/server/**/*.test.ts runs on the Node runtime, beside the existing src/main/persistence/** and src/main/sqlite/** entries. Product code is unchanged, since production never runs on Bun.

Tests

  • New: vitest-node-runtime-files.test.mjs lists every test file under the agent-hook server from disk and asserts each one goes to the Node runtime. Red before the fix (93 of 96 on Bun), green after.
  • The 31 failing files under plain Node: 207/207.
  • All 96 agent-hook server test files through the normal runner with the fix: 562/562 (31 files were red on base cdfaf808).
  • Preflight check-changed on this head: 13/13.

Root cause of the agent-hooks group of the fork-wide red unit step
(31 of the 113 files in #48): the agent-hook server saves last status
through node:sqlite in WAL mode and reads it back read-only when it
starts (KeyedJsonRowCache, keyed-json-row-cache.ts:137; the test
fixture readSavedStatus does the same). Bun's macOS SQLite refuses a
read-only open of a closed WAL database: "unable to open database
file". Node opens it. A 20-line probe outside Orca shows exactly that
(bun 1.4.4: WAL + readOnly FAIL; every other combination OK; Node: all
OK).

So on a MacBook every server test that restarts the server or reads
the saved rows failed under Bun: directly ("unable to open database
file"), or as a restored server with no saved state (null attestation,
stale status). These tests reach SQLite only through the server, which
the import scan in vitest-sqlite-runtime-scan.mjs does not follow, so
they stayed on Bun. The fork already knows this bug for the session
search index (SQLITE_HARNESSES: "Bun's macOS SQLite refuses a WAL file
then"); Linux CI does not hit it.

Fix: route src/main/agent-hooks/server/**/*.test.ts to the Node
runtime, beside the existing src/main/persistence and src/main/sqlite
entries. No product code changes; production never runs on Bun.

Test: vitest-node-runtime-files.test.mjs lists every test file under
the agent-hook server from disk and asserts each one resolves to the
Node runtime. It failed first (93 of 96 on Bun) and passes now.

Evidence: the 31 failing files pass under plain Node (207/207). With
the fix, all 96 agent-hook server test files pass through the normal
runner: 562/562.

Refs #48
@nachumi-a2zoperations
nachumi-a2zoperations merged commit eed717e into blowzer/fork-only Nov 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant