fix(honcho): resolve review blockers for merge
Address merge-blocking review feedback by removing unsafe signal handler overrides, wiring next-turn Honcho prefetch, restoring per-directory session defaults, and exposing all Honcho tools to the model surface. Also harden prefetch cache access with public thread-safe accessors and remove duplicate browser cleanup code. Made-with: Cursor
This commit is contained in:
@@ -157,11 +157,11 @@ def cmd_setup(args) -> None:
|
||||
cfg["recallMode"] = new_recall
|
||||
|
||||
# Session strategy
|
||||
current_strat = cfg.get("sessionStrategy", "per-session")
|
||||
current_strat = cfg.get("sessionStrategy", "per-directory")
|
||||
print(f"\n Session strategy options:")
|
||||
print(" per-session — new Honcho session each run, named by Hermes session ID (default)")
|
||||
print(" per-directory — one session per working directory (default)")
|
||||
print(" per-repo — one session per git repository (uses repo root name)")
|
||||
print(" per-directory — one session per working directory")
|
||||
print(" per-session — new Honcho session each run, named by Hermes session ID")
|
||||
print(" global — single session across all directories")
|
||||
new_strat = _prompt("Session strategy", default=current_strat)
|
||||
if new_strat in ("per-session", "per-repo", "per-directory", "global"):
|
||||
@@ -199,6 +199,7 @@ def cmd_setup(args) -> None:
|
||||
print(f" honcho_context — ask Honcho a question about you (LLM-synthesized)")
|
||||
print(f" honcho_search — semantic search over your history (no LLM)")
|
||||
print(f" honcho_profile — your peer card, key facts (no LLM)")
|
||||
print(f" honcho_conclude — persist a user fact to Honcho memory (no LLM)")
|
||||
print(f"\n Other commands:")
|
||||
print(f" hermes honcho status — show full config")
|
||||
print(f" hermes honcho mode — show or change memory mode")
|
||||
@@ -710,10 +711,11 @@ def cmd_migrate(args) -> None:
|
||||
print(" honcho_context — ask Honcho a question, get a synthesized answer (LLM)")
|
||||
print(" honcho_search — semantic search over stored context (no LLM)")
|
||||
print(" honcho_profile — fast peer card snapshot (no LLM)")
|
||||
print(" honcho_conclude — write a conclusion/fact back to memory (no LLM)")
|
||||
print()
|
||||
print(" Session naming")
|
||||
print(" OpenClaw: no persistent session concept — files are global.")
|
||||
print(" Hermes: per-session by default — each run gets a new Honcho session")
|
||||
print(" Hermes: per-directory by default — each project gets its own session")
|
||||
print(" Map a custom name: hermes honcho map <session-name>")
|
||||
|
||||
# ── Step 6: Next steps ────────────────────────────────────────────────────
|
||||
|
||||
@@ -95,7 +95,7 @@ class HonchoClientConfig:
|
||||
# "tools" — no pre-loaded context, rely on tool calls only
|
||||
recall_mode: str = "hybrid"
|
||||
# Session resolution
|
||||
session_strategy: str = "per-session"
|
||||
session_strategy: str = "per-directory"
|
||||
session_peer_prefix: bool = False
|
||||
sessions: dict[str, str] = field(default_factory=dict)
|
||||
# Raw global config for anything else consumers need
|
||||
@@ -201,7 +201,7 @@ class HonchoClientConfig:
|
||||
or raw.get("recallMode")
|
||||
or "hybrid"
|
||||
),
|
||||
session_strategy=raw.get("sessionStrategy", "per-session"),
|
||||
session_strategy=raw.get("sessionStrategy", "per-directory"),
|
||||
session_peer_prefix=raw.get("sessionPeerPrefix", False),
|
||||
sessions=raw.get("sessions", {}),
|
||||
raw=raw,
|
||||
|
||||
@@ -103,6 +103,7 @@ class HonchoSessionManager:
|
||||
# Prefetch caches: session_key → last result (consumed once per turn)
|
||||
self._context_cache: dict[str, dict] = {}
|
||||
self._dialectic_cache: dict[str, str] = {}
|
||||
self._prefetch_cache_lock = threading.Lock()
|
||||
self._dialectic_reasoning_level: str = (
|
||||
config.dialectic_reasoning_level if config else "low"
|
||||
)
|
||||
@@ -496,18 +497,26 @@ class HonchoSessionManager:
|
||||
def _run():
|
||||
result = self.dialectic_query(session_key, query)
|
||||
if result:
|
||||
self._dialectic_cache[session_key] = result
|
||||
self.set_dialectic_result(session_key, result)
|
||||
|
||||
t = threading.Thread(target=_run, name="honcho-dialectic-prefetch", daemon=True)
|
||||
t.start()
|
||||
|
||||
def set_dialectic_result(self, session_key: str, result: str) -> None:
|
||||
"""Store a prefetched dialectic result in a thread-safe way."""
|
||||
if not result:
|
||||
return
|
||||
with self._prefetch_cache_lock:
|
||||
self._dialectic_cache[session_key] = result
|
||||
|
||||
def pop_dialectic_result(self, session_key: str) -> str:
|
||||
"""
|
||||
Return and clear the cached dialectic result for this session.
|
||||
|
||||
Returns empty string if no result is ready yet.
|
||||
"""
|
||||
return self._dialectic_cache.pop(session_key, "")
|
||||
with self._prefetch_cache_lock:
|
||||
return self._dialectic_cache.pop(session_key, "")
|
||||
|
||||
def prefetch_context(self, session_key: str, user_message: str | None = None) -> None:
|
||||
"""
|
||||
@@ -519,18 +528,26 @@ class HonchoSessionManager:
|
||||
def _run():
|
||||
result = self.get_prefetch_context(session_key, user_message)
|
||||
if result:
|
||||
self._context_cache[session_key] = result
|
||||
self.set_context_result(session_key, result)
|
||||
|
||||
t = threading.Thread(target=_run, name="honcho-context-prefetch", daemon=True)
|
||||
t.start()
|
||||
|
||||
def set_context_result(self, session_key: str, result: dict[str, str]) -> None:
|
||||
"""Store a prefetched context result in a thread-safe way."""
|
||||
if not result:
|
||||
return
|
||||
with self._prefetch_cache_lock:
|
||||
self._context_cache[session_key] = result
|
||||
|
||||
def pop_context_result(self, session_key: str) -> dict[str, str]:
|
||||
"""
|
||||
Return and clear the cached context result for this session.
|
||||
|
||||
Returns empty dict if no result is ready yet (first turn).
|
||||
"""
|
||||
return self._context_cache.pop(session_key, {})
|
||||
with self._prefetch_cache_lock:
|
||||
return self._context_cache.pop(session_key, {})
|
||||
|
||||
def get_prefetch_context(self, session_key: str, user_message: str | None = None) -> dict[str, str]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user