Skip to content

test(remote-control): deterministic child pid in the real-tmux ownership test - #133

Merged
JayantDevkar merged 1 commit into
mainfrom
fix/tmux-ownership-flake
Oct 22, 2026
Merged

JayantDevkar merged 1 commit into
mainfrom
fix/tmux-ownership-flake

Conversation

@JayantDevkar

Copy link
Copy Markdown
Owner

Problem

test_pane_ownership_against_real_tmux failed on the ubuntu 3.10 leg three times today (#115, #116, #117), always at the child assertion with a fresh pid, while the pane-pid assertion passed. Test bug, not a service bug.

Changes

  • The test typed sleep 30 into an interactive login shell and took the first pgrep -P <pane_pid> hit as the child. On Ubuntu runners bash startup forks short-lived helpers (lesspipe, dircolors, locale checks); procps pgrep lists those mid-fork, so the test sometimes grabbed a helper that was gone by the time _pane_owns_pid ran ps -o ppid=. The service correctly returned False for a dead pid.
  • The pane now runs a fixed sleep 30 & wait instead of a login shell plus send-keys, and the child is matched with pgrep -x -P <pane_pid> sleep, so the test checks the live process it started. No service change; refusing a dead pid is the intended behaviour.

Verification

  • Reproduced before the fix with an Ubuntu-like bash startup (throwaway HOME with forking helpers) and a procps-style pgrep shim: 37 of 40 runs failed at the same line. Control without forking startup files: 10/10 pass. Plain macOS never failed (its pgrep -P skips mid-fork children).
  • After the fix: 40/40 under the repro conditions, 40/40 plain, 40/40 with 12× yes on 10 cores. Whole file 40 passed, ruff clean.

Follow-ups

None.

https://claude.ai/code/session_019dHRodCxwuwTvnKtUNrUU7

…child

The real-tmux ownership test typed `sleep 30` into an interactive login shell and took the first `pgrep -P` hit as its child. On Ubuntu runners the shell's startup files fork short-lived helpers (lesspipe, dircolors, locale checks), and procps pgrep lists those mid-fork subshells and zombies, so the test sometimes picked a helper that had exited before `_pane_owns_pid` ran `ps`, which correctly reported it as not owned. The pane now runs a fixed `sleep 30 & wait` command and the test matches the child by name with `pgrep -x`, so it always checks the live process it started.

Claude-Session: https://claude.ai/code/session_019dHRodCxwuwTvnKtUNrUU7
@JayantDevkar
JayantDevkar merged commit 44ea7bf into main Oct 22, 2026
13 checks passed
@JayantDevkar
JayantDevkar deleted the fix/tmux-ownership-flake branch October 22, 2026 14:22
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