From ec3197953c560e372b2d5c39cb4c6045d6a6fd16 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 5 Dec 2026 08:11:51 -0600 Subject: [PATCH 1/2] Test(mcp): Wait for the native pane exit status why: A test fixture saw its control stream close before tmux had recorded the owned process's exit. An empty status failed the fixture setup. what: Read the native observation under a bounded deadline while the pane has no recorded result. Keep the last observation for the assertion when the deadline expires. --- test/integration/mcp_cursor_identity_test.rb | 3 ++- test/support/tmux_fixture.rb | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/test/integration/mcp_cursor_identity_test.rb b/test/integration/mcp_cursor_identity_test.rb index b8c574b9..27990cc8 100644 --- a/test/integration/mcp_cursor_identity_test.rb +++ b/test/integration/mcp_cursor_identity_test.rb @@ -58,7 +58,8 @@ def test_reaped_leader_with_draining_output_rejects_reused_pid_and_foreign_ident assert_equal "ready\n", sink.gets connection.puts("write-and-exit") assert_equal "", connection.read - status = scope.server.run(["display-message", "-p", "-t", pane.id, '#{pane_dead}|#{pane_dead_status}|#{pane_dead_signal}']).text + # The control stream can close before tmux records the exit. + status = fixture.wait_for_pane_exit_status(scope.server, pane.id) assert_equal "0|0|\n", status, "the leader is reaped while its output pipe still has queued bytes" klass = LibTmux::MCP.const_get(:ProcessIdentity) original = klass.method(:acquire) diff --git a/test/support/tmux_fixture.rb b/test/support/tmux_fixture.rb index c678337b..d825a38c 100644 --- a/test/support/tmux_fixture.rb +++ b/test/support/tmux_fixture.rb @@ -114,6 +114,26 @@ def tmux(*arguments) capture(*arguments) end + def wait_for_pane_exit_status(server, pane_id, timeout: 5.0) + deadline = monotonic + timeout + status = nil + loop do + remaining = deadline - monotonic + return status unless remaining.positive? + + status = server.run(["display-message", "-p", "-t", pane_id, + '#{pane_dead}|#{pane_dead_status}|#{pane_dead_signal}'], timeout: remaining).text + return status unless status == "0||\n" + + pause = [deadline - monotonic, 0.02].min + sleep pause if pause.positive? + end + rescue LibTmux::DeadlineExceeded + raise if status.nil? + + status + end + def close failure = nil begin From 54da266185cc2e906fcb15f29fa41b9276f55e7f Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 5 Dec 2026 08:18:26 -0600 Subject: [PATCH 2/2] CI(docs): Note the fixture exit check why: Contributors need to know which behavior the Linux release check verifies. what: The Linux pane fixture waits for tmux to record a process exit after its control stream closes. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f00f95f..a608517f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,8 @@ at one version, so a release has a section in each changelog. and when loading requires that directory to exist. (#164) - Contributors can install the same tmux releases locally with `libtmux/mise-tmux` that Linux CI selects with `libtmux/setup-tmux`. (#168) +- The Linux pane fixture waits for tmux to record a process exit after its + control stream closes. (#195) - The MCP slow-reader test identifies whether the transport write expired or its test observer timed out. (#175) - The repository retired `scripts/build-tmux` and `scripts/apt-get.sh` when