diff --git a/src/agenthub/channels/wecom.py b/src/agenthub/channels/wecom.py index 16572f5..83aa31c 100644 --- a/src/agenthub/channels/wecom.py +++ b/src/agenthub/channels/wecom.py @@ -132,7 +132,10 @@ class WecomAibotChannel: if raw is None: continue msg = json.loads(raw) - self._dispatch(msg, ws) + try: + self._dispatch(msg, ws) + except Exception as e: # noqa: BLE001 + self._logger.error(f"[wecom] dispatch failed: {e}; msg={raw[:200]}") finally: try: ws.close() diff --git a/src/agenthub/session.py b/src/agenthub/session.py index eecd3dc..d6e8c10 100644 --- a/src/agenthub/session.py +++ b/src/agenthub/session.py @@ -244,6 +244,7 @@ class SessionManager: self._bindings[self.key(channel, chat_id)] = Binding( channel=channel, chat_id=chat_id, agent=agent_name, acp_session_id=session_id ) + self._persist_binding(self._bindings[self.key(channel, chat_id)]) for entry in migrated: self._append_text(key, agent_name, session_id, entry) return {"agent": agent_name, "acp_session_id": session_id, "migrated": len(migrated)}