Skip to content

Commit fd68ad4

Browse files
karkarlCopilot
andcommitted
fix: harden Gateway startup trace outcomes
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 0317458 commit fd68ad4

11 files changed

Lines changed: 259 additions & 54 deletions

‎scripts/Invoke-GatewaySetupTrace.ps1‎

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,27 @@ function Read-SharedLines {
6161
}
6262

6363
function Get-CurrentSetupAttempt {
64-
# Returns the newest log whose last attempt started at or after $SinceTicks.
65-
param([string]$Directory, [Int64]$SinceTicks)
64+
# Once selected, read only the same attempt from the same log, even if a retry starts.
65+
param(
66+
[string]$Directory,
67+
[Int64]$SinceTicks,
68+
[string]$Path,
69+
[Int64]$AttemptStartTicks,
70+
[Int64]$EndTicks = [Int64]::MaxValue
71+
)
6672
if (-not (Test-Path -LiteralPath $Directory)) { return $null }
67-
$logs = @(Get-ChildItem -LiteralPath $Directory -Filter 'native-setup-*.jsonl' -File |
68-
Where-Object { $_.LastWriteTimeUtc.ToFileTimeUtc() -ge $SinceTicks } |
69-
Sort-Object LastWriteTimeUtc -Descending)
73+
$logs = if ($Path) {
74+
@(Get-Item -LiteralPath $Path -ErrorAction SilentlyContinue)
75+
} else {
76+
@(Get-ChildItem -LiteralPath $Directory -Filter 'native-setup-*.jsonl' -File |
77+
Where-Object { $_.LastWriteTimeUtc.ToFileTimeUtc() -ge $SinceTicks } |
78+
Sort-Object LastWriteTimeUtc -Descending)
79+
}
7080
foreach ($log in $logs) {
71-
$parsed = Get-NativeSetupMilestones -Lines (Read-SharedLines $log.FullName)
81+
$parsed = Get-NativeSetupMilestones -Lines (Read-SharedLines $log.FullName) `
82+
-AttemptStartTicks $AttemptStartTicks -EndTicks $EndTicks
7283
$started = @($parsed.Milestones | Where-Object Name -eq 'attempt-started')
73-
if ($started.Count -eq 1 -and $started[0].Ticks -ge $SinceTicks) {
84+
if ($started.Count -eq 1 -and ($AttemptStartTicks -gt 0 -or $started[0].Ticks -ge $SinceTicks)) {
7485
return [pscustomobject]@{ Path = $log.FullName; Parsed = $parsed }
7586
}
7687
}
@@ -81,6 +92,9 @@ if ($PSVersionTable.PSEdition -ne 'Core') { throw 'Run this script with PowerShe
8192
if (Test-IsElevated) {
8293
throw 'Run this script unelevated. Only the recorder is elevated, through a UAC prompt.'
8394
}
95+
if ($SetupTimeoutSeconds + 60 -ge $MaxRecordingSeconds) {
96+
throw 'MaxRecordingSeconds must exceed SetupTimeoutSeconds by at least 60 seconds.'
97+
}
8498
$PayloadAppRoot = @($PayloadAppRoot | ForEach-Object {
8599
$full = [IO.Path]::GetFullPath($_)
86100
if (-not (Test-Path -LiteralPath (Join-Path $full 'openclaw.mjs') -PathType Leaf)) {
@@ -108,7 +122,10 @@ $summaryPath = Join-Path $runDirectory 'setup-summary.json'
108122
$manualStopPath = Join-Path $controlDirectory 'setup-stop'
109123
$instanceName = "OpenClawStartup-$runId"
110124
$recorderPaths = $null
125+
$recorderResult = $null
111126
$attempt = $null
127+
$attemptStartTicks = 0L
128+
$attemptLogLines = @()
112129
$stopReason = 'not-started'
113130
$errorDetail = $null
114131
$recordingStartTicks = 0L
@@ -133,7 +150,14 @@ try {
133150
$uiStopTicks = [DateTime]::UtcNow.ToFileTimeUtc()
134151
break
135152
}
136-
$attempt = Get-CurrentSetupAttempt -Directory $SetupLogDirectory -SinceTicks $controllerStartTicks
153+
$candidate = Get-CurrentSetupAttempt -Directory $SetupLogDirectory -SinceTicks $controllerStartTicks `
154+
-Path $(if ($attempt) { $attempt.Path }) -AttemptStartTicks $attemptStartTicks
155+
if ($candidate) {
156+
$attempt = $candidate
157+
if ($attemptStartTicks -eq 0) {
158+
$attemptStartTicks = [Int64](@($attempt.Parsed.Milestones | Where-Object Name -eq 'attempt-started')[0].Ticks)
159+
}
160+
}
137161
if ($null -ne $attempt) {
138162
$outcome = $attempt.Parsed.Outcome
139163
if ($outcome -in @('failed', 'cancelled')) {
@@ -165,19 +189,28 @@ try {
165189
Write-Warning $errorDetail
166190
} finally {
167191
$recordingStopTicks = [DateTime]::UtcNow.ToFileTimeUtc()
192+
if ($attempt) {
193+
try {
194+
$attemptLogLines = @(Read-SharedLines $attempt.Path)
195+
$attempt = Get-CurrentSetupAttempt -Directory $SetupLogDirectory -SinceTicks $controllerStartTicks `
196+
-Path $attempt.Path -AttemptStartTicks $attemptStartTicks -EndTicks $recordingStopTicks
197+
} catch {
198+
$errorDetail = 'setup-log-snapshot-failed'
199+
Write-Warning 'The selected setup attempt could not be snapshotted before recorder shutdown.'
200+
}
201+
}
168202
if ($null -ne $recorderPaths) {
169-
Stop-GatewayTraceRecorder -InstanceName $instanceName -Paths $recorderPaths -StopTimeoutSeconds $RecorderStopTimeoutSeconds
203+
$recorderResult = Stop-GatewayTraceRecorder -InstanceName $instanceName -Paths $recorderPaths -StopTimeoutSeconds $RecorderStopTimeoutSeconds
170204
} elseif (Test-Path -LiteralPath $controlDirectory) {
171205
# The recorder may have started after the wait timed out; ask it to stop as well.
172206
[IO.File]::WriteAllText((Join-Path $controlDirectory 'recorder-stop'), 'stop')
173207
}
174208
}
175209

176-
$attempt = Get-CurrentSetupAttempt -Directory $SetupLogDirectory -SinceTicks $controllerStartTicks
177210
$copiedLog = $null
178211
if ($null -ne $attempt) {
179212
$copiedLog = Join-Path $runDirectory 'native-setup.jsonl'
180-
[IO.File]::WriteAllLines($copiedLog, [string[]](Read-SharedLines $attempt.Path))
213+
[IO.File]::WriteAllLines($copiedLog, [string[]]$attemptLogLines)
181214
}
182215
$parsedOutcome = if ($attempt) { $attempt.Parsed.Outcome } else { 'not-observed' }
183216
# Assign through @() so an empty result serializes as [] rather than null.
@@ -196,13 +229,20 @@ $result = [ordered]@{
196229
outcome = $outcome
197230
failed_step = if ($attempt) { $attempt.Parsed.FailedStep } else { $null }
198231
milestones = $milestones
232+
recording_status = if ($recorderResult) { $recorderResult.outcome } else { 'not-started' }
233+
recording_saved = [bool]($recorderResult -and $recorderResult.outcome -eq 'saved' -and
234+
$recorderResult.instance_recording_after -eq $false -and (Test-Path -LiteralPath $tracePath))
199235
}
200236
$result | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $setupResultPath -Encoding utf8
201237
Write-Host "Setup outcome: $($result.outcome); stop reason: $stopReason"
202238

203-
if ($null -ne $attempt -and (Test-Path -LiteralPath $tracePath)) {
239+
if ($null -ne $attempt -and $result.recording_saved) {
204240
& (Join-Path $toolDirectory 'Get-GatewaySetupTraceSummary.ps1') -TracePath $tracePath -ResultPath $setupResultPath `
205241
-PayloadAppRoot $PayloadAppRoot -OutputPath $summaryPath | Out-Null
206242
Write-Host "Sanitized summary: $summaryPath"
207243
}
244+
if (-not $result.recording_saved) {
245+
Write-Warning "Setup was observed, but the WPR recording was not saved ($($result.recording_status))."
246+
exit 1
247+
}
208248
if ($stopReason -notin @('ai-setup-reached', 'ui-retry', 'failed', 'cancelled', 'manual')) { exit 1 }

‎scripts/Invoke-GatewayStartupTrace.ps1‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ param(
3535
[string]$OutputDirectory = (Join-Path $env:LOCALAPPDATA 'OpenClawStartupTraces'),
3636
[ValidateSet('isolated-then-host', 'host-then-isolated')][string]$Order = 'isolated-then-host',
3737
[string]$MxcSdkVersion = '1.0.1',
38-
[ValidateRange(10, 3600)][int]$BenchmarkTimeoutSeconds = 240,
39-
[ValidateRange(60, 3600)][int]$MaxRecordingSeconds = 600,
38+
[ValidateRange(10, 1600)][int]$BenchmarkTimeoutSeconds = 240,
39+
[ValidateRange(60, 3600)][int]$MaxRecordingSeconds = 900,
4040
[ValidateRange(10, 600)][int]$RecorderStartTimeoutSeconds = 120,
4141
[ValidateRange(10, 900)][int]$RecorderStopTimeoutSeconds = 300,
4242
[switch]$SkipRecording
@@ -69,6 +69,9 @@ if ($PSVersionTable.PSEdition -ne 'Core') {
6969
if (Test-IsElevated) {
7070
throw 'Run this script unelevated. Only the recorder is elevated, through a UAC prompt, so the measured startup runs as the normal user.'
7171
}
72+
if ($MaxRecordingSeconds -le (2 * $BenchmarkTimeoutSeconds + 300)) {
73+
throw 'MaxRecordingSeconds must exceed two benchmark timeouts plus 300 seconds for setup and cleanup.'
74+
}
7275
$PayloadRoot = [IO.Path]::GetFullPath($PayloadRoot)
7376
foreach ($required in @('payload-metadata.json', 'app\openclaw.mjs')) {
7477
if (-not (Test-Path -LiteralPath (Join-Path $PayloadRoot $required) -PathType Leaf)) {
@@ -99,6 +102,7 @@ $recorderPaths = [pscustomobject]@{
99102
$recorderLaunched = $false
100103
$nodePath = $null
101104
$comparisonExit = $null
105+
$recorderResult = $null
102106

103107
Write-Host "Run directory: $runDirectory"
104108
try {
@@ -123,15 +127,21 @@ try {
123127
Write-Warning $comparisonExit
124128
} finally {
125129
if ($recorderLaunched) {
126-
Stop-GatewayTraceRecorder -InstanceName $instanceName -Paths $recorderPaths -StopTimeoutSeconds $RecorderStopTimeoutSeconds
130+
$recorderResult = Stop-GatewayTraceRecorder -InstanceName $instanceName -Paths $recorderPaths -StopTimeoutSeconds $RecorderStopTimeoutSeconds
127131
}
128132
if ($nodePath -and (Test-Path -LiteralPath $nodePath)) { Remove-Item -LiteralPath $nodePath -Force }
129133
$hostProfile = Join-Path $runDirectory 'host-profile'
130134
if (Test-Path -LiteralPath $hostProfile) { Remove-Item -LiteralPath $hostProfile -Recurse -Force }
131135
}
132136

133137
Write-Host "Comparison: $comparisonExit"
134-
if ((Test-Path -LiteralPath $resultPath) -and (Test-Path -LiteralPath $tracePath)) {
138+
if (-not $SkipRecording -and
139+
($null -eq $recorderResult -or $recorderResult.outcome -ne 'saved' -or -not (Test-Path -LiteralPath $tracePath))) {
140+
$comparisonExit = "failed: WPR recording was not saved ($($recorderResult.outcome))."
141+
Write-Warning $comparisonExit
142+
}
143+
if ((Test-Path -LiteralPath $resultPath) -and
144+
($SkipRecording -or ($recorderResult.outcome -eq 'saved' -and (Test-Path -LiteralPath $tracePath)))) {
135145
& (Join-Path $toolDirectory 'Get-GatewayStartupTraceSummary.ps1') -TracePath $tracePath -ResultPath $resultPath `
136146
-PayloadRoot $PayloadRoot -OutputPath $summaryPath | Out-Null
137147
Write-Host "Sanitized summary: $summaryPath"

‎scripts/gateway-startup-trace/GatewayStartupComparison.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ try {
549549
-GuardPath $guestGuard -ScriptPath $guestSelfTest -Arguments @() `
550550
-TimeoutMs $selfTestTimeoutMs -SelfTest $true
551551
if ($self.status -ne 'captured' -or $self.trace.blocked.child -ne 1 -or
552-
$self.trace.blocked.network -ne 1 -or
552+
$self.trace.blocked.network -ne 3 -or
553553
$self.trace.spans.'session-runtime-import'.elapsed_ms -ne 12.5 -or
554554
$self.trace.spans.'plugin-config'.elapsed_ms -ne 25) {
555555
$report.selftest = $self.status

‎scripts/gateway-startup-trace/GatewayStartupTrace.psm1‎

Lines changed: 67 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,29 @@ function Get-StartupPhaseWindows {
7171
return $windows
7272
}
7373

74+
function Get-StartupArmValidity {
75+
param($Arm)
76+
if ($null -eq $Arm -or $Arm.status -ne 'captured' -or $null -eq $Arm.trace) {
77+
return [pscustomobject]@{
78+
Status = if ($Arm) { [string]$Arm.status } else { 'missing' }
79+
BlockedChild = 0
80+
BlockedNetwork = 0
81+
RejectionReason = $null
82+
}
83+
}
84+
$blockedChild = if ($null -ne $Arm.trace.blocked) { [int]$Arm.trace.blocked.child } else { 0 }
85+
$blockedNetwork = if ($null -ne $Arm.trace.blocked) { [int]$Arm.trace.blocked.network } else { 0 }
86+
$reasons = @()
87+
if ($blockedChild -gt 0) { $reasons += 'blocked-child-process' }
88+
if ($blockedNetwork -gt 0) { $reasons += 'blocked-network' }
89+
[pscustomobject]@{
90+
Status = if ($reasons.Count -gt 0) { 'rejected' } else { 'captured' }
91+
BlockedChild = $blockedChild
92+
BlockedNetwork = $blockedNetwork
93+
RejectionReason = $reasons -join ','
94+
}
95+
}
96+
7497
function ConvertTo-UtcFileTime {
7598
# ConvertFrom-Json in PowerShell 7 may already have turned ISO strings into DateTime values.
7699
param($Value)
@@ -122,26 +145,42 @@ function Get-NativeSetupMilestones {
122145
AI-setup page) is observed in the UI and supplied separately; see Resolve-NativeSetupOutcome.
123146
Only fixed message prefixes are read; message bodies are not returned.
124147
#>
125-
param([string[]]$Lines)
148+
param(
149+
[string[]]$Lines,
150+
[Int64]$AttemptStartTicks = 0,
151+
[Int64]$EndTicks = [Int64]::MaxValue
152+
)
126153
$records = @(foreach ($line in $Lines) {
127154
if ([string]::IsNullOrWhiteSpace($line)) { continue }
128-
try { $entry = $line | ConvertFrom-Json -DateKind String } catch { continue }
155+
try { $entry = $line | ConvertFrom-Json } catch { continue }
129156
if ($null -eq $entry.PSObject.Properties['ts'] -or $null -eq $entry.PSObject.Properties['msg']) { continue }
157+
$ticks = [Int64](ConvertTo-UtcFileTime $entry.ts)
158+
if ($ticks -gt $EndTicks) { continue }
130159
[pscustomobject]@{
131-
Ticks = [Int64](ConvertTo-UtcFileTime $entry.ts)
160+
Ticks = $ticks
132161
Level = if ($entry.PSObject.Properties['level']) { [string]$entry.level } else { '' }
133162
Message = [string]$entry.msg
134163
Step = if ($entry.PSObject.Properties['data'] -and $entry.data -and $entry.data.PSObject.Properties['step']) { [string]$entry.data.step } else { $null }
135164
}
136165
})
137166
$startIndex = -1
138167
for ($i = 0; $i -lt $records.Count; $i++) {
139-
if ($records[$i].Message -eq 'Native Gateway setup attempt started.') { $startIndex = $i }
168+
if ($records[$i].Message -eq 'Native Gateway setup attempt started.' -and
169+
($AttemptStartTicks -eq 0 -or $records[$i].Ticks -eq $AttemptStartTicks)) {
170+
$startIndex = $i
171+
}
140172
}
141173
if ($startIndex -lt 0) {
142174
return [pscustomobject]@{ Outcome = 'not-started'; FailedStep = $null; Milestones = @() }
143175
}
144-
$attempt = @($records | Select-Object -Skip $startIndex)
176+
$nextStart = $records.Count
177+
for ($i = $startIndex + 1; $i -lt $records.Count; $i++) {
178+
if ($records[$i].Message -eq 'Native Gateway setup attempt started.') {
179+
$nextStart = $i
180+
break
181+
}
182+
}
183+
$attempt = @($records[$startIndex..($nextStart - 1)])
145184
$milestones = [Collections.Generic.List[object]]::new()
146185
$milestones.Add([pscustomobject]@{ Name = 'attempt-started'; Ticks = $attempt[0].Ticks })
147186
$seen = @{}
@@ -303,14 +342,6 @@ function Wait-ForFile {
303342
return $null
304343
}
305344

306-
function Test-InstanceRecording {
307-
# wpr requires -instancename to be the last argument.
308-
param([string]$Name)
309-
$wpr = Join-Path $env:SystemRoot 'System32\wpr.exe'
310-
$output = & $wpr -status -instancename $Name 2>&1 | Out-String
311-
return ($output -notmatch 'not recording')
312-
}
313-
314345
function Start-GatewayTraceRecorder {
315346
<#
316347
Launches the elevated recorder through UAC and waits for it to report a started instance.
@@ -339,13 +370,32 @@ function Stop-GatewayTraceRecorder {
339370
param([string]$InstanceName, $Paths, [int]$StopTimeoutSeconds)
340371
[IO.File]::WriteAllText($Paths.Stop, 'stop')
341372
$signal = Wait-ForFile -Paths @($Paths.Status) -TimeoutSeconds $StopTimeoutSeconds
342-
if ($null -ne $signal) {
373+
if ($null -eq $signal) {
374+
Write-Warning "Recorder status was not received for WPR instance $InstanceName."
375+
return [pscustomobject]@{ outcome = 'missing-status'; cancel = 'unknown'; instance_recording_after = $null }
376+
}
377+
try {
343378
$status = Get-Content -LiteralPath $Paths.Status -Raw | ConvertFrom-Json
344-
Write-Host "Recorder outcome: $($status.outcome); cancel: $($status.cancel)"
379+
} catch {
380+
Write-Warning "Recorder status could not be read for WPR instance $InstanceName."
381+
return [pscustomobject]@{ outcome = 'invalid-status'; cancel = 'unknown'; instance_recording_after = $null }
382+
}
383+
if ($status.instance -ne $InstanceName -or [string]::IsNullOrWhiteSpace([string]$status.outcome)) {
384+
Write-Warning "Recorder status did not match WPR instance $InstanceName."
385+
return [pscustomobject]@{ outcome = 'invalid-status'; cancel = 'unknown'; instance_recording_after = $null }
345386
}
346-
if ($null -eq $signal -or (Test-InstanceRecording $InstanceName)) {
387+
Write-Host "Recorder outcome: $($status.outcome); cancel: $($status.cancel)"
388+
if ($status.instance_recording_after -eq $true) {
347389
Write-Warning "WPR instance $InstanceName may still be recording. Run elevated: wpr.exe -cancel -instancename $InstanceName"
390+
return [pscustomobject]@{
391+
instance = $InstanceName
392+
outcome = 'recording-still-active'
393+
recorder_outcome = $status.outcome
394+
cancel = $status.cancel
395+
instance_recording_after = $true
396+
}
348397
}
398+
return $status
349399
}
350400

351-
Export-ModuleMember -Function Get-IntervalUnionLength, Get-ClippedIntervals, Get-PayloadPackageGroup, Get-StartupPhaseWindows, ConvertTo-UtcFileTime, Get-CompleteMpPerformanceReport, Get-NativeSetupMilestones, Get-NativeSetupWindows, Resolve-NativeSetupOutcome, Read-SetupStopSignal, Get-NativeSetupUiStateFromIds, Get-NativeSetupUiState, Test-IsElevated, New-PrivateDirectory, Wait-ForFile, Test-InstanceRecording, Start-GatewayTraceRecorder, Stop-GatewayTraceRecorder
401+
Export-ModuleMember -Function Get-IntervalUnionLength, Get-ClippedIntervals, Get-PayloadPackageGroup, Get-StartupPhaseWindows, Get-StartupArmValidity, ConvertTo-UtcFileTime, Get-CompleteMpPerformanceReport, Get-NativeSetupMilestones, Get-NativeSetupWindows, Resolve-NativeSetupOutcome, Read-SetupStopSignal, Get-NativeSetupUiStateFromIds, Get-NativeSetupUiState, Test-IsElevated, New-PrivateDirectory, Wait-ForFile, Start-GatewayTraceRecorder, Stop-GatewayTraceRecorder

‎scripts/gateway-startup-trace/Get-GatewaySetupTraceSummary.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ $roots = @($PayloadAppRoot | ForEach-Object {
3939
})
4040
# Only fixed reason codes reach the shareable summary; raw error text stays in the private result.
4141
$allowedStopReasons = @('not-started', 'timeout', 'manual', 'ai-setup-reached', 'ui-retry', 'failed', 'cancelled', 'controller-error')
42-
$result = Get-Content -LiteralPath $ResultPath -Raw | ConvertFrom-Json -DateKind String
42+
$result = Get-Content -LiteralPath $ResultPath -Raw | ConvertFrom-Json
4343
$report = Get-CompleteMpPerformanceReport -Path $TracePath -TopFiles $TopFiles -TopScansPerFile $TopScansPerFile
4444

4545
function Get-RelativePayloadPath {

‎scripts/gateway-startup-trace/Get-GatewayStartupTraceSummary.ps1‎

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,15 @@ function Get-SummedTicks {
6969

7070
function Get-ArmSummary {
7171
param([string]$Name, $Arm)
72-
if ($null -eq $Arm -or $Arm.status -ne 'captured' -or $null -eq $Arm.trace) {
73-
return [ordered]@{ arm = $Name; status = if ($Arm) { $Arm.status } else { 'missing' } }
72+
$validity = Get-StartupArmValidity $Arm
73+
if ($validity.Status -ne 'captured') {
74+
return [ordered]@{
75+
arm = $Name
76+
status = $validity.Status
77+
blocked_child = $validity.BlockedChild
78+
blocked_network = $validity.BlockedNetwork
79+
rejection_reason = $validity.RejectionReason
80+
}
7481
}
7582
$trace = $Arm.trace
7683
$scans = @($allScans | Where-Object ProcessId -eq ([int]$trace.pid))
@@ -106,6 +113,8 @@ function Get-ArmSummary {
106113
status = 'captured'
107114
elapsed_ms = $trace.elapsed_ms
108115
startup_to_first_phase_ms = $trace.startup_to_first_phase_ms
116+
blocked_child = $validity.BlockedChild
117+
blocked_network = $validity.BlockedNetwork
109118
cpu_user_ms = $trace.cpu_user_ms
110119
cpu_system_ms = $trace.cpu_system_ms
111120
payload_scans = $inRun.Count
@@ -117,7 +126,26 @@ function Get-ArmSummary {
117126
}
118127
}
119128

129+
$comparisonStatus = 'captured'
130+
$comparisonFailure = $null
131+
$armValidity = @(
132+
Get-StartupArmValidity $result.host
133+
Get-StartupArmValidity $result.isolated
134+
)
135+
if ($result.failure) {
136+
$comparisonStatus = 'rejected'
137+
$comparisonFailure = 'comparison-failed'
138+
} elseif (@($result.cleanup.PSObject.Properties | Where-Object { $_.Name -in 'stop', 'deprovision' -and $_.Value -ne 'reported-success' }).Count -gt 0) {
139+
$comparisonStatus = 'rejected'
140+
$comparisonFailure = 'cleanup-incomplete'
141+
} elseif (@($armValidity | Where-Object Status -ne 'captured').Count -gt 0) {
142+
$comparisonStatus = 'rejected'
143+
$comparisonFailure = 'arm-not-valid'
144+
}
145+
120146
$summary = [ordered]@{
147+
comparison_status = $comparisonStatus
148+
comparison_failure = $comparisonFailure
121149
payload_version = $result.payload_version
122150
payload_commit = $result.payload_commit
123151
architecture = $result.architecture

0 commit comments

Comments
 (0)