From b4b512c5079b3a811f7a1f0010cc843c492b0f82 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sat, 20 Jun 2026 13:24:31 -0700 Subject: [PATCH] test(gateway): assert queued outcome, not merge_pending_message_event call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The subagent-demotion busy-handler test asserted the internal merge_pending_message_event call, which the FIFO refactor replaced with _queue_or_replace_pending_event. Assert the behavioral outcome (the follow-up lands in the pending slot for the next turn) instead — same fix already applied to the two steer-fallback tests. --- tests/gateway/test_subagent_protection_30170.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/gateway/test_subagent_protection_30170.py b/tests/gateway/test_subagent_protection_30170.py index 365991de1eb..0ee5fcda1ed 100644 --- a/tests/gateway/test_subagent_protection_30170.py +++ b/tests/gateway/test_subagent_protection_30170.py @@ -221,13 +221,13 @@ class TestBusyHandlerDemotesInterruptForSubagents: runner._running_agents[sk] = parent runner.adapters[event.source.platform] = adapter - with patch("gateway.run.merge_pending_message_event") as merge_mock: - handled = await runner._handle_active_session_busy_message(event, sk) + handled = await runner._handle_active_session_busy_message(event, sk) assert handled is True parent.interrupt.assert_not_called() - # Message must still be queued so it gets picked up on the next turn. - merge_mock.assert_called_once() + # Message must still be queued so it gets picked up on the next turn + # (stored via the FIFO path — its own turn, no destructive merge). + assert adapter._pending_messages.get(sk) is event @pytest.mark.asyncio async def test_ack_explains_the_demotion(self) -> None: