From a93307956437f85a3914f91387b83c2373acc9cb Mon Sep 17 00:00:00 2001 From: Teknium Date: Fri, 3 Apr 2026 00:45:31 -0700 Subject: [PATCH] fix: move class-level attribute after docstring, clarify throttle comment Follow-up nits for salvaged PR #4577: - Move _running_agents_ts class attribute below the docstring so GatewayRunner.__doc__ is preserved. - Add clarifying comment explaining the throttle continue behavior (batches queued messages during the throttle interval). --- gateway/run.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gateway/run.py b/gateway/run.py index dfcda3fac..1ab455634 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -446,16 +446,16 @@ def _resolve_hermes_bin() -> Optional[list[str]]: class GatewayRunner: - # Class-level defaults so partial construction in tests doesn't - # blow up on attribute access. - _running_agents_ts: Dict[str, float] = {} - """ Main gateway controller. Manages the lifecycle of all platform adapters and routes messages to/from the agent. """ + + # Class-level defaults so partial construction in tests doesn't + # blow up on attribute access. + _running_agents_ts: Dict[str, float] = {} def __init__(self, config: Optional[GatewayConfig] = None): self.config = config or load_gateway_config() @@ -5466,6 +5466,9 @@ class GatewayRunner: _now = time.monotonic() _remaining = _PROGRESS_EDIT_INTERVAL - (_now - _last_edit_ts) if _remaining > 0: + # Wait out the throttle interval, then loop back to + # drain any additional queued messages before sending + # a single batched edit. await asyncio.sleep(_remaining) continue