From 86084d03ba3a21909c10efd286f5c522155837f4 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Fri, 24 Jul 2026 14:11:09 -0700 Subject: [PATCH] fix: getattr-guard _stop_loop_liveness_guards in GatewayRunner.stop Teardown-path tests build bare runners via object.__new__ without the liveness-guard machinery; the unguarded call raised AttributeError in 8 tests. Same guard pattern as the start path. --- gateway/run.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gateway/run.py b/gateway/run.py index 9a6b5d98333..1cfbfdef055 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -9431,7 +9431,11 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatew service_restart: bool = False, ) -> None: """Stop the gateway and disconnect all adapters.""" - self._stop_loop_liveness_guards() + # getattr-guard: shutdown-path tests build bare runners via + # object.__new__ that lack the liveness-guard machinery. + _stop_guards = getattr(self, "_stop_loop_liveness_guards", None) + if callable(_stop_guards): + _stop_guards() if restart: self._restart_requested = True self._restart_detached = detached_restart