Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

fix(ci): restore terminal display waits (#2316)

Seth Karten849ab8599809
diff --git a/scripts/benchmarks/terminal.py b/scripts/benchmarks/terminal.py
index 3b24c1bda9..8b13489bba 100644
--- a/scripts/benchmarks/terminal.py
+++ b/scripts/benchmarks/terminal.py
@@ -126,6 +126,13 @@ class Terminal:
while time.perf_counter() < deadline:
self.pump()
+ def until(self, predicate: Callable[[Display], bool], seconds: float) -> None:
+ deadline = time.perf_counter() + seconds
+ while not predicate(self.display):
+ if time.perf_counter() >= deadline:
+ raise TimeoutError("Timed out waiting for terminal display")
+ self.pump()
+
def ready(self, seconds: float = 30) -> float:
deadline = time.perf_counter() + seconds
probes: list[str] = []
diff --git a/scripts/benchmarks/tests/test_terminal_readiness.py b/scripts/benchmarks/tests/test_terminal_readiness.py
index d70a079824..0509782c32 100644
--- a/scripts/benchmarks/tests/test_terminal_readiness.py
+++ b/scripts/benchmarks/tests/test_terminal_readiness.py
@@ -127,6 +127,18 @@ class ReadinessTests(unittest.TestCase):
patch("terminal.secrets.token_hex", side_effect=(f"{i:08x}" for i in range(1000))).start()
return terminal, child, clock
+ def test_until_pumps_until_the_display_matches(self):
+ terminal, editor, clock = self.launch()
+ editor.schedule(clock.now + 0.03, "target")
+ terminal.until(lambda display: "target" in display.text(), 0.1)
+ self.assertIn("target", terminal.display.text())
+
+ def test_until_times_out_when_the_display_never_matches(self):
+ terminal, _, clock = self.launch()
+ with self.assertRaisesRegex(TimeoutError, "terminal display"):
+ terminal.until(lambda display: "missing" in display.text(), 0.1)
+ self.assertLess(clock.now - 4.0, 0.11)
+
def test_changed_absent_and_stale_labels_do_not_gate_input(self):
for label in ("agents/resume", "manage", "sessions / continue", "", "benchready"):
with self.subTest(label=label):