fix(honcho): bust gateway agent cache on session-prefix flips

Address review feedback on #39130: the new sessionAiPeerPrefix setting
affects the resolved Honcho session key, which HonchoMemoryProvider freezes
at construction (self._session_key). Because it wasn't part of the gateway's
cached-agent signature, a live config flip left an existing gateway session
bound to its old, AI-peer-agnostic Honcho session until an unrelated eviction
or restart.

Add honcho.session_ai_peer_prefix to _HONCHO_CACHE_BUSTING_KEYS and the
_extract_honcho_cache_busting_config values so a flip rebuilds the cached
agent on the next turn, mirroring the existing aiPeer / pin_peer_name /
runtime_peer_prefix contracts.

Also close the symmetric gap for the pre-existing user-side sessionPeerPrefix:
it feeds the same resolve_session_name output (per-session/title/per-repo/
per-directory strategies) into the same frozen _session_key, so it had the
identical live-flip staleness bug and was likewise absent from the cache
signature. Fixing both keeps the two prefixes consistent.

Add one config-flip regression test covering both keys, alongside the
existing Honcho cache-signature test.
This commit is contained in:
Eli Robbins
2026-07-30 09:13:32 -04:00
committed by kshitij
parent 0a7c17159c
commit 55dfb517e4
2 changed files with 18 additions and 1 deletions
+1 -1
View File
@@ -703,7 +703,7 @@ class HonchoMemoryProvider(DialecticMixin, MemoryProvider):
"pin_user_identity": bool(cfg.pin_peer_name),
"runtime_identity_prefix": cfg.runtime_peer_prefix or "",
"user_identity_aliases": sorted(aliases.items()),
"session_prefixing": [bool(cfg.session_peer_prefix)],
"session_prefixing": [bool(cfg.session_peer_prefix), bool(cfg.session_ai_peer_prefix)],
"a2a_sessions": bool(cfg.a2a_sessions),
}
self._identity_signature_memo = {memo_key: values}