fix(gateway): suppress compression status noise on Discord and other chats (#39293)

Extend the gateway noisy-status filter beyond Telegram so internal
compression lifecycle messages stay in logs instead of spamming Discord,
Slack, and other messaging channels.
This commit is contained in:
HexLab98 2026-06-28 15:25:14 +07:00 committed by kshitij
parent 9f7d520caf
commit d2ea948bc0

View file

@ -70,7 +70,7 @@ _ADAPTER_DISCONNECT_TIMEOUT_SECS_DEFAULT = 5.0
_TELEGRAM_COMMAND_MENTION_RE = re.compile(r"(?<![\w:/])/([A-Za-z0-9][A-Za-z0-9_-]*)")
_TELEGRAM_NOISY_STATUS_RE = re.compile(
r"(" # transient/auxiliary status that should stay in logs, not Telegram chat
r"(" # transient/auxiliary status that should stay in logs, not gateway chats
r"auxiliary\s+.+\s+failed"
r"|compression\s+summary\s+failed"
r"|fallback\s+context\s+marker"
@ -79,6 +79,7 @@ _TELEGRAM_NOISY_STATUS_RE = re.compile(
r"|auto-lowered\s+compression\s+threshold"
r"|compacting\s+context\s+[—-]\s+summarizing\s+earlier\s+conversation"
r"|preflight\s+compression"
r"|session\s+compressed\s+\d+\s+times"
r"|rate\s+limited\.\s+waiting\s+\d"
r"|retrying\s+in\s+\d"
r"|max\s+retries\s+\(\d+\).*(?:trying\s+fallback|exhausted|invalid\s+responses)"
@ -429,7 +430,11 @@ def _sanitize_gateway_final_response(platform: Any, text: str) -> str:
def _prepare_gateway_status_message(platform: Any, event_type: str, message: str) -> Optional[str]:
"""Filter/sanitize agent status callbacks before platform delivery."""
"""Filter/sanitize agent status callbacks before platform delivery.
Local/CLI sessions keep the raw diagnostic stream. Messaging gateway
surfaces should not receive transient auxiliary/compression chatter.
"""
text = str(message or "").strip()
if not text:
return None