Repository navigation
Fix: give build_setup integration hooks an explicit timeout to stop CI flakiness - #549
Merged
AmaadMartin merged 2 commits intoJul 31, 2026
Merged
Conversation
added 2 commits
July 28, 2026 13:55
The beforeAll hook in build_setup_test.ts runs `npm install` (plus `npm run build` for ts_* setups) with no explicit timeout, so it inherits vitest's default 10s hookTimeout. On slow CI runners (e.g. ubuntu-latest) this heavy setup routinely exceeds 10s, producing flaky "Hook timed out in 10000ms" failures in whichever of the six parameterized sub-suites crosses the line first. Add a dedicated HOOK_TIMEOUT (120000ms) constant and pass it to both the beforeAll and afterAll hooks, matching the pattern used by the other install-heavy integration tests (app_loader, agent_loader, skills/script_js). The per-it TEST_EXECUTION_TIMEOUT stays 20000ms. Test-only change; no product code is touched.
Address review feedback on the HOOK_TIMEOUT comment. The previous comment claimed the value matched the pattern used by app_loader/agent_loader/skills-script_js. That is inaccurate: each of those declares a single TEST_EXECUTION_TIMEOUT (40000/40000/60000) shared by its hooks and tests, so neither the second constant nor 120000 came from them. Replace the claim with the measurement that actually picks the number: all twelve hook runs cost ~16s combined on ubuntu-latest, while a cold, network-bound install has been measured at ~70s. Also fix an accuracy bug: the comment described only beforeAll, but HOOK_TIMEOUT governs afterAll too, whose work is the recursive node_modules teardown. It now covers both hooks, states why the per-test budget stays at 20000, and records the trade-off that a stuck hook takes this long to surface. Comment-only change; no behavior change.
3 of 7 tasks
kalenkevich
approved these changes
Jul 31, 2026
Merged
This was referenced Jul 31, 2026
Open
7 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
Problem:
The
Build setupintegration test (tests/integration/build_setup/build_setup_test.ts) intermittently fails the GitHub Actionsvalidationworkflow onubuntu-latest. ItsbeforeAllhook runsnpm install(plusnpm run buildfor thets_*setups) with no explicit timeout, so it inheritsvitest's defaulthookTimeoutof10000ms. On slow/cold CI runners this heavy setup routinely exceeds 10s, producing spuriousError: Hook timed out in 10000ms "beforeAll"failures. Because the hook is registered inside adescribe.each([...])block, the failure surfaces in whichever of the six parameterized sub-suites (js_commonjs,js_esm,ts_commonjs,ts_esm,ts_commonjs_native_addon,ts_esm_native_addon) crosses the 10s line first — i.e. it is timing flakiness, not a deterministic bug. The I/O-heavyafterAllteardown (recursivenode_modules/distremoval) is susceptible to the same flake.Solution:
Introduce a dedicated, clearly named
HOOK_TIMEOUT = 120000constant and pass it as the explicit second argument to bothbeforeAllandafterAll(vitestsignature:beforeAll(fn, timeout?)). This grants the setup/teardown hooks a generous, explicit budget sufficient to install dependencies and build the fixture projects on a slow runner. It matches the idiomatic pattern already used by the other install-heavy integration tests in this repo (app_loader,agent_loader,skills/script_js). The per-itTEST_EXECUTION_TIMEOUTstays20000msand is not overloaded for the hook. This is a test-harness-only change: no product/source code, public API, or build output is touched, so there are no breaking changes.Testing Plan
Unit Tests:
This is a CI test-infrastructure fix with no new
src/code, sovitestcoverage (scoped to*/src/**/*.ts) is unaffected and no new unit tests are applicable. Verification focused on the modified integration suite itself (see below).Manual End-to-End (E2E) Tests:
npm install && npm run build.node_modules/package-lock.jsonundertests/integration/build_setup/*to force a slow install.npx vitest run --project integration tests/integration/build_setup/build_setup_test.tsHook timed out in 10000mserror, even though thebeforeAllnpm install(+ build) takes well over 10s per setup.Result observed locally:
Test Files 1 passed (1),Tests 20 passed | 4 skipped (24); the file ran ~529s of hook-heavy setup with no hook-timeout failure. Fast gates also verified on the edited file:eslintclean,prettier --checkclean, andtsc --noEmitintroduces no new errors (pre-existing fixture module-resolution errors are unchanged and unrelated).Checklist
Additional context
The change is limited to the two hook registrations in
tests/integration/build_setup/build_setup_test.ts; no fixture projects, workspace configuration, or lockfiles are modified.