The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(update-test): drive VSS through CIM so the Windows kit works under pwsh
ethernet10e62265f668
diff --git a/scripts/update-test/hermes-update-rehearsal.ps1 b/scripts/update-test/hermes-update-rehearsal.ps1index 270b012c538..029c9072db8 100755--- a/scripts/update-test/hermes-update-rehearsal.ps1+++ b/scripts/update-test/hermes-update-rehearsal.ps1@@ -177,9 +177,9 @@ function Get-ShadowStorageMax {# Exact bytes (UInt64::MaxValue = UNBOUNDED) of the diff-area cap for snapshots# of $Volume, or $null when the volume has no shadow-storage association yet.param([string]$Volume)- $vol = Get-WmiObject Win32_Volume | Where-Object { $_.Name -eq $Volume }+ $vol = Get-CimInstance Win32_Volume | Where-Object { $_.Name -eq $Volume }if (-not $vol) { return $null }- $st = Get-WmiObject Win32_ShadowStorage | Where-Object { ($_.Volume -replace '\\\\', '\') -like "*$($vol.DeviceID)*" } | Select-Object -First 1+ $st = Get-CimInstance Win32_ShadowStorage | Where-Object { $_.Volume.DeviceID -eq $vol.DeviceID } | Select-Object -First 1if (-not $st) { return $null }return [UInt64]$st.MaxSpace}@@ -213,11 +213,14 @@ function Restore-ShadowStorage {}}+# CIM, never Get-WmiObject: pwsh has no WMI v1 cmdlets and proxies them through a+# Windows PowerShell compat session, whose objects come back deserialized with+# their methods (Create, Delete) stripped.function New-Shadow {param([string]$Volume)- $r = (Get-WmiObject -List Win32_ShadowCopy).Create($Volume, 'ClientAccessible')+ $r = Invoke-CimMethod -ClassName Win32_ShadowCopy -MethodName Create -Arguments @{ Volume = $Volume; Context = 'ClientAccessible' }if ($r.ReturnValue -ne 0) { Fail "could not snapshot $Volume (Win32_ShadowCopy.Create returned $($r.ReturnValue))" }- $sc = Get-WmiObject Win32_ShadowCopy | Where-Object { $_.ID -eq $r.ShadowID }+ $sc = Get-CimInstance Win32_ShadowCopy | Where-Object { $_.ID -eq $r.ShadowID }return [pscustomobject]@{ Volume = $Volume; Id = $sc.ID; Device = $sc.DeviceObject }}@@ -230,12 +233,12 @@ function Read-Shadows {function Test-ShadowAlive {param($Shadow)- return [bool](Get-WmiObject Win32_ShadowCopy | Where-Object { $_.ID -eq $Shadow.Id })+ return [bool](Get-CimInstance Win32_ShadowCopy | Where-Object { $_.ID -eq $Shadow.Id })}function Remove-Shadow {param($Shadow)- Get-WmiObject Win32_ShadowCopy | Where-Object { $_.ID -eq $Shadow.Id } | ForEach-Object { $_.Delete() }+ Get-CimInstance Win32_ShadowCopy | Where-Object { $_.ID -eq $Shadow.Id } | Remove-CimInstance}function Get-MountPath {diff --git a/scripts/update-test/smoke-test.ps1 b/scripts/update-test/smoke-test.ps1index 73c50e1e88c..97d6e59bfe7 100755--- a/scripts/update-test/smoke-test.ps1+++ b/scripts/update-test/smoke-test.ps1@@ -16,9 +16,9 @@ if (-not $Checkout) {}if (-not (Test-Path -LiteralPath $Script)) { throw "missing $Script" }-$PSExe = (Get-Command powershell.exe -ErrorAction SilentlyContinue).Source-if (-not $PSExe) { $PSExe = (Get-Command pwsh.exe -ErrorAction SilentlyContinue).Source }-if (-not $PSExe) { throw 'no powershell host found' }+# The kit runs under whichever host runs this smoke: `pwsh -File` tests pwsh,+# `powershell -File` tests Windows PowerShell.+$PSExe = (Get-Process -Id $PID).PathWrite-Host "host: $PSExe"$errors = $null@@ -217,8 +217,8 @@ echo hermes}function Get-ShadowCapC {- $vol = Get-WmiObject Win32_Volume | Where-Object { $_.Name -eq 'C:\' }- $st = Get-WmiObject Win32_ShadowStorage | Where-Object { ($_.Volume -replace '\\\\', '\') -like "*$($vol.DeviceID)*" } | Select-Object -First 1+ $vol = Get-CimInstance Win32_Volume | Where-Object { $_.Name -eq 'C:\' }+ $st = Get-CimInstance Win32_ShadowStorage | Where-Object { $_.Volume.DeviceID -eq $vol.DeviceID } | Select-Object -First 1if ($st) { return [UInt64]$st.MaxSpace } else { return $null }}@@ -242,7 +242,7 @@ try {}$ShadowIds = @(Get-Content -LiteralPath (Join-Path $Snap 'shadows.txt') | Where-Object { $_.Trim() } | ForEach-Object { ($_ -split "`t")[1] })Check 'one snapshot recorded' ($ShadowIds.Count -eq 1)- Check 'the recorded snapshot exists' ([bool](Get-WmiObject Win32_ShadowCopy | Where-Object { $ShadowIds -contains $_.ID }))+ Check 'the recorded snapshot exists' ([bool](Get-CimInstance Win32_ShadowCopy | Where-Object { $ShadowIds -contains $_.ID }))Check 'shadow storage cap on C: is at least 128 GB while the snapshot lives' ((Get-ShadowCapC) -ge [UInt64]128GB)Write-Host "`n--- pre points the install at the rehearsal copy ---"@@ -295,7 +295,7 @@ try {Check 'upstream-prompt marker removed' (-not (Test-Path -LiteralPath (Join-Path $H '.skip_upstream_prompt')))Check 'origin resolves officially again' (((& git -C $Install remote get-url origin | Out-String).Trim()) -match 'NousResearch')Check 'bin shim restored' (Test-Path -LiteralPath (Join-Path $H 'bin\hermes.cmd'))- Check 'post deleted the snapshot' (-not (Get-WmiObject Win32_ShadowCopy | Where-Object { $ShadowIds -contains $_.ID }))+ Check 'post deleted the snapshot' (-not (Get-CimInstance Win32_ShadowCopy | Where-Object { $ShadowIds -contains $_.ID }))Check 'post removed its mount link' (-not (Test-Path -LiteralPath (Join-Path $Snap 'vss-C')))Check 'post put the shadow storage cap back exactly' ((Get-ShadowCapC) -eq $CapBefore)Write-Host "`n--- the acceptance criterion: every file identical before/after ---"