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)

This commit is contained in:
Hermes Agent 2026-08-08 05:17:30 +00:00
parent 2fde40293c
commit ac54aee53d

View File

@ -163,11 +163,10 @@ class MatrixBot:
note = "thinking" note = "thinking"
snippet = note[:64] snippet = note[:64]
now = time.monotonic() now = time.monotonic()
should_send = False should_send = (
if snippet and snippet != last_note: (snippet and snippet != last_note)
should_send = True or now - last_sent >= max(60.0, self._settings.thinking_interval_sec * 2)
elif now - last_sent >= max(60.0, self._settings.thinking_interval_sec * 2): )
should_send = True
if should_send: if should_send:
msg = f"Still thinking — {snippet}" msg = f"Still thinking — {snippet}"
await self._client.send_message(token, room_id, msg) await self._client.send_message(token, room_id, msg)