diff --git a/skills/scripts/smoke.ps1 b/skills/scripts/smoke.ps1 index de25355..60b67ad 100644 --- a/skills/scripts/smoke.ps1 +++ b/skills/scripts/smoke.ps1 @@ -28,7 +28,23 @@ function Bad([string] $m) { [void]$fail.Add($m) } -Write-Host ("=== reverse-skill smoke | LogDir={0} ===" -f $LogDir) +# Prefer the same host that launched smoke (pwsh on GHA windows-latest). +# Bare "powershell" often resolves to Windows PowerShell 5.1, which mis-parses +# UTF-8 scripts without BOM when nested from pwsh. +$SmokeHostExe = $null +try { + $procPath = (Get-Process -Id $PID -ErrorAction Stop).Path + if ($procPath -and (Test-Path -LiteralPath $procPath)) { $SmokeHostExe = $procPath } +} catch { } +if (-not $SmokeHostExe) { + $cmd = Get-Command pwsh -ErrorAction SilentlyContinue + if ($cmd -and $cmd.Source) { + $SmokeHostExe = $cmd.Source + } else { + $SmokeHostExe = Join-Path $env:SystemRoot 'System32\WindowsPowerShell\v1.0\powershell.exe' + } +} +Write-Host ("=== reverse-skill smoke | LogDir={0} | Host={1} ===" -f $LogDir, $SmokeHostExe) # --- 1) routing coherence --- $verify = Join-Path $scriptDir 'verify-routing-coherence.ps1' @@ -37,7 +53,7 @@ if (-not (Test-Path -LiteralPath $verify)) { $verifyExit = 1 } else { $vLog = Join-Path $LogDir '01-verify.txt' - & powershell -NoProfile -ExecutionPolicy Bypass -File $verify 2>&1 | Tee-Object -FilePath $vLog | Out-Null + & $SmokeHostExe -NoProfile -ExecutionPolicy Bypass -File $verify 2>&1 | Tee-Object -FilePath $vLog | Out-Null $verifyExit = $LASTEXITCODE if ($verifyExit -eq 0) { Ok 'verify-routing-coherence exit 0' } else { Bad ("verify-routing-coherence exit {0}" -f $verifyExit) } } @@ -106,7 +122,7 @@ if (-not (Test-Path -LiteralPath $mr)) { } else { foreach ($c in $cases) { $outFile = Join-Path $LogDir ("route-{0}.txt" -f $c.Name) - $raw = & powershell -NoProfile -ExecutionPolicy Bypass -File $mr -Hint $c.Hint 2>&1 | Out-String + $raw = & $SmokeHostExe -NoProfile -ExecutionPolicy Bypass -File $mr -Hint $c.Hint 2>&1 | Out-String $raw | Set-Content -Path $outFile -Encoding UTF8 if ($raw -match [regex]::Escape($c.Expect)) { Ok ("route {0} -> {1}" -f $c.Name, $c.Expect) @@ -128,7 +144,7 @@ if (-not (Test-Path -LiteralPath $appendEvidence)) { Bad 'append-evidence.ps1 missing for immutability check' } else { New-Item -ItemType Directory -Path $evidenceCase -Force | Out-Null - & powershell -NoProfile -ExecutionPolicy Bypass -File $appendEvidence ` + & $SmokeHostExe -NoProfile -ExecutionPolicy Bypass -File $appendEvidence ` -CaseRoot $evidenceCase ` -Id 'E-IMMUTABLE' ` -Title 'first write' ` @@ -142,7 +158,7 @@ if (-not (Test-Path -LiteralPath $appendEvidence)) { $beforeEvidence = (Get-FileHash -LiteralPath $evidencePath -Algorithm SHA256).Hash $beforeIndex = (Get-FileHash -LiteralPath $indexPath -Algorithm SHA256).Hash - & powershell -NoProfile -ExecutionPolicy Bypass -File $appendEvidence ` + & $SmokeHostExe -NoProfile -ExecutionPolicy Bypass -File $appendEvidence ` -CaseRoot $evidenceCase ` -Id 'E-IMMUTABLE' ` -Title 'second write' ` diff --git a/skills/scripts/verify-routing-coherence.ps1 b/skills/scripts/verify-routing-coherence.ps1 index 683f0be..5e11042 100644 --- a/skills/scripts/verify-routing-coherence.ps1 +++ b/skills/scripts/verify-routing-coherence.ps1 @@ -1,4 +1,4 @@ -#Requires -Version 5.1 +#Requires -Version 5.1 # reverse-skill routing + ops contract gates (skill-router only; no host platform runtime) param([string] $ScratchDir = '') $ErrorActionPreference = 'Stop'