Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(maker-core): 放宽 Windows 后代清理超时以消除忙碌 runner 竞态 (#3662)

fico-hub1ee01ce2691e
diff --git a/packages/maker-core/src/agents/pi/windows-git-path-powershell.test.ts b/packages/maker-core/src/agents/pi/windows-git-path-powershell.test.ts
index 6d1c854f80..8d420729d1 100644
--- a/packages/maker-core/src/agents/pi/windows-git-path-powershell.test.ts
+++ b/packages/maker-core/src/agents/pi/windows-git-path-powershell.test.ts
@@ -227,7 +227,7 @@ describe('Windows Git PATH PowerShell probes', () => {
'-NonInteractive',
'-Command',
[
- '$deadline = [DateTime]::UtcNow.AddSeconds(3)',
+ '$deadline = [DateTime]::UtcNow.AddSeconds(8)',
`while (Get-Process -Id ${childPid} -ErrorAction SilentlyContinue) {`,
' if ([DateTime]::UtcNow -ge $deadline) { exit 1 }',
' Start-Sleep -Milliseconds 50',
@@ -235,8 +235,8 @@ describe('Windows Git PATH PowerShell probes', () => {
].join('\n'),
],
// PowerShell startup can exceed five seconds on a busy hosted Windows runner;
- // allow cleanup to observe the child process exit without changing the probe budget.
- { stdio: 'ignore', timeout: 10_000, windowsHide: true },
+ // the in-script deadline (8s) plus startup must fit the exec timeout.
+ { stdio: 'ignore', timeout: 15_000, windowsHide: true },
);
} finally {
if (coordinatorPid) {
@@ -253,7 +253,9 @@ describe('Windows Git PATH PowerShell probes', () => {
}
}
},
- 20_000,
+ // waitFor(5s) + descendant cleanup exec(10s) + liveness probe exec(15s) already
+ // sum to 30s; leave headroom for coordinator exit, taskkill, and scheduling.
+ 45_000,
);
it('reports recoverable script failures only when a logger is supplied', () => {
diff --git a/packages/maker-core/src/agents/pi/windows-git-path-powershell.ts b/packages/maker-core/src/agents/pi/windows-git-path-powershell.ts
index a07729f244..1daaa4b861 100644
--- a/packages/maker-core/src/agents/pi/windows-git-path-powershell.ts
+++ b/packages/maker-core/src/agents/pi/windows-git-path-powershell.ts
@@ -5,7 +5,11 @@ import type { Logger } from '../../interfaces/logger.js';
export type WindowsGitPathLogger = Pick<Logger, 'warn'>;
const DIAGNOSTIC_PREFIX = '__CINDY_WINDOWS_GIT_PATH_DIAGNOSTIC__';
-const WINDOWS_DESCENDANT_CLEANUP_TIMEOUT_MS = 2_000;
+// 忙碌的 Windows 宿主(如 CI hosted runner)上 PowerShell 冷启动就可能超过
+// 5 秒:2 秒预算会让清理进程在 Stop-Process 执行前就被 execFileSync 超时
+// 杀掉,后代进程泄漏(#3574 的偶发失败正是这个竞态)。清理只在探测已经
+// 失败的收尾路径运行,放宽预算不影响任何成功路径的耗时。
+const WINDOWS_DESCENDANT_CLEANUP_TIMEOUT_MS = 10_000;
type WindowsPowerShellProbe = 'registry' | 'network-drives' | 'path-kinds' | 'path-cleanup';