fix(session): switch() persists binding; wecom dispatch errors logged
- switch() (admin UI bind + /switch) never called _persist_binding — UI-created bindings were lost on restart and invisible in the db - wecom ws recv loop swallowed dispatch exceptions silently; now logs msg preview on dispatch failure (inbound blind spot)
This commit is contained in:
1 parent
817a5cba5d
commit
738c977e7d
2 files changed
+4
No files matched your search
@@ -132,7 +132,10 @@ class WecomAibotChannel:
|
||||
if raw is None:
|
||||
continue
|
||||
msg = json.loads(raw)
|
||||
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()
|
||||
|
||||
@@ -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)}
|
||||
|
||||
Reference in new issue
Block a user