Skip to content

fix(shell): raise PowerShell host probe timeout to 15s - #1949

Merged
Aaronontheweb merged 3 commits into
devfrom
fix/pwsh-probe-timeout
Aug 14, 2026
Merged

fix(shell): raise PowerShell host probe timeout to 15s#1949
Aaronontheweb merged 3 commits into
devfrom
fix/pwsh-probe-timeout

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Fixes recurring Windows CI cascade where the PowerShell host probe times out under runner load.

Problem

On loaded GitHub-hosted Windows runners, pwsh.exe/`powershell.exe` spawns can exceed the 5s ProbeTimeout. Because TestShellEnvironment.Current is a static, the CLR caches the resulting TypeInitializationException — one slow spawn converts into hundreds of test failures (observed: 252 tests failed in run 31787198785).

Prior attempt

PR #1859 added retry-once + powershell.exe fallback + CI pre-warm. It held until sustained runner load exceeded 5s repeatedly; retry only doubled the wait and the static ctor still cached the failure.

Fix

Raise ProbeTimeout from 5s to 15s in PowerShellHostProbe.cs. The probe runs once per process (test) or once at daemon startup — never per tool call — so happy-path latency is unaffected; only the bounded failure path gets slower and still fails loud with both hosts' details.

Verification

  • Netclaw.Daemon.Tests probe tests reference the constant and adapt automatically.
  • Re-run Test-windows-latest (filter FullyQualifiedName~PowerShellHostProbeTests), then the full Windows leg.

Closes the mass-failure class from overnight dev merges (shell policy clusters 1-3 already fixed by #1947; this targets the probe cascade).

- Attempt 1 keeps the 15s budget; the retry escalates to 45s so a
  slow-but-finite cold start (Defender scan, loaded CI runner) can resolve
  instead of timing out twice.
- Failed probes now carry ElapsedMs, surfaced in the resolver's exception
  message, so a future loaded-runner failure reports real timing data instead
  of a bare 'probe failed (Timeout)'.
- TestShellEnvironment caches success only: a failed resolution is retried on
  the next consumer touch instead of being cached by the CLR as a
  TypeInitializationException for the process lifetime.
@Aaronontheweb Aaronontheweb added bug Something isn't working tests All issues related to testing, quality assurance, and smoke testing. platform:windows Windows-specific issues and support shell Issues related to the shell tool, since it has the largest security perimeter. reliability Retries, resilience, graceful degradation labels Aug 14, 2026
@Aaronontheweb
Aaronontheweb merged commit f7c9c5a into dev Aug 14, 2026
23 checks passed
@Aaronontheweb
Aaronontheweb deleted the fix/pwsh-probe-timeout branch August 14, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working platform:windows Windows-specific issues and support reliability Retries, resilience, graceful degradation shell Issues related to the shell tool, since it has the largest security perimeter. tests All issues related to testing, quality assurance, and smoke testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant