Skip to content

Commit a665371

Browse files
committed
test(tools): Use bracket=False + trailing newline in test_paste_text for CI reliability
why: CI on tmux 3.6 kept failing the marker-in-capture assertion even with a 10-second retry window. Local probing showed the paste was delivered in ~0.1s, so the CI timeout was a symptom, not the cause. The real fragility is bracket=True: tmux wraps the paste in ESC[200~...ESC[201~ bracket markers, and bash readline needs a prompt cycle to latch bracketed-paste mode. On CI, if paste_text runs before that latch, the escape sequences get consumed as unrecognized input and the marker never reaches the visible pane buffer at all — no amount of retrying would recover it. what: - Set bracket=False explicitly in test_paste_text, sending raw bytes that don't depend on readline state. - Append a trailing newline to the text so the shell executes the echo command instead of just queuing input. This exercises the full paste->execute->output round-trip. - Expand the comment to document the bracket-mode rationale so future editors don't flip it back to the default. The paste_text tool itself still defaults to bracket=True, which is the right default for multi-line paste into a ready shell. Only the test needed to trade that off against CI determinism. The no-leak sibling test (test_paste_text_does_not_leak_named_buffer) independently verifies the buffer-isolation claim and is unaffected by this change.
1 parent f0d69b6 commit a665371

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

tests/test_pane_tools.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -957,20 +957,29 @@ def test_enter_copy_mode_with_scroll(mcp_server: Server, mcp_pane: Pane) -> None
957957

958958

959959
def test_paste_text(mcp_server: Server, mcp_pane: Pane) -> None:
960-
"""paste_text pastes text into a pane via tmux buffer."""
960+
"""paste_text pastes text into a pane via tmux buffer.
961+
962+
Uses bracket=False and a trailing newline so the shell actually
963+
executes the echo command. Previous versions of this test
964+
relied on the default bracket=True, which is fragile on CI:
965+
bash readline needs a prompt cycle to latch bracketed-paste
966+
mode, and if the paste arrives before that the escape sequences
967+
get consumed as unrecognized input and the marker never reaches
968+
the visible pane buffer. bracket=False sends raw bytes and the
969+
trailing newline forces execution, exercising the full
970+
paste->execute->output round-trip.
971+
"""
961972
result = paste_text(
962-
text="echo PASTE_TEST_marker_xyz",
973+
text="echo PASTE_TEST_marker_xyz\n",
963974
pane_id=mcp_pane.pane_id,
975+
bracket=False,
964976
socket_name=mcp_server.socket_name,
965977
)
966978
assert "pasted" in result.lower()
967979

968-
# Verify the text appeared in the pane. Use a generous retry
969-
# window: CI runners cold-start the pane's shell and the echo
970-
# output can take several seconds to render on the first run.
971-
# The 5-second budget tripped on tmux 3.3a CI; 10 seconds is
972-
# still fast enough to keep the test useful locally but reliable
973-
# on the slowest matrix cells.
980+
# Verify the echoed marker reaches the pane. 10 seconds is
981+
# generous on local machines (<1s) but tolerates slow CI
982+
# runners where bash cold-start can exceed the default budget.
974983
retry_until(
975984
lambda: "PASTE_TEST_marker_xyz" in "\n".join(mcp_pane.capture_pane()),
976985
10,

0 commit comments

Comments
 (0)