fix(honcho): preserve deferred routing invariants

Thread logical session cwd through deferred Desktop/TUI builds, normalize absent cwd during construction, and share title provenance constants between SessionDB and Honcho.

(cherry picked from commit 2693f4f27c776ac819d92c9b52e8a03ad2a985d8)
This commit is contained in:
outpoints
2026-08-28 16:05:23 -07:00
committed by Teknium
parent 5237cab756
commit 44ba32a565
8 changed files with 137 additions and 8 deletions
+3 -1
View File
@@ -30,6 +30,7 @@ from agent.memory_provider import spawn_context_thread as _spawn_context_thread
from agent.secret_scope import get_secret
from hermes_cli.profiles import _get_default_hermes_home
from hermes_constants import get_hermes_home
from hermes_state_common import TITLE_SOURCE_DERIVED, TITLE_SOURCE_LLM
from plugins.memory.honcho.client_cache import (
_DEFAULT_HTTP_TIMEOUT, _client_cache_key, _client_slots, _client_slots_lock,
@@ -42,6 +43,7 @@ if TYPE_CHECKING:
logger = logging.getLogger(__name__)
HOST = "hermes"
_AUTOMATIC_SESSION_TITLE_SOURCES = frozenset({TITLE_SOURCE_DERIVED, TITLE_SOURCE_LLM})
def _sanitize_url(url: str | None) -> str | None:
@@ -526,7 +528,7 @@ class HonchoClientConfig:
return manual
# Absent provenance retains the legacy explicit-title override. Generated
# display titles must not change a strategy-selected memory identity.
if session_title and session_title_source not in {"derived", "llm"} and _slug(session_title):
if session_title and session_title_source not in _AUTOMATIC_SESSION_TITLE_SOURCES and _slug(session_title):
return self._with_peer_prefix(_slug(session_title))
if self.session_strategy == "per-repo":
return self._with_peer_prefix(self._git_repo_name(cwd) or Path(cwd).name)