debug: clean up Windows repro scenarios

This commit is contained in:
Sebastian Herrlinger
2026-06-30 17:43:14 +02:00
parent 086697d46c
commit f00fa4d760
3 changed files with 24 additions and 7 deletions
+20 -2
View File
@@ -112,7 +112,8 @@ function Invoke-PtyScenario {
node (Join-Path $PSScriptRoot "repro-windows-opentui-pty-session.mjs") -- --exe $Exe --project $Project --version $Version --seconds $Seconds --scenario $Scenario
if ($LASTEXITCODE -ne 0) {
throw "PTY scenario '$Scenario' failed with exit code $LASTEXITCODE"
$script:PtyFailures += "PTY scenario '$Scenario' failed with exit code $LASTEXITCODE"
Write-Host "::error::$($script:PtyFailures[-1])"
}
}
@@ -125,6 +126,9 @@ Write-Host "PROCESSOR_ARCHITECTURE=$env:PROCESSOR_ARCHITECTURE"
Write-Section "Install opencode-ai@$Version"
npm uninstall -g opencode-ai opencode-windows-x64 2>$null | Out-Host
npm install -g "opencode-ai@$Version"
if ($LASTEXITCODE -ne 0) {
throw "npm install opencode-ai@$Version failed with exit code $LASTEXITCODE"
}
$npmRoot = (npm root -g).Trim()
$exe = Join-Path $npmRoot "opencode-ai\bin\opencode.exe"
@@ -190,16 +194,30 @@ New-Item -ItemType Directory -Force $ptyRoot | Out-Null
Push-Location $ptyRoot
try {
npm init -y | Out-Host
if ($LASTEXITCODE -ne 0) {
throw "npm init for PTY harness failed with exit code $LASTEXITCODE"
}
npm install "@lydell/node-pty@1.2.0-beta.12" | Out-Host
if ($LASTEXITCODE -ne 0) {
throw "npm install @lydell/node-pty failed with exit code $LASTEXITCODE"
}
$script:PtyFailures = @()
Invoke-PtyScenario -Scenario "text" -Exe $exe -Project $sessionProject -Version $Version -Seconds $PtySeconds
if ($Version -eq "1.17.10") {
Invoke-PtyScenario -Scenario "markdown-no-native-render" -Exe $exe -Project $sessionProject -Version $Version -Seconds $PtySeconds
}
Invoke-PtyScenario -Scenario "markdown" -Exe $exe -Project $sessionProject -Version $Version -Seconds $PtySeconds
Invoke-PtyScenario -Scenario "bash-auto" -Exe $exe -Project $sessionProject -Version $Version -Seconds $PtySeconds
Invoke-PtyScenario -Scenario "bash-permission" -Exe $exe -Project $sessionProject -Version $Version -Seconds $PtySeconds
Invoke-PtyScenario -Scenario "task-permission" -Exe $exe -Project $sessionProject -Version $Version -Seconds $PtySeconds
Invoke-PtyScenario -Scenario "mcp-npx" -Exe $exe -Project $sessionProject -Version $Version -Seconds $PtySeconds
if ($Version -eq "1.17.10") {
Invoke-PtyScenario -Scenario "mcp-npx-no-native-render" -Exe $exe -Project $sessionProject -Version $Version -Seconds $PtySeconds
}
if ($script:PtyFailures.Count -gt 0) {
Write-Section "PTY Failures"
$script:PtyFailures | ForEach-Object { Write-Host $_ }
throw "$($script:PtyFailures.Count) PTY scenario(s) failed"
}
} finally {
Pop-Location
}
+4 -3
View File
@@ -126,7 +126,7 @@ function responseText() {
return "The MCP npx spawn storm initialized and the session completed."
}
if (scenario === "markdown") {
if (scenario.startsWith("markdown")) {
const sections = []
for (let i = 0; i < 40; i++) {
sections.push(`## Section ${i + 1}`)
@@ -380,7 +380,6 @@ const proc = pty.spawn(
: scenario.startsWith("task-")
? "delegate a small task to a subagent, then summarize"
: "start a CI repro session and answer briefly",
...(scenario === "bash-auto" ? ["--auto"] : []),
],
{
name: "xterm-256color",
@@ -411,10 +410,12 @@ proc.onExit((event) => {
})
const deadline = Date.now() + seconds * 1000
let completedAt
while (Date.now() < deadline) {
if (crashPattern.test(output)) break
if (exited) break
if (providerRequests > 0 && output.includes("fake provider")) break
if (!completedAt && output.includes("message=\"exiting loop\"")) completedAt = Date.now()
if (completedAt && Date.now() - completedAt > 8000) break
await delay(500)
}