test(gateway): widen pending-drain chain wait budget (4s -> 20s)

Same loaded-runner class: the 12-turn drain chain completed only 11
turns inside the 400x0.01s poll budget on main run 33455779041. The
loop still exits early on success, so the wider budget costs nothing
on healthy runs.
This commit is contained in:
Teknium
2026-09-01 09:35:00 -07:00
parent 28834a2098
commit 83cde7f31d
@@ -112,7 +112,9 @@ async def test_in_band_drain_does_not_grow_stack():
# Drain the chain. Each turn schedules the next via the in-band
# drain block, so we wait until N handler runs have completed and
# the session has been released.
for _ in range(400):
# 2000 * 0.01s = 20s budget: the old 4s budget flaked on loaded CI
# runners (11/12 turns completed; main run 33455779041).
for _ in range(2000):
if len(depths) >= N and sk not in adapter._active_sessions:
break
await asyncio.sleep(0.01)
@@ -278,7 +280,9 @@ async def test_late_arrival_drain_still_fires_when_no_in_band_drain():
await adapter.handle_message(_make_event(text="first"))
# Wait for the late-arrival drain task to finish the second event.
for _ in range(400):
# 2000 * 0.01s = 20s budget: the old 4s budget flaked on loaded CI
# runners (11/12 turns completed; main run 33455779041).
for _ in range(2000):
if "late" in results and sk not in adapter._active_sessions:
break
await asyncio.sleep(0.01)