From d4f7c2dbe4f66b6f3a72d634fd05ba1bc929f1cb Mon Sep 17 00:00:00 2001 From: Victor Kyriazakos Date: Thu, 20 Aug 2026 20:41:43 +0000 Subject: [PATCH] test(relay): expiry-notice assertion yields for the fire-and-forget ack task test_expired_own_prompt_notifies_instead_of_unknown_command asserted the expiry notice synchronously after _consume_prompt_response returned. The notice now rides a background task (read-loop self-deadlock fix: awaiting a send from the prompt_response handler blocks the very read loop that resolves the send's result future), so the test yields one tick before asserting egress. Behavior contract unchanged: exactly one notice, no chat dispatch. --- tests/gateway/relay/test_relay_interactive.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/gateway/relay/test_relay_interactive.py b/tests/gateway/relay/test_relay_interactive.py index 80151d32a5..853716d40c 100644 --- a/tests/gateway/relay/test_relay_interactive.py +++ b/tests/gateway/relay/test_relay_interactive.py @@ -18,6 +18,7 @@ Covers: from __future__ import annotations +import asyncio import time from typing import Any, Dict, Optional @@ -328,6 +329,11 @@ async def test_expired_own_prompt_notifies_instead_of_unknown_command(): event = _event({"prompt_id": prompt_id, "option_id": "c1"}) assert await adapter._consume_prompt_response(event) is True + # The notice is fire-and-forget now (read-loop self-deadlock fix: + # awaiting a send from _consume_prompt_response blocks the very read + # loop that resolves the send's result future). Yield so the + # background ack task runs before asserting egress. + await asyncio.sleep(0.05) notices = [a for a in stub.sent if a["op"] == "send"] assert len(notices) == 1 assert "no longer waiting" in notices[0]["content"]