diff --git a/src/main/services/team/TeamProvisioningService.ts b/src/main/services/team/TeamProvisioningService.ts index 516f8047..d55d0e91 100644 --- a/src/main/services/team/TeamProvisioningService.ts +++ b/src/main/services/team/TeamProvisioningService.ts @@ -572,9 +572,10 @@ import type { ToolCallMeta, } from '@shared/types'; -// pidusage's Windows gwmi fallback needs a non-zero cache window to finish its -// initial two-sample pass. maxage: 0 can recurse forever on Windows. -const RUNTIME_PIDUSAGE_OPTIONS = process.platform === 'win32' ? { maxage: 1_000 } : { maxage: 0 }; +// pidusage's Windows wmic/gwmi fallback needs a non-zero cache window to finish +// its initial two-sample pass. Keep this above slow PowerShell startup time, or +// the first sample can expire before the recursive second read and loop again. +const RUNTIME_PIDUSAGE_OPTIONS = process.platform === 'win32' ? { maxage: 10_000 } : { maxage: 0 }; const logger = createLogger('Service:TeamProvisioning'); const PREFLIGHT_DEBUG_LOG_PATH = path.join(os.tmpdir(), 'claude-team-preflight-debug.log'); diff --git a/test/main/services/team/TeamProvisioningService.test.ts b/test/main/services/team/TeamProvisioningService.test.ts index 80e3d67e..ad7b7129 100644 --- a/test/main/services/team/TeamProvisioningService.test.ts +++ b/test/main/services/team/TeamProvisioningService.test.ts @@ -177,7 +177,7 @@ import { import pidusage from 'pidusage'; const EXPECTED_RUNTIME_PIDUSAGE_OPTIONS = - process.platform === 'win32' ? { maxage: 1_000 } : { maxage: 0 }; + process.platform === 'win32' ? { maxage: 10_000 } : { maxage: 0 }; function allowConsoleLogs() { vi.spyOn(console, 'error').mockImplementation(() => {});