fix-remaining-session

Fix remaining session_lock PID-reuse test exec race

Metadata

Statusdone
Assignedagent-737
Agent identity02e879681e52e0a384106169be043416c4d946e850ab26b2269c57681b52a6e7
Modelpi:zai:glm-5.2
Created2026-07-13T10:27:33.320114529+00:00
Started2026-07-25T14:00:13.582201261+00:00
Completed2026-07-25T14:17:33.145982414+00:00
Tagsbug,ci-flake
Tokens488897 in / 6041 out

Description

Description

The test-only spawn_foreign_child synchronization added by PR #53/#55 still intermittently races on nightly CI. On run 29241204349 job 86787423187, session_lock::tests::foreign_pid_identity_defeats_pid_reuse failed even though the helper waited for /proc/<pid>/comm to differ. Likely comm changed before /proc/<pid>/cmdline fully reflected exec; pid_reused_by_foreign scans the full identity for wg, so inherited test-harness cmdline can transiently classify the sleep child as ours. The rerun passed. Harden the test synchronization without weakening production PID identity checks.

Validation

  • Add a deterministic failing test or high-iteration stress reproducer for the remaining comm/cmdline exec race
  • Synchronization waits for the exact identity predicate the assertion requires, with a bounded timeout and actionable failure
  • Repeated cargo +nightly test session_lock::tests::foreign_pid_identity_defeats_pid_reuse and full session_lock suite pass
  • cargo build + cargo test pass with no regressions

Depends on

Required by

Log