Skip to content

fix: prevent PID-reuse flake in capture survival checks - #16

Merged
undergroundrap merged 2 commits into
mainfrom
fix/capture-pid-identity
Sep 23, 2026
Merged

undergroundrap merged 2 commits into
mainfrom
fix/capture-pid-identity

Conversation

@undergroundrap

Copy link
Copy Markdown
Owner

Summary

Fixes the PID-reuse flake observed in run 35801511864 (Windows job 106992677604).

The capture survival checks used Get-Process -Id $PID which returns a process
if ANY process has that PID — including a different process that reused the PID
after the original exited. This caused false "survived" failures.

Fix

  • Record child start time at spawn (synthetic timeout child now outputs
    parent_start and descendant_start alongside PID witnesses)
  • Test-ProcessSurvived helper: a process survives only if PID exists AND
    start time matches the recorded value
  • Timeout witness check parses start times and uses the helper
  • Test-ProcessSurvivedPidReuseRegression: verifies same PID with different
    start time is NOT reported as survived

Testing

  • PowerShell syntax validation: OK
  • Regression test isolated run: ok - Test-ProcessSurvived PID-reuse regression
  • Full test suite run pending CI

The observed failure was 'test-created process survived: 1364' at the
$CreatedPids loop, not the timeout-witness path. Each capture already
records completed_utc.txt; a process with a recorded PID whose StartTime
is later than the capture's completion can't be the original child.

- Test-ProcessSurvivedCaptureChild: survives only if PID exists AND
  StartTime <= capture completed_utc
- $CreatedPids loop now tracks PID -> CaptureDirectory and uses the
  completion-aware check
- Diagnostic-child check uses the same completion-aware logic
- Add Test-ProcessSurvivedCaptureChildRegression covering: start before
  completion (survives), start after completion (PID reuse, not survived),
  non-existent PID, missing completion record
@undergroundrap
undergroundrap marked this pull request as ready for review September 23, 2026 07:04
@undergroundrap
undergroundrap merged commit 55abb03 into main Sep 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant