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(pi): distinguish Windows path probe failure stages

zqchrise988f7b2bc38
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 ef52a54c13..0ccab21e2b 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
@@ -68,7 +68,7 @@ describe('Windows Git PATH PowerShell probes', () => {
expect(script).toContain('Write-ProbeOutput $operation.Process');
expect(script).toContain('$budgetMs = 2750');
expect(script).toContain('if ($nextGroupIndex -lt $groups.Count -or $operations.Count -gt 0) {');
- expect(script).toContain('WriteLine("__CINDY_WINDOWS_GIT_PATH_DIAGNOSTIC__`tpath-process")');
+ expect(script).toContain('WriteLine("__CINDY_WINDOWS_GIT_PATH_DIAGNOSTIC__`tpath-process-timeout")');
expect(script).not.toContain('foreach ($candidate in $paths)');
expect(script).not.toContain('[RunspaceFactory]');
expect(script.indexOf('$clock = [Diagnostics.Stopwatch]::StartNew()'))
@@ -264,18 +264,19 @@ describe('Windows Git PATH PowerShell probes', () => {
const warn = vi.fn();
const output = [
'__CINDY_WINDOWS_GIT_PATH_DIAGNOSTIC__\tpath-kind',
- '__CINDY_WINDOWS_GIT_PATH_DIAGNOSTIC__\tpath-runspace',
+ '__CINDY_WINDOWS_GIT_PATH_DIAGNOSTIC__\tpath-process',
+ '__CINDY_WINDOWS_GIT_PATH_DIAGNOSTIC__\tpath-process-timeout',
'F\tignored-record',
].join('\r\n');
- expect(countWindowsPowerShellDiagnostics(output)).toBe(2);
+ expect(countWindowsPowerShellDiagnostics(output)).toBe(3);
warnWindowsGitPathProbeDiagnostics({ warn }, 'path-kinds', output);
warnWindowsGitPathProbeDiagnostics(undefined, 'path-kinds', output);
expect(warn).toHaveBeenCalledOnce();
expect(warn).toHaveBeenCalledWith(
'windows git path probe completed with recoverable PowerShell errors',
- { probe: 'path-kinds', failures: 2 },
+ { probe: 'path-kinds', failures: 3 },
);
});
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 1daaa4b861..c5f991227c 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
@@ -165,7 +165,7 @@ export function buildWindowsPathKindProbeScript(
' }',
' }',
' } catch {',
- ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process")`,
+ ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process-output")`,
' }',
'}',
'try {',
@@ -187,7 +187,7 @@ export function buildWindowsPathKindProbeScript(
' [void]$process.Start()',
' [void]$operations.Add([PSCustomObject]@{ Process = $process; StartedAt = $clock.ElapsedMilliseconds })',
' } catch {',
- ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process")`,
+ ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process-start")`,
' if ($null -ne $process) {',
' $process.Dispose()',
' }',
@@ -204,22 +204,22 @@ export function buildWindowsPathKindProbeScript(
' try {',
' Write-ProbeOutput $operation.Process',
' if ($operation.Process.ExitCode -ne 0) {',
- ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process")`,
+ ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process-exit")`,
' }',
' } catch {',
- ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process")`,
+ ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process-collect")`,
' } finally {',
' $operation.Process.Dispose()',
' [void]$operations.Remove($operation)',
' }',
' }',
' foreach ($operation in $expired) {',
- ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process")`,
+ ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process-timeout")`,
' try {',
' $operation.Process.Kill()',
' $operation.Process.WaitForExit()',
' } catch {',
- ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process")`,
+ ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process-terminate")`,
' } finally {',
' if ($operation.Process.HasExited) {',
' Write-ProbeOutput $operation.Process',
@@ -230,10 +230,10 @@ export function buildWindowsPathKindProbeScript(
' }',
' }',
' if ($nextGroupIndex -lt $groups.Count -or $operations.Count -gt 0) {',
- ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process")`,
+ ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process-budget")`,
' }',
'} catch {',
- ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process")`,
+ ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process-coordinator")`,
'} finally {',
' foreach ($operation in @($operations)) {',
' try {',
@@ -242,7 +242,7 @@ export function buildWindowsPathKindProbeScript(
' $operation.Process.WaitForExit()',
' }',
' } catch {',
- ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process")`,
+ ` [Console]::Out.WriteLine("${DIAGNOSTIC_PREFIX}\`tpath-process-cleanup")`,
' } finally {',
' if ($operation.Process.HasExited) {',
' Write-ProbeOutput $operation.Process',