The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): goal/heartbeat manager lookups for internal events skip activity touch
Teknium056f10acf67e
diff --git a/gateway/run.py b/gateway/run.pyindex b3d32b9c1aa..1c6573e5b01 100644--- a/gateway/run.py+++ b/gateway/run.py@@ -20149,7 +20149,13 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatewlogger.debug("goal manager unavailable: %s", exc)return None, Nonetry:- session_entry = await self.async_session_store.get_or_create_session(event.source)+ # Session lookups on behalf of an internal event must not advance+ # the user-activity clock that drives idle/daily reset policy+ # (same class as the wake fix in _handle_message_with_agent).+ session_entry = await self.async_session_store.get_or_create_session(+ event.source,+ touch_activity=not bool(getattr(event, "internal", False)),+ )except Exception as exc:logger.debug("goal manager: session lookup failed: %s", exc)return None, None@@ -20170,7 +20176,12 @@ class GatewayRunner(GatewayAuthorizationMixin, GatewayKanbanWatchersMixin, Gatewlogger.debug("heartbeat manager unavailable: %s", exc)return None, Nonetry:- session_entry = await self.async_session_store.get_or_create_session(event.source)+ # Same reset-policy contract as _get_goal_manager_for_event:+ # internal events look up the session without touching activity.+ session_entry = await self.async_session_store.get_or_create_session(+ event.source,+ touch_activity=not bool(getattr(event, "internal", False)),+ )except Exception as exc:logger.debug("heartbeat manager: session lookup failed: %s", exc)return None, Nonediff --git a/tests/gateway/test_goal_max_turns_config.py b/tests/gateway/test_goal_max_turns_config.pyindex 154485bd349..9dda0e44d3d 100644--- a/tests/gateway/test_goal_max_turns_config.py+++ b/tests/gateway/test_goal_max_turns_config.py@@ -15,7 +15,7 @@ class _FakeSessionStore:def __init__(self):self.entry = _FakeSessionEntry()- def get_or_create_session(self, source):+ def get_or_create_session(self, source, **_kwargs):return self.entrydef _generate_session_key(self, source):