fix(honcho): scope gateway sessions by runtime user id

This commit is contained in:
LeonSGP43 2026-04-17 13:49:31 +08:00 committed by kshitij
parent ba7da73ca9
commit 5b6792f04d
4 changed files with 75 additions and 29 deletions

View file

@ -293,14 +293,6 @@ class HonchoMemoryProvider(MemoryProvider):
logger.debug("Honcho not configured — plugin inactive")
return
# Override peer_name with gateway user_id for per-user memory scoping.
# Only when no explicit peerName was configured — an explicit peerName
# means the user chose their identity; a raw user_id (e.g. Telegram
# chat ID) should not silently replace it.
_gw_user_id = kwargs.get("user_id")
if _gw_user_id and not cfg.peer_name:
cfg.peer_name = _gw_user_id
self._config = cfg
# ----- B1: recall_mode from config -----
@ -359,6 +351,7 @@ class HonchoMemoryProvider(MemoryProvider):
honcho=client,
config=cfg,
context_tokens=cfg.context_tokens,
runtime_user_peer_name=kwargs.get("user_id") or None,
)
# ----- B3: resolve_session_name -----