mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-16 19:36:54 +00:00
Dependency publication now recovers interrupted config/facts changes before activation and leases live generations during collection. Receipts retain update correlation and failed steps across nested command boundaries. Doctor and desktop surfaces report those failures through shared owners. Move checkout updates out of the desktop facade. Stage a detached Windows relaunch waiter before shutdown, with bounded handshake and process-birth checks. Keep packaged lifecycle tests isolated from the installed app. Native verification exposed two production races: cron maintenance imported the interactive CLI and rewrote TERMINAL_CWD, and install-ID reads collided with first publication. Use the existing owners and locks. Plugin checks now run at startup and each due-gated housekeeping tick, not after 60 ticks. Share updater-test mutation boundaries and remove collection-root fixtures. Separate cold MCP startup from command latency and give the real HTTP drip test enough time to reach body handling. Root npm check passed, including packaging. The fixed-tree Windows Python run reported 44557 passed, one failed, and 1404 skipped, plus one retry-only HTTP test. Those final failures now pass in a 35-test bounded batch. A real isolated gateway wrote startup and periodic plugin-check receipts. Full final-tree CI, bundled Sandbox deployment, and actual App Installer relaunch remain unverified. docs/pm-audit-status.md records these limits.
47 lines
1.9 KiB
PowerShell
47 lines
1.9 KiB
PowerShell
# Wait outside the package until the original app exits and Windows publishes its update.
|
|
param(
|
|
[Parameter(Mandatory = $true)][int]$ProcessId,
|
|
[Parameter(Mandatory = $true)][long]$ProcessStartTimeMs,
|
|
[Parameter(Mandatory = $true)][string]$IdentityName,
|
|
[Parameter(Mandatory = $true)][string]$ReadyFile,
|
|
[int]$TimeoutSeconds = 900,
|
|
[int]$PollMillis = 500
|
|
)
|
|
|
|
try {
|
|
$ErrorActionPreference = 'Stop'
|
|
$deadline = (Get-Date).AddSeconds($TimeoutSeconds)
|
|
$package = Get-AppxPackage -Name $IdentityName | Select-Object -First 1
|
|
if (-not $package) { exit 2 }
|
|
$appId = (Get-AppxPackageManifest $package).Package.Applications.Application.Id | Select-Object -First 1
|
|
if (-not $appId) { exit 2 }
|
|
$fromVersion = $package.Version
|
|
$familyName = $package.PackageFamilyName
|
|
Set-Content -LiteralPath $ReadyFile -Value "$fromVersion|$familyName|$appId"
|
|
|
|
while ($true) {
|
|
$parent = Get-Process -Id $ProcessId -ErrorAction SilentlyContinue
|
|
if (-not $parent) { break }
|
|
# Compare absolute birth times. Process age changes on every poll.
|
|
$birthMs = ([DateTimeOffset]$parent.StartTime).ToUnixTimeMilliseconds()
|
|
if ([Math]::Abs($birthMs - $ProcessStartTimeMs) -gt 3000) { break }
|
|
if ((Get-Date) -gt $deadline) { exit 3 }
|
|
Start-Sleep -Milliseconds $PollMillis
|
|
}
|
|
|
|
while ((Get-Date) -le $deadline) {
|
|
$current = Get-AppxPackage -Name $IdentityName | Select-Object -First 1
|
|
if ($current -and $current.Version -ne $fromVersion -and $current.PackageFamilyName -eq $familyName) {
|
|
Start-Process "shell:AppsFolder\$familyName!$appId"
|
|
exit 0
|
|
}
|
|
Start-Sleep -Milliseconds $PollMillis
|
|
}
|
|
exit 4
|
|
} finally {
|
|
Set-Location $env:TEMP
|
|
Remove-Item -LiteralPath $ReadyFile -Force -ErrorAction SilentlyContinue
|
|
if ([IO.Path]::GetFileName($PSScriptRoot).StartsWith('hermes-relaunch-')) {
|
|
Remove-Item -LiteralPath $PSScriptRoot -Recurse -Force -ErrorAction SilentlyContinue
|
|
}
|
|
}
|