Skip to content

The agent that grows with you

test(e2e): a refused launch's unconsumed reply cannot answer the next cell

Teknium6f525dcf04ac
diff --git a/tests/e2e/core/windows_update/_machine.py b/tests/e2e/core/windows_update/_machine.py
index 8f089d899d2..cbf7fd922b7 100644
--- a/tests/e2e/core/windows_update/_machine.py
+++ b/tests/e2e/core/windows_update/_machine.py
@@ -618,6 +618,9 @@ def one_shot_turn(machine: Machine, srv: Any, label: str) -> Turn:
from tests.fakes.fake_llm_provider import Text
prompt_id, reply_id = f"PROMPT-{uuid.uuid4().hex[:8]}", f"REPLY-{uuid.uuid4().hex[:8]}"
+ # A reply an earlier refused launch never consumed would answer THIS prompt (the script is
+ # FIFO) and fail every later cell of the shared machine with another cell's reply id.
+ srv.drop_unconsumed()
before = len(srv.main_requests())
srv.push(Text(f"The answer is {reply_id}."))
res = machine.hermes("chat", "-q", f"Say the code {prompt_id}", "-Q", label=label)
diff --git a/tests/fakes/fake_llm_provider.py b/tests/fakes/fake_llm_provider.py
index 4c899c21ffe..3841166ef91 100644
--- a/tests/fakes/fake_llm_provider.py
+++ b/tests/fakes/fake_llm_provider.py
@@ -187,6 +187,13 @@ class FakeLLMServer:
with self._lock:
self._script.extend(responses)
+ def drop_unconsumed(self) -> int:
+ """Discard scripted responses no request consumed; returns how many."""
+ with self._lock:
+ dropped = len(self._script)
+ self._script.clear()
+ return dropped
+
def _next_main(self, record: dict[str, Any]) -> Response:
if self._responder is not None:
return self._responder(record)