Skip to content

The agent that grows with you

test(gateway): busy-path probes wait on the FIFO drain, not the receive call

Teknium08cafee8de51
diff --git a/tests/gateway/fixtures/native_ingress_trust_multiplex.py b/tests/gateway/fixtures/native_ingress_trust_multiplex.py
index b4d14bcc3b4..8c05d1f2690 100644
--- a/tests/gateway/fixtures/native_ingress_trust_multiplex.py
+++ b/tests/gateway/fixtures/native_ingress_trust_multiplex.py
@@ -134,6 +134,9 @@ async def multiplex_probe(runner, authority, primary, state, mode, peer):
async with asyncio.timeout(10):
while adapter._active_sessions:
await asyncio.sleep(0.01)
+ # The busy receive returned at commit; the queued turn finishes on the FIFO drain.
+ if authority.sessions[entry.session_id].task is not None:
+ await asyncio.wait_for(authority.sessions[entry.session_id].task, 10)
assert all(row['outcome'] == 'completed' for row in rows(entry.session_id))
assert worker_scopes == [(str(state), 'runtime-fixture-key')] * 2 + [(str(state), 'runtime-fresh-key')], worker_scopes
if mode == 'capture':
diff --git a/tests/gateway/fixtures/shared_authority_recovery.py b/tests/gateway/fixtures/shared_authority_recovery.py
index 8c1edb66854..e6dcfd780e1 100644
--- a/tests/gateway/fixtures/shared_authority_recovery.py
+++ b/tests/gateway/fixtures/shared_authority_recovery.py
@@ -57,7 +57,10 @@ async def prepare_crash(runner, adapter, source, peer):
async with asyncio.timeout(5):
while not any(r['request_id'] == 'unknown-follower' for r in rows(authority, sid)):
await asyncio.sleep(0.01)
- assert not follower.done()
+ # The receive coroutine is released at durable commit (serial IRC/Signal loops keep
+ # reading); the follower itself stays queued behind the started head until the crash.
+ await asyncio.wait_for(follower, 5)
+ assert [r['status'] for r in rows(authority, sid) if r['request_id'] == 'unknown-follower'] == ['queued']
# Production trusted ingress commits synchronously before its first execution
# yield. Freeze THIS scheduling boundary, not a claim/storage predicate.
safe_source = replace(source, chat_id='recover-chat', thread_id='recover-thread')