From ac54aee53d26cc901b8de95872f1e4a3be4b4da0 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Sat, 8 Aug 2026 05:17:30 +0000 Subject: [PATCH] fix(hermes): Merges the identical branch bodies into one boolean expression without changing when a heartbeat message is sent. (incident sonar/atlasbot/python:S1871/AZ2y3T24Ky9i4pkIpSiI) --- atlasbot/matrix/bot.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/atlasbot/matrix/bot.py b/atlasbot/matrix/bot.py index 5a0778a..34e7f7d 100644 --- a/atlasbot/matrix/bot.py +++ b/atlasbot/matrix/bot.py @@ -163,11 +163,10 @@ class MatrixBot: note = "thinking" snippet = note[:64] now = time.monotonic() - should_send = False - if snippet and snippet != last_note: - should_send = True - elif now - last_sent >= max(60.0, self._settings.thinking_interval_sec * 2): - should_send = True + should_send = ( + (snippet and snippet != last_note) + or now - last_sent >= max(60.0, self._settings.thinking_interval_sec * 2) + ) if should_send: msg = f"Still thinking — {snippet}…" await self._client.send_message(token, room_id, msg)