Skip to content

fix(tests): release agent-os SQLite handle before rmSync in server-live - #1

Open
paopaonyapi-creator wants to merge 1 commit into
devfrom
fix/server-live-ebusy
Open

paopaonyapi-creator wants to merge 1 commit into
devfrom
fix/server-live-ebusy

Conversation

@paopaonyapi-creator

Copy link
Copy Markdown
Owner

Summary

  • Fix a Windows-only test failure in tests/server-live.test.ts: rmSync(TEST_DIR, { recursive: true }) in the beforeEach/afterEach hooks fails with EBUSY when the process-global agent-os SQLite WAL handle is still open against the test's OPENCODEX_HOME tree.
  • startServer wires the generation orchestrator, whose storage lazily opens that handle. On Windows an open file handle keeps the directory busy (Linux silently unlinks the open file, which is why CI never saw this), so every file in the suite reported EBUSY and 0/35 tests could run.
  • Call closeAgentOsDbForTests() before touching the test tree in both beforeEach and afterEach, releasing any handle left behind by a previous file in the shared test process.

Verification

  • bun run typecheck (bun x tsc --noEmit, strict) — passes with no errors on this branch.
  • bun test tests/server-live.test.ts --timeout 20000 — 35 pass / 0 fail / 0 EBUSY (274 expect() calls).
  • Baseline before the fix: 0/35 pass, every file hit EBUSY: resource busy or locked on rmSync (Windows).
  • Full suite run (scripts/test.ts): tests/server-live.test.ts reports 0 failures; the remaining failure clusters (management-provider-validation, server-images) were reproduced in isolation as pre-existing Windows EBUSY on their own rmSync(TEST_DIR) calls in files this change does not touch.
  • No production code changed: 1 file, +10 lines, test-only.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. (test-only change; no user-facing behavior)
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. (no auth/secret paths touched)

On Windows the process-global WAL handle kept tests/.tmp-server-live-test

locked, so beforeEach/afterEach rmSync failed with EBUSY and cascaded into

35/35 failures in that file. Close the handle via closeAgentOsDbForTests()

before touching the tree; Linux/CI behavior is unchanged.
@github-actions github-actions Bot added the bug Something isn't working label Sep 22, 2026
@github-actions

Copy link
Copy Markdown

✅ Deterministic PR hygiene checks passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant