From 62c0037450e42e13a6ed5a24528cab436763f86e Mon Sep 17 00:00:00 2001 From: liuxiaocs7 Date: Fri, 28 Aug 2026 01:21:58 +0800 Subject: [PATCH] fix(storage): widen the Windows ADS query timeout for cold Add-Type compiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The managed-dependency alternate-stream guard spawns a fresh powershell.exe per query that JIT-compiles the FindFirstStreamW P/Invoke helper via `Add-Type`. On a cold GitHub-hosted Windows runner that first compile — a cold csc.exe launch plus .NET Framework warmup — has been observed at ~31s, tripping the 30s WINDOWS_STREAM_QUERY_TIMEOUT_MS and rejecting with "Timed out querying Windows alternate data streams". That is the wrong error for the test's assert.rejects, so the "rejects an NTFS alternate stream created inside a dependency artifact" subtest failed; the following two subtests reused the now-warm compiler and passed in 2-4s. This flaked the unfiltered main-push Windows recovery lane (run 33096120938) even though the triggering commit only touched desktop tests. The tree walk is bounded and non-recursive, so the query cannot hang; the timeout exists only to bound a wedged interpreter. Raise it to 120s so the one-time cold compile has generous headroom rather than being misreported as a wedge. The 45-minute job budget still bounds a true hang. Refs #3789 Generated-by: Claude Code --- packages/storage/src/managed-dependency-environment.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/storage/src/managed-dependency-environment.ts b/packages/storage/src/managed-dependency-environment.ts index 46aa197777..e35d48cce9 100644 --- a/packages/storage/src/managed-dependency-environment.ts +++ b/packages/storage/src/managed-dependency-environment.ts @@ -66,7 +66,15 @@ const MANAGED_DEPENDENCY_PRODUCER_POLICY_V1 = Object.freeze({ lifecycleScripts: 'disabled' as const, }); const activeAuthorityOwners = new Map(); -const WINDOWS_STREAM_QUERY_TIMEOUT_MS = 30_000; +// Each query spawns a fresh powershell.exe that JIT-compiles the C# helper +// below via `Add-Type`. On a cold GitHub-hosted Windows runner that first +// compile (cold csc.exe launch + .NET Framework warmup) has been observed at +// ~31s, tripping a 30s budget while the following warm queries finish in 2-4s. +// The bounded, non-recursive walk cannot hang, so the timeout only exists to +// bound a wedged interpreter; give the cold compile generous headroom rather +// than misreport it as a wedge. The 45-minute job budget still bounds a true +// hang. +const WINDOWS_STREAM_QUERY_TIMEOUT_MS = 120_000; const WINDOWS_STREAM_QUERY_MAX_OUTPUT_BYTES = 1024 * 1024; const WINDOWS_STREAM_QUERY_SCRIPT = String.raw` $ErrorActionPreference = 'Stop'