Skip to content

[honcho] honcho_conclude 工具在初始化失败后无法重试 #8920

@Fengqx2022

Description

@Fengqx2022

问题描述

当 Honcho 内存插件初始化失败后(比如网络超时、API 连接错误),honcho_conclude 等工具会返回错误:

Honcho session could not be initialized.

但此时 Honcho 服务可能已经恢复正常,用户无法通过重试来成功执行工具。

根因分析

plugins/memory/honcho/__init__.py 中:

  1. 初始化失败时(第 272-274 行):

    except Exception as e:
        logger.warning("Honcho init failed: %s", e)
        self._manager = None

    只设置了 _manager = None,但 _session_initialized 保持默认的 False

  2. 工具调用时(第 653-655 行):

    if not self._session_initialized:
        if not self._ensure_session():
            return tool_error("Honcho session could not be initialized.")
  3. _ensure_session() 检查(第 329-330 行):

    if not self._config or not self._lazy_init_kwargs:
        return False

    由于 recall_mode 不是 "tools",_lazy_init_kwargs 没有被设置,直接返回 False

期望行为

两种修复方案:

  1. 方案A:初始化失败后,不要立即标记为"未初始化",而是允许 _ensure_session() 在下次调用时重试
  2. 方案B:在工具错误信息中提示用户可以重试,而不是直接返回失败

环境信息

  • Hermes 版本:最新
  • Honcho 配置:recall_mode = hybrid
  • 错误日志示例:
    2026-04-13 13:19:39 WARNING plugins.memory.honcho: Honcho init failed: Connection error: [Errno 111] Connection refused
    

复现步骤

  1. 在 Honcho 服务未启动时启动 Hermes(会导致初始化失败)
  2. 启动 Honcho 服务
  3. 调用 honcho_conclude 工具
  4. 工具返回 "Honcho session could not be initialized."

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/pluginsPlugin system and bundled pluginstool/memoryMemory tool and memory providerstype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions