Skip to content

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

Merged
teknium1 merged 1 commit into
mainfrom
fix/e2e-goals-warmup-hermetic
Aug 25, 2026
Merged

teknium1 merged 1 commit into
mainfrom
fix/e2e-goals-warmup-hermetic

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

The e2e group-restart test no longer fails CI with the bare "Expected 'mock' to have been called once. Called 0 times." — the flake tracked in #92130 that hit unrelated PRs (#89118, #92058, #94388) and two main runs tonight.

Root cause: the e2e runner fixture left GatewayRunner._run_post_turn_hooks real. That path runs the /goal continuation, whose SessionDB warm-up constructs a REAL SessionDB on an executor thread at the turn boundary. On a cold or loaded CI runner that state.db init exceeds send_and_capture's 2s poll window, so the send lands after the assertion. Proven by sabotage A/B: injecting a 3s SessionDB.__init__ delay reproduces the exact CI failure deterministically on current main, and passes with this fix.

Changes

  • tests/e2e/conftest.py: mock _run_post_turn_hooks in the e2e runner — these tests exercise gateway command dispatch, not post-turn goal hooks
  • tests/conftest.py: scrub TELEGRAM_GROUP_ALLOWED_USERS / TELEGRAM_GROUP_ALLOWED_CHATS / QQ_ALLOWED_USERS / QQ_GROUP_ALLOWED_USERS in the hermetic env — a developer shell with a group allowlist set flips _get_unauthorized_dm_behavior to "ignore" and deterministically fails the pairing e2e test locally (the per-user vars were already scrubbed; the group vars checked by authz_mixin.py were not)

Validation

Before After
3s slow-SessionDB sabotage, group-restart test FAILED (identical to CI runs 32802504263 / 32799192528 / 32796821900) 1 passed in 0.36s
tests/e2e/ full directory ×3 (shell has TELEGRAM_GROUP_ALLOWED_CHATS set) pairing test failed deterministically 61 passed, 7 skipped ×3

Related: #92130 (diagnostics-only PR by @mehmetkr-31 — complementary, this PR fixes the flake itself).

Infographic

Flake Slayer

… init

The /goal post-turn hook constructs a real SessionDB on an executor
thread at the turn boundary. On a cold or loaded CI runner that
state.db init can exceed send_and_capture's 2s poll window, so the
send lands after the assertion and the test reports the bare
'Expected mock to have been called once. Called 0 times.' (#92130).
Mock _run_post_turn_hooks in the e2e runner — these tests exercise
gateway command dispatch, not goal hooks.

Also scrub TELEGRAM_GROUP_ALLOWED_CHATS / *_GROUP_ALLOWED_USERS / QQ
allowlist env vars in the hermetic conftest: a developer shell with
those set flips _get_unauthorized_dm_behavior to 'ignore' and fails
the pairing e2e test locally.
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 7433743 — fix(tests): e2e group-restart test no longer flakes on cold

⚠️ Warnings

OSV vulnerability scan · View job

7 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 3m26s vs 4m17s (-19.8%). 4 job(s) slower, 5 faster, 3 unchanged.

  • Python tests / Run tests: -36.0s
  • OS-specific tests / Windows-only tests: -23.0s
  • OS-specific tests / macOS-only tests: -15.0s
  • Python lints / Windows footguns (blocking): +6.0s
  • OSV scan / Scan lockfiles / osv-scan: +6.0s

@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery labels Aug 25, 2026
@teknium1
teknium1 merged commit bc47fcd into main Aug 25, 2026
36 checks passed
@teknium1
teknium1 deleted the fix/e2e-goals-warmup-hermetic branch August 25, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants