fix(honcho): resolve sessions against agent cwd, not process cwd
The Honcho provider resolved per-repo/per-directory session names from os.getcwd(), which is the backend process launch directory on Desktop/gateway hosts (typically $HOME), not the user's workspace. With a manual sessions map entry for the home directory, every Desktop conversation landed in that fallback bucket instead of the project's per-repo session. Use agent.runtime_cwd.resolve_agent_cwd() — the same single source of truth already used for system-prompt and context-file discovery — so Honcho session routing agrees with everything else about where the agent logically lives. It honors the pinned session cwd, then TERMINAL_CWD, then the launch directory; CLI sessions launched inside a project resolve identically either way. Adds a regression covering the Desktop-style case: backend launched in $HOME, workspace elsewhere, home-directory manual map present. Refs #24740 (cherry picked from commit cfb32757de2509dd404acf98311e357d73fa741e)
This commit is contained in:
@@ -275,7 +275,11 @@ class HonchoMemoryProvider(DialecticMixin, MemoryProvider):
|
||||
|
||||
def _resolve_session_key(self, cfg, session_id: str, **kwargs) -> str:
|
||||
"""Resolve the Honcho session key without touching the network."""
|
||||
from agent.runtime_cwd import resolve_agent_cwd
|
||||
|
||||
cwd = kwargs.get("cwd") or str(resolve_agent_cwd())
|
||||
return cfg.resolve_session_name(
|
||||
cwd=cwd,
|
||||
session_title=kwargs.get("session_title"), session_id=session_id,
|
||||
session_title_source=kwargs.get("session_title_source"),
|
||||
gateway_session_key=kwargs.get("gateway_session_key"),
|
||||
|
||||
Reference in New Issue
Block a user