test(parallels): retry Windows agent idle exits

This commit is contained in:
Peter Steinberger
2026-05-01 15:57:48 +01:00
parent 757af70bf7
commit 03bde3d65c
2 changed files with 8 additions and 3 deletions

View File

@@ -920,15 +920,19 @@ for ($attempt = 1; $attempt -le 2; $attempt++) {
'--json'
)
$output = Invoke-OpenClaw @args 2>&1
$agentExitCode = $LASTEXITCODE
if ($null -ne $output) { $output | ForEach-Object { $_ } }
if ($LASTEXITCODE -ne 0) { throw "agent failed with exit code $LASTEXITCODE" }
if (($output | Out-String) -match '"finalAssistant(Raw|Visible)Text":\\s*"OK"') {
if ($agentExitCode -eq 0 -and ($output | Out-String) -match '"finalAssistant(Raw|Visible)Text":\\s*"OK"') {
$agentOk = $true
break
}
if ($attempt -lt 2) {
Write-Host "agent turn attempt $attempt finished without OK response; retrying"
Write-Host "agent turn attempt $attempt failed or finished without OK response; retrying"
Start-Sleep -Seconds 3
continue
}
if ($agentExitCode -ne 0) {
throw "agent failed with exit code $agentExitCode"
}
}
if (-not $agentOk) { throw 'openclaw agent finished without OK response' }`,