Skip to content

Fix: add explicit per-test timeout to real-PowerShell skill-script integration test - #550

Merged
AmaadMartin merged 2 commits into
google:mainfrom
AmaadMartin:fix/powershell-skill-script-test-timeout
Jul 31, 2026
Merged

AmaadMartin merged 2 commits into
google:mainfrom
AmaadMartin:fix/powershell-skill-script-test-timeout

Conversation

@AmaadMartin

Copy link
Copy Markdown
Collaborator

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):

  • No existing issue is linked; the change is described below.

2. Or, if no issue exists, describe the change:

Problem:

The validation workflow's run-tests (windows-latest) job intermittently fails
with Error: Test timed out in 5000ms. on the integration test
'successfully executes a real PowerShell skill script' in
tests/integration/tools/run_skill_script_tool_test.ts. The test spawns a
real PowerShell child process through UnsafeLocalCodeExecutor; PowerShell
cold-start plus script execution on the shared, slow windows-latest runner
routinely exceeds vitest's built-in default testTimeout of 5000ms.
vitest.config.ts sets no testTimeout for the integration project, so the
5000ms default applies to every it(...) that does not pass its own budget.
Notably, the executor's own internal timeout defaults to 30s (see
timeoutSeconds in core/src/code_executors/unsafe_local_code_executor.ts), so
the code under test is willing to wait far longer than vitest allows — vitest
kills the test at 5s.

Solution:

This is a pure test-infrastructure (flakiness) fix; no production/runtime
behavior changes. Mirroring the established in-repo pattern in
tests/integration/build_setup/build_setup_test.ts, a file-level constant
const TEST_EXECUTION_TIMEOUT = 40000; is introduced and passed as the optional
3rd argument to every it(...) / it.skipIf(...) in the file.

Every test in this file spawns a real child process (node, python,
PowerShell, cmd, or sh), so they all share the same 5000ms-default flakiness
class; applying the constant uniformly is the root-cause fix and keeps the file
consistent.

40000 (40s) was chosen because it deliberately exceeds the executor's own 30s
internal timeout
, so that on a genuine hang the executor's cleaner
Code execution timed out after N seconds. error surfaces instead of vitest's
generic abort. It also matches the sibling constants in
tests/integration/app_loader/app_loader_test.ts and
tests/integration/agent_loader/agent_dirname_test.ts, which both use 40000.
A per-test timeout is an upper bound, not a delay, so fast-completing tests are
unaffected.

No changes were made to vitest.config.ts, build_setup_test.ts, or any
production source under core/, dev/, or integrations/. The large line count
in the diff is purely Prettier re-wrapping the previously single-line
it('name', async () => {...}) calls onto multiple lines once a 3rd argument is
added — the canonical formatting also used by build_setup_test.ts.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

This is a test-only change; the modified integration test is the end-to-end
exercise (it runs real skill scripts through UnsafeLocalCodeExecutor with no
mocks).

Targeted run of the affected file:

npx vitest run --project integration tests/integration/tools/run_skill_script_tool_test.ts

On a Linux dev host this reported 8 passed | 4 skipped (12) — the four
Windows-gated PowerShell/CMD tests are correctly skipped (not failed),
confirming the .skipIf(...)(name, fn, timeout) call shape compiles and
type-checks and that the JS/Python/Shell tests still pass.

Lint and format gates (both enforced by the validation workflow) are clean:
npm run lint and npm run format:check.

Manual End-to-End (E2E) Tests:

  • Build the workspaces (required so the integration project's globalSetup can
    resolve @google/adk): npm ci && npm run build
  • Run the affected file directly:
    npx vitest run --project integration tests/integration/tools/run_skill_script_tool_test.ts
  • The authoritative verification is a green run-tests (windows-latest) job,
    where the PowerShell/CMD tests actually execute under the new 40s budget. On
    Windows, confirm the PowerShell test passes and completes well under 40s.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

The added constant is documented inline in the test file so future readers
understand why the budget is 40s rather than an arbitrary larger number: it must
clear the executor's own 30s internal timeout for the executor's error message to
win the race on a genuine hang.

Amaad Martin added 2 commits July 28, 2026 13:55
…tion tests

The Windows-gated 'successfully executes a real PowerShell skill script'
integration test (and its siblings) flakily failed on the slow
windows-latest CI runner with 'Test timed out in 5000ms.' — vitest's
default per-test budget. Every test in this file spawns a real child
process (node, python, PowerShell, cmd, or sh) via UnsafeLocalCodeExecutor,
so all share the same 5000ms-default flakiness risk.

Introduce a file-level TEST_EXECUTION_TIMEOUT = 40000 constant (mirroring
the established build_setup_test.ts pattern) and pass it as the 3rd
argument to every it(...)/it.skipIf(...) in the file. 40s also clears the
executor's own 30s internal timeout so its cleaner error surfaces on a
genuine hang. Test-only change: no production code, config, or dependency
changes.
Review feedback: the reported flake is on windows-latest, but the previous
commit added the timeout to all twelve tests in the file. Adding a 3rd
argument to the six single-line-header it(...) calls made Prettier explode
each call, producing 172 insertions / 137 deletions where only whitespace
actually moved.

The four it.skipIf(!IS_WINDOWS) tests are already multi-line, so scoping to
them is a pure one-line addition each: the net diff against main is now 10
insertions and 0 deletions, with no reformatting and a much smaller conflict
surface against other work in flight on this file.

Also anchor the timeout invariant to its source so the 30s figure is
grep-able rather than prose-only: the comment now names
core/src/code_executors/unsafe_local_code_executor.ts.
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.

2 participants