fix(honcho): surface honcho_reasoning backend failures instead of 'No result'
dialectic_query collapsed every backend failure to an empty string, so the explicit honcho_reasoning tool rendered timeouts, server errors, and genuinely-empty answers identically as 'No result from Honcho.' (#36098 issue 4). Operators debugging 'search works but reasoning does not' were sent down representation/observation rabbit holes when the real cause was a 30s timeout on a medium-reasoning dialectic call. Add raise_errors to dialectic_query (default false — automatic injection keeps its fail-quiet behavior and cadence backoff) and pass it from the explicit tool call, returning a tool error that names the failure and points at the timeout knob. Auth errors keep their dedicated handler.
This commit is contained in:
@@ -1527,13 +1527,31 @@ class HonchoMemoryProvider(MemoryProvider):
|
||||
return tool_error("Missing required parameter: query")
|
||||
peer = args.get("peer", "user")
|
||||
reasoning_level = args.get("reasoning_level")
|
||||
result = self._manager.dialectic_query(
|
||||
self._session_key, query,
|
||||
reasoning_level=reasoning_level,
|
||||
peer=peer,
|
||||
# Explicit reasoning bypasses the automatic-injection cap.
|
||||
apply_injection_cap=False,
|
||||
)
|
||||
try:
|
||||
result = self._manager.dialectic_query(
|
||||
self._session_key, query,
|
||||
reasoning_level=reasoning_level,
|
||||
peer=peer,
|
||||
# Explicit reasoning bypasses the automatic-injection cap.
|
||||
apply_injection_cap=False,
|
||||
# Explicit tool call: surface timeouts/server errors as
|
||||
# errors instead of collapsing them into "no result",
|
||||
# which is indistinguishable from an empty answer.
|
||||
raise_errors=True,
|
||||
)
|
||||
except HonchoAuthError:
|
||||
# Let the outer dispatch's auth-specific handler render this.
|
||||
raise
|
||||
except Exception as e:
|
||||
logger.warning("honcho_reasoning failed: %s", e)
|
||||
return tool_error(
|
||||
f"Honcho reasoning query failed ({e}). This is a backend "
|
||||
"error, not an empty result — the peer may still have "
|
||||
"relevant context. Slow dialectic calls at higher "
|
||||
"reasoning levels can exceed the configured timeout; "
|
||||
"consider a lower reasoning_level or raising the "
|
||||
"'timeout' value in honcho.json."
|
||||
)
|
||||
# Update cadence tracker so auto-injection respects the gap after an explicit call
|
||||
self._last_dialectic_turn = self._turn_count
|
||||
return json.dumps({"result": result or "No result from Honcho."})
|
||||
|
||||
@@ -844,6 +844,7 @@ class HonchoSessionManager:
|
||||
reasoning_level: str | None = None,
|
||||
peer: str = "user",
|
||||
apply_injection_cap: bool = True,
|
||||
raise_errors: bool = False,
|
||||
) -> str:
|
||||
"""
|
||||
Query Honcho's dialectic endpoint about a peer.
|
||||
@@ -862,6 +863,11 @@ class HonchoSessionManager:
|
||||
apply_injection_cap: Clip automatic injections to
|
||||
``dialecticMaxChars``. Explicit ``honcho_reasoning`` calls pass
|
||||
False because Honcho already bounds their output.
|
||||
raise_errors: Re-raise backend failures instead of returning "".
|
||||
Explicit tool calls pass True so a timeout or server error
|
||||
surfaces as an error, not as "no result" (#36098 issue 4:
|
||||
collapsing failures to "" made auth errors, timeouts, and
|
||||
genuinely-empty answers indistinguishable).
|
||||
|
||||
Returns:
|
||||
Honcho's synthesized answer, or empty string on failure.
|
||||
@@ -917,6 +923,8 @@ class HonchoSessionManager:
|
||||
raise
|
||||
except Exception as e:
|
||||
logger.warning("Honcho dialectic query failed: %s", e)
|
||||
if raise_errors:
|
||||
raise
|
||||
return ""
|
||||
|
||||
def prefetch_context(self, session_key: str, user_message: str | None = None) -> None:
|
||||
|
||||
Reference in New Issue
Block a user