From e492420df4570bd620f43b74129a25223c1d120f Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Fri, 3 Apr 2026 10:31:53 -0700 Subject: [PATCH] fix: route memory provider tools in sequential execution path (#4803) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Memory provider tools (hindsight_retain, honcho_search, etc.) were advertised to the model via tool schemas but failed with 'Unknown tool' at execution time. The concurrent path (_invoke_tool) correctly checks self._memory_manager.has_tool() before falling through to the registry, but the sequential path (_execute_tool_calls_sequential) was never updated with this check. Since sequential is the default for single tool calls, memory provider tools always hit the registry dispatcher which returns 'Unknown tool' because they're not registered there. Add the memory_manager dispatch check between the delegate_task handler and the quiet_mode fallthrough in the sequential path, with proper spinner/display handling to match the existing pattern. Reported by KiBenderOP — all memory providers affected (Honcho, Hindsight, Holographic, etc.). --- run_agent.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/run_agent.py b/run_agent.py index e18932d36..bc05ef845 100644 --- a/run_agent.py +++ b/run_agent.py @@ -6009,6 +6009,30 @@ class AIAgent: spinner.stop(cute_msg) elif self.quiet_mode: self._vprint(f" {cute_msg}") + elif self._memory_manager and self._memory_manager.has_tool(function_name): + # Memory provider tools (hindsight_retain, honcho_search, etc.) + # These are not in the tool registry — route through MemoryManager. + spinner = None + if self.quiet_mode and not self.tool_progress_callback: + face = random.choice(KawaiiSpinner.KAWAII_WAITING) + emoji = _get_tool_emoji(function_name) + preview = _build_tool_preview(function_name, function_args) or function_name + spinner = KawaiiSpinner(f"{face} {emoji} {preview}", spinner_type='dots', print_fn=self._print_fn) + spinner.start() + _mem_result = None + try: + function_result = self._memory_manager.handle_tool_call(function_name, function_args) + _mem_result = function_result + except Exception as tool_error: + function_result = json.dumps({"error": f"Memory tool '{function_name}' failed: {tool_error}"}) + logger.error("memory_manager.handle_tool_call raised for %s: %s", function_name, tool_error, exc_info=True) + finally: + tool_duration = time.time() - tool_start_time + cute_msg = _get_cute_tool_message_impl(function_name, function_args, tool_duration, result=_mem_result) + if spinner: + spinner.stop(cute_msg) + elif self.quiet_mode: + self._vprint(f" {cute_msg}") elif self.quiet_mode: spinner = None if not self.tool_progress_callback: