fix(diag): bind stationary samples to route checkpoints

Free-running sleeps could label a sample as the old scene exactly when automation began the next teleport. Give every route stop an explicit post-input liveness dwell and post-checkpoint hold, then capture process and frame facts only after its named canonical barrier.

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-24 12:54:57 +02:00
parent e797e7482a
commit 2c874b0977
4 changed files with 62 additions and 31 deletions

View file

@ -19,7 +19,12 @@ if ([string]::IsNullOrWhiteSpace($Password)) { $Password = 'testpassword' }
if ($DenseTown) {
[object[]]$destinations = @(
[pscustomobject]@{ Name = 'Arwic dense'; Occurrence = 1; Exercise = $false }
[pscustomobject]@{
Name = 'Arwic dense'
Checkpoint = 'arwic-dense'
Occurrence = 1
Exercise = $false
}
)
[string[]]$expectedCheckpointNames = @('arwic-dense')
$routeFileName = 'connected-dense-town.route.txt'
@ -27,15 +32,15 @@ if ($DenseTown) {
}
else {
[object[]]$destinations = @(
[pscustomobject]@{ Name = 'Caul'; Occurrence = 1; Exercise = $true },
[pscustomobject]@{ Name = 'Sawato'; Occurrence = 2; Exercise = $false },
[pscustomobject]@{ Name = 'Rynthid'; Occurrence = 3; Exercise = $false },
[pscustomobject]@{ Name = 'Aerlinthe'; Occurrence = 4; Exercise = $false },
[pscustomobject]@{ Name = 'Sawato revisit'; Occurrence = 5; Exercise = $false },
[pscustomobject]@{ Name = 'Holtburg'; Occurrence = 6; Exercise = $true },
[pscustomobject]@{ Name = 'Caul return'; Occurrence = 7; Exercise = $true },
[pscustomobject]@{ Name = 'Sawato plateau'; Occurrence = 8; Exercise = $false },
[pscustomobject]@{ Name = 'Caul plateau'; Occurrence = 9; Exercise = $false }
[pscustomobject]@{ Name = 'Caul'; Checkpoint = 'caul-baseline'; Occurrence = 1; Exercise = $true },
[pscustomobject]@{ Name = 'Sawato'; Checkpoint = 'sawato-baseline'; Occurrence = 2; Exercise = $false },
[pscustomobject]@{ Name = 'Rynthid'; Checkpoint = 'rynthid'; Occurrence = 3; Exercise = $false },
[pscustomobject]@{ Name = 'Aerlinthe'; Checkpoint = 'aerlinthe'; Occurrence = 4; Exercise = $false },
[pscustomobject]@{ Name = 'Sawato revisit'; Checkpoint = 'sawato-return'; Occurrence = 5; Exercise = $false },
[pscustomobject]@{ Name = 'Holtburg'; Checkpoint = 'holtburg'; Occurrence = 6; Exercise = $true },
[pscustomobject]@{ Name = 'Caul return'; Checkpoint = 'caul-return'; Occurrence = 7; Exercise = $true },
[pscustomobject]@{ Name = 'Sawato plateau'; Checkpoint = 'sawato-plateau'; Occurrence = 8; Exercise = $false },
[pscustomobject]@{ Name = 'Caul plateau'; Checkpoint = 'caul-plateau'; Occurrence = 9; Exercise = $false }
)
[string[]]$expectedCheckpointNames = @(
'caul-baseline',
@ -744,13 +749,20 @@ try {
Write-Marker "turn-sample destination='$($destination.Name)' cpuP95=$($turnSample.CpuP95Ms) gpuP95=$($turnSample.GpuP95Ms)"
$null = Wait-ForLogPattern $process $stdoutLog '[input] MovementTurnRight Release' $destination.Occurrence 12
# LiveEntityLivenessController's authoritative absence deadline is 25
# seconds. Sample only after that deadline so a previous destination's
# records cannot masquerade as retained memory in the return gate.
Start-Sleep -Seconds 26
$stationaryProfileStart = (Get-FrameProfiles $stdoutLog).Count
$stationaryResult = Wait-ForNextFrameProfile $process $stdoutLog $stationaryProfileStart 12
$stationarySample = Capture-Sample $process $destination.Name 'stationary' $stationaryResult.Line
# Each route block dwells 27 seconds after its final input (past
# LiveEntityLivenessController's 25-second authoritative absence
# deadline), then emits a named checkpoint and holds for three more
# seconds. Bind the process/title sample to that barrier rather than
# racing a free-running sleep against the next teleport.
$checkpointPattern =
"[world-gate] checkpoint name=$($destination.Checkpoint) sequence=$($destination.Occurrence)"
$null = Wait-ForLogPattern $process $stdoutLog $checkpointPattern 1 60
$stationaryProfiles = Get-FrameProfiles $stdoutLog
if ($stationaryProfiles.Count -eq 0) {
throw "no frame-prof report exists at checkpoint '$($destination.Checkpoint)'"
}
$stationarySample =
Capture-Sample $process $destination.Name 'stationary' $stationaryProfiles[-1]
Write-Marker "stationary-sample destination='$($destination.Name)' wsMiB=$($stationarySample.WorkingSetMiB) privateMiB=$($stationarySample.PrivateMiB) ent=$($stationarySample.EntityCount) anim=$($stationarySample.AnimationCount) updateP95=$($stationarySample.UpdateP95Ms)"
if ($destination.Exercise) {