Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions gateway/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4943,6 +4943,19 @@ async def _handle_message_with_agent(self, event, source, _quick_key: str, run_g
# session_entry so transcript writes below go to the right session.
if agent_result.get("session_id") and agent_result["session_id"] != session_entry.session_id:
session_entry.session_id = agent_result["session_id"]
# Send compression notification if configured

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This notification is gated on session-ID rotation, but current main defaults compression.in_place to true (hermes_cli/config.py:1463), which compacts without changing the ID. The default path therefore never reaches this block; allow the existing compaction lifecycle status through the gateway status filter instead.

_comp_cfg = _load_gateway_config().get("compression", {})
if _comp_cfg.get("notify", False):
try:
_notif_adapter = self.adapters.get(source.platform)
if _notif_adapter:
_notif_msg = _comp_cfg.get(
"notify_message",
"⚡ 上下文已自动压缩,对话历史已精简摘要,当前对话继续有效。",
)
await _notif_adapter.send(source.chat_id, _notif_msg)
except Exception as _notif_err:
logger.debug("Compression notification failed: %s", _notif_err)

# Prepend reasoning/thinking if display is enabled (per-platform)
try:
Expand Down