diff --git a/scripts/e2e/parallels/windows-smoke.ts b/scripts/e2e/parallels/windows-smoke.ts index f956189a77f..28dcffe186d 100755 --- a/scripts/e2e/parallels/windows-smoke.ts +++ b/scripts/e2e/parallels/windows-smoke.ts @@ -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' }`, diff --git a/test/scripts/parallels-smoke-model.test.ts b/test/scripts/parallels-smoke-model.test.ts index d94b7b37aa8..a34343efff9 100644 --- a/test/scripts/parallels-smoke-model.test.ts +++ b/test/scripts/parallels-smoke-model.test.ts @@ -462,6 +462,7 @@ console.log(JSON.stringify(result)); expect(script).toContain("windowsModelProviderTimeoutScript(this.auth.modelId)"); expect(script).toContain("finalAssistant(Raw|Visible)Text"); expect(script).toContain("parallels-windows-smoke-retry-$attempt"); + expect(script).toContain("agent turn attempt $attempt failed or finished without OK response"); expect(script).not.toContain("$config.models.providers"); expect(script).not.toContain("timeoutSeconds = 300"); expect(script).toContain('"$sessionId.jsonl"');