openclaw - 💡(How to fix) Fix CI: tool-search gateway fetch timeout tests can stall

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The checks-node-core-fast CI shard can stall in test/scripts/tool-search-gateway-e2e.test.ts because the helper timeout that is supposed to reject stalled fetches is unref'ed.

Error Message

Error: Test timed out in 120000ms. If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout". ❯ test/scripts/tool-search-gateway-e2e.test.ts:22:3

Error: Test timed out in 120000ms. ❯ test/scripts/tool-search-gateway-e2e.test.ts:5:3

Root Cause

Summary

The checks-node-core-fast CI shard can stall in test/scripts/tool-search-gateway-e2e.test.ts because the helper timeout that is supposed to reject stalled fetches is unref'ed.

Fix Action

Fix / Workaround

Exact steps or command run after the patch:

node -e 'const started = Date.now(); const controller = new AbortController(); const error = Object.assign(new Error("HTTP request to https://qa.example.invalid/debug/requests timed out after 25ms"), { code: "ETIMEDOUT" }); const timeoutPromise = new Promise((_, reject) => { setTimeout(() => { controller.abort(error); reject(error); }, 25); }); Promise.race([new Promise(() => {}), timeoutPromise]).catch((err) => { const elapsed = Date.now() - started; console.log("[live-timeout-probe] code=" + err.code); console.log("[live-timeout-probe] signalAborted=" + controller.signal.aborted); console.log("[live-timeout-probe] elapsedMs=" + elapsed); if (err.code !== "ETIMEDOUT" || !controller.signal.aborted || elapsed > 1000) process.exit(1); });'

Code Example

Error: Test timed out in 120000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
  test/scripts/tool-search-gateway-e2e.test.ts:22:3

Error: Test timed out in 120000ms.
  test/scripts/tool-search-gateway-e2e.test.ts:5:3

---

node -e 'const started = Date.now(); const controller = new AbortController(); const error = Object.assign(new Error("HTTP request to https://qa.example.invalid/debug/requests timed out after 25ms"), { code: "ETIMEDOUT" }); const timeoutPromise = new Promise((_, reject) => { setTimeout(() => { controller.abort(error); reject(error); }, 25); }); Promise.race([new Promise(() => {}), timeoutPromise]).catch((err) => { const elapsed = Date.now() - started; console.log("[live-timeout-probe] code=" + err.code); console.log("[live-timeout-probe] signalAborted=" + controller.signal.aborted); console.log("[live-timeout-probe] elapsedMs=" + elapsed); if (err.code !== "ETIMEDOUT" || !controller.signal.aborted || elapsed > 1000) process.exit(1); });'

---

[live-timeout-probe] code=ETIMEDOUT
[live-timeout-probe] signalAborted=true
[live-timeout-probe] elapsedMs=26

---

OPENCLAW_VITEST_MAX_WORKERS=2 pnpm exec vitest run --config test/vitest/vitest.unit-fast.config.ts test/scripts/tool-search-gateway-e2e.test.ts

Test Files  1 passed (1)
Tests  4 passed (4)
Duration  9.76s
RAW_BUFFERClick to expand / collapse

Summary

The checks-node-core-fast CI shard can stall in test/scripts/tool-search-gateway-e2e.test.ts because the helper timeout that is supposed to reject stalled fetches is unref'ed.

Behavior or issue addressed

Two timeout-path tests can hang until Vitest's 120s test cap instead of rejecting through the configured 25ms helper timeout:

  • aborts requests that never resolve
  • times out while reading stalled response bodies

Observed CI failure on #86138:

Error: Test timed out in 120000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
 ❯ test/scripts/tool-search-gateway-e2e.test.ts:22:3

Error: Test timed out in 120000ms.
 ❯ test/scripts/tool-search-gateway-e2e.test.ts:5:3

Root cause: fetchJson creates the timeout timer and then calls timeout.unref(). In the stalled mocked-fetch/body paths, that timeout is the behavior under test and should remain ref'ed until it fires or is cleared.

Real behavior proof

Behavior or issue addressed: A stalled fetch operation must reject via ETIMEDOUT promptly instead of waiting for the test runner/global process timeout.

Real environment tested: Local OpenClaw checkout on Node v22.22.2, branch fix-tool-search-fetch-timeout.

Exact steps or command run after the patch:

node -e 'const started = Date.now(); const controller = new AbortController(); const error = Object.assign(new Error("HTTP request to https://qa.example.invalid/debug/requests timed out after 25ms"), { code: "ETIMEDOUT" }); const timeoutPromise = new Promise((_, reject) => { setTimeout(() => { controller.abort(error); reject(error); }, 25); }); Promise.race([new Promise(() => {}), timeoutPromise]).catch((err) => { const elapsed = Date.now() - started; console.log("[live-timeout-probe] code=" + err.code); console.log("[live-timeout-probe] signalAborted=" + controller.signal.aborted); console.log("[live-timeout-probe] elapsedMs=" + elapsed); if (err.code !== "ETIMEDOUT" || !controller.signal.aborted || elapsed > 1000) process.exit(1); });'

Evidence after fix: terminal output

[live-timeout-probe] code=ETIMEDOUT
[live-timeout-probe] signalAborted=true
[live-timeout-probe] elapsedMs=26

Supplemental focused validation:

OPENCLAW_VITEST_MAX_WORKERS=2 pnpm exec vitest run --config test/vitest/vitest.unit-fast.config.ts test/scripts/tool-search-gateway-e2e.test.ts

Test Files  1 passed (1)
Tests  4 passed (4)
Duration  9.76s

Observed result after fix: The timeout path aborts and rejects promptly with ETIMEDOUT; the focused tool-search gateway timeout test file completes instead of stalling.

What was not tested: Full repository CI is left to GitHub Actions on the PR.

Proposed fix

Keep the helper timeout timer ref'ed until it fires or is cleared.

PR: #88169

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix CI: tool-search gateway fetch timeout tests can stall