fix(scripts): preserve update retry fallback

This commit is contained in:
fangliquanflq
2026-08-16 16:48:17 +08:00
committed by Teknium
parent f10a231efa
commit fd596e2492
+12 -2
View File
@@ -1498,8 +1498,18 @@ try {
$res = Invoke-HermesStep $pythonExe $updateArgs "update"
Write-HandoffLog "hermes update exit code: $($res.Code)"
. (Join-Path $PSScriptRoot "retry-policy.ps1")
if (Test-HermesUpdateShouldRetry -ExitCode $res.Code -InstallRoot $InstallRoot) {
$retryPolicyPath = Join-Path $PSScriptRoot "retry-policy.ps1"
if (Test-Path -LiteralPath $retryPolicyPath) {
. $retryPolicyPath
$shouldRetry = Test-HermesUpdateShouldRetry -ExitCode $res.Code -InstallRoot $InstallRoot
} else {
# The child may have swapped to a checkout without the companion policy
# while this older script is still running in memory. Preserve the
# previous fail-closed behavior instead of calling an undefined function.
Write-HandoffLog "retry policy is unavailable after checkout swap; using legacy retry rules"
$shouldRetry = $res.Code -ne 0 -and $res.Code -ne 2
}
if ($shouldRetry) {
# One retry for update-boundary failures. Most exit-2 safety refusals
# remain terminal, but self-lock deferral also uses exit 2 and writes
# .update-incomplete after the code swap. That marker is only a retry