Skip to content

test: full local npm test fails timer-sensitive messenger-bridge, mcp staleModel and gui router tests on macOS (CI green) #296

Closed

Description

@lidge-jun

Problem

npm test on a macOS developer machine (Node v22.22.0, darwin 27.0.0) fails the same tests on a clean origin/dev (fff148f) checkout as on feature branches, while hosted CI passes:

  • plugins/codexclaw/components/messenger-bridge/test/media-handler.test.ts: "download timeout aborts a stalled operation", "download timeout returns even when an operation ignores AbortSignal", "writeAll retries partial file writes until every byte is persisted", "media download gate rejects overload without building an unbounded wait queue"
  • plugins/codexclaw/components/messenger-bridge/test/rate-limit.test.ts: three rateLimitSleep tests
  • plugins/codexclaw/components/subagent-config/test/mcp.test.ts: "timeout yields staleModel null with staleReason"
  • plugins/codexclaw/gui/test/router.test.ts (file-level failure)

The messenger-bridge ones report failureType: 'cancelledByParent' / "Promise resolution is still pending but the event loop has already resolved". They pass when run alone (node plugins/codexclaw/scripts/test.mjs <those two files> → 17/17), so they look like timer/event-loop interactions under the full single-process run (--test-concurrency=1).

Evidence

Impact

Local "full suite green" is never observable, so every PR body has to explain the same baseline failures.

Found while working on #295 (external state root, thread mcp:d1b4ca86-768b-491a-81d8-bd51b0a09c96).

Activity

  1. lidge-jun commented on Oct 27, 2026

    @lidge-jun
    OwnerAuthor

    Fixed in #325 (merged into dev). The cause is the Node version: tests do not interfere with each other in a single process. On Node 22.22.0, the media-handler, rate-limit and mcp staleModel tests await promises kept alive only by unref()'d timers (stream-download.ts, rate-limit.ts, mcp.ts). Node 22's runner sees an empty event loop and cancels the test and the rest of its file, which explains the collateral writeAll/gate cancellations. Node 24/26 keep waiting, which is why hosted CI was green. Those six tests now hold one referenced interval for their own lifetime and carry a 10 s timeout. Production unref() is unchanged. On Node 22.22.0 the three files went from 34 tests / 8 cancelled to 34 passed, and the full suite ran 3879 tests with 0 fail, 0 cancelled. The gui router file-level failure did not reproduce on current dev. The other local-only failure found on macOS is the worktree-guard path budget (see #297), also fixed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions