Skip to content

The agent that grows with you

fix(tests): e2e group-restart test no longer flakes on cold SessionDB init

Tekniumbc47fcd3f927
diff --git a/tests/conftest.py b/tests/conftest.py
index 00644ab7e66..56c92149fb7 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -347,6 +347,10 @@ _HERMES_BEHAVIORAL_VARS = frozenset({
# (user shell, earlier leaky test, CI env), they change gateway auth
# behavior and flake button-authorization tests.
"TELEGRAM_ALLOWED_USERS",
+ "TELEGRAM_GROUP_ALLOWED_USERS",
+ "TELEGRAM_GROUP_ALLOWED_CHATS",
+ "QQ_ALLOWED_USERS",
+ "QQ_GROUP_ALLOWED_USERS",
"DISCORD_ALLOWED_USERS",
"WHATSAPP_ALLOWED_USERS",
"SLACK_ALLOWED_USERS",
diff --git a/tests/e2e/conftest.py b/tests/e2e/conftest.py
index 46c98b5d084..682054f8421 100644
--- a/tests/e2e/conftest.py
+++ b/tests/e2e/conftest.py
@@ -235,6 +235,17 @@ def make_runner(platform: Platform, session_entry: SessionEntry = None) -> "Gate
# telegram param only — first parametrization pays the cold-resolution cost).
runner._reset_notice_session_info = lambda source: ""
+ # Keep the agent-turn path hermetic: _run_post_turn_hooks runs the /goal
+ # continuation, whose SessionDB warm-up constructs a REAL SessionDB on an
+ # executor thread at the turn boundary. On a cold/loaded CI runner that
+ # state.db init can exceed send_and_capture's 2s poll window, so the send
+ # lands after the assertion — the "Expected 'mock' to have been called
+ # once. Called 0 times." flake on
+ # test_plaintext_restart_gateway_in_group_stays_plain_text[telegram]
+ # (issue #92130; e.g. runs 32802504263 / 32799192528 / 32796821900).
+ # e2e tests exercise gateway command dispatch, not post-turn goal hooks.
+ runner._run_post_turn_hooks = AsyncMock()
+
runner.pairing_store = MagicMock()
runner.pairing_store._is_rate_limited = MagicMock(return_value=False)
runner.pairing_store.generate_code = MagicMock(return_value="ABC123")