Skip to content

The agent that grows with you

test(e2e): wait on conditions, not the clock, in the classic-CLI tmux drivers

Teknium5103b46700df
diff --git a/tests/e2e/core/cli_tmux/_classic.py b/tests/e2e/core/cli_tmux/_classic.py
index a499eb8a2db..817073d01b7 100644
--- a/tests/e2e/core/cli_tmux/_classic.py
+++ b/tests/e2e/core/cli_tmux/_classic.py
@@ -202,10 +202,15 @@ class Pane:
return
time.sleep(0.2)
+ def paste_gap(self) -> None:
+ """Keep the next key out of the input batch the app is still reading: prompt_toolkit takes an
+ Enter that lands within 50 ms of the last buffer change for a pasted newline."""
+ time.sleep(1.2) # health: allow HX013 -- the gap IS the behaviour: the CLI's paste detection is time-based
+
def submit(self, text: str) -> None:
self.tmux("send-keys", "-t", "p", "-l", text)
self.wait([f"{PROMPT} {text}"[-40:]], 10)
- time.sleep(1.2)
+ self.paste_gap()
self.keys("Enter")
def wait_dead(self, timeout: float = 30.0) -> bool:
@@ -218,7 +223,6 @@ class Pane:
"""Wait for the running app's status bar (painted in raw mode), then let startup settle."""
hit = self.wait([STATUS_BAR], timeout)
self.settle(quiet=3.0, timeout=30)
- time.sleep(1.5)
return hit
def kill(self) -> None:
diff --git a/tests/e2e/core/cli_tmux/test_classic_cli_main_parity.py b/tests/e2e/core/cli_tmux/test_classic_cli_main_parity.py
index 6aec8968a77..01a6710bfac 100644
--- a/tests/e2e/core/cli_tmux/test_classic_cli_main_parity.py
+++ b/tests/e2e/core/cli_tmux/test_classic_cli_main_parity.py
@@ -147,8 +147,7 @@ def test_classic_cli_matches_main_baseline_across_fifteen_steps(tmp_path: Path)
pane.settle(quiet=1.5, timeout=10)
s.expect("06a_model", ["Model Picker", "Current: fake-model"], s.capture("06a_model"))
pane.keys("Escape")
- time.sleep(1.0)
- pane.settle(quiet=1.0, timeout=5)
+ pane.settle(quiet=1.0, timeout=10)
pane.submit(f"/title {TITLE}")
assert pane.wait([f"Session title set: {TITLE}"], 30), pane.screen()
diff --git a/tests/e2e/core/providers/test_native_vertex_cli_background.py b/tests/e2e/core/providers/test_native_vertex_cli_background.py
index 3fcf3b4f4af..58725ee1817 100644
--- a/tests/e2e/core/providers/test_native_vertex_cli_background.py
+++ b/tests/e2e/core/providers/test_native_vertex_cli_background.py
@@ -91,7 +91,8 @@ def test_vertex_config_label_and_background_task_through_the_gateway(tmp_path: P
def submit(line: str) -> None:
tmux("send-keys", "-t", "p", "-l", line)
wait_for(f"\u276f {line}", timeout=20)
- time.sleep(0.5)
+ # An Enter within 50 ms of the last buffer change reads as a pasted newline.
+ time.sleep(0.5) # health: allow HX013 -- the gap IS the behaviour: the CLI's paste detection is time-based
tmux("send-keys", "-t", "p", "Enter")
# `-t file` like the sibling Vertex suites: the default toolset trips #109115 (terminal.notify's
@@ -101,13 +102,11 @@ def test_vertex_config_label_and_background_task_through_the_gateway(tmp_path: P
"-c", str(nh.project), *argv], env=env, check=True, timeout=30)
try:
tmux("set", "-g", "remain-on-exit", "on")
- wait_for("\u2624 ", timeout=120) # the status bar: the app owns the terminal
- time.sleep(2.0)
+ wait_for("\u2624 ", timeout=120) # the status bar: the app owns the terminal (raw mode)
# The CLI resolves its route at the first turn (as main did); /config reads that route.
submit("hello vertex")
wait_for("foreground ok", timeout=120)
- time.sleep(1.0)
mints_before_config = len(fake.token_requests)
submit("/config")