test(gateway): assert queued outcome, not merge_pending_message_event call

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.
This commit is contained in:
teknium1 2026-06-20 13:24:31 -07:00 committed by Teknium
parent c11c510b42
commit b4b512c507

View file

@ -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: