[Bug]: send_tool_hints=False 时 bridge 层仍写 INFO 日志(配置未贯穿)

Author: ouyinghuiCreated Aug 27, 2026Updated Aug 27, 2026
Labelsbug

What happened?

描述

gateway.json 配置 "send_tool_hints": false 后,channel 层正确遵守(IM 不显示 tool_hint 进度提示),但 bridge.py 的 outbound 日志未检查此配置,每次工具调用仍写一条 logger.info("ohmo outbound update ... kind=tool_hint ...")

Steps to reproduce

期望行为

send_tool_hints: false 时,tool_hint 应完全静默:不推 IM、不写 INFO 日志(最多 DEBUG)。

实际行为

gateway.json

json
"send_tool_hints": false

日志(每次工具调用都出现)

bash
[ohmo.gateway.runtime] INFO ohmo runtime tool start ... tool=bash summary="..."
[ohmo.gateway.bridge]  INFO ohmo outbound update ... kind=tool_hint content="️ 正在使用 bash: ..."

IM 里看不到 tool_hint(channel 层过滤了),但日志里有,造成:

  1. 日志噪音(一次对话 5 个工具 = 5 条无用 INFO)
  2. 配置与行为不一致(配了 False 但日志暗示被"处理"了)
  3. 排查误导(看到 outbound update 以为 IM 发了)

Environment

  • Python: 3.12
  • 日志级别: INFO(默认)
  • 发现场景: 飞书 IM 通道,gateway 模式

Relevant logs or screenshots

定位

ohmo/gateway/bridge.pyOhmoGatewayBridge._process_message() 方法,async for update in self._runtime_pool.stream_message(...) 循环内,对所有非 final 的 update 统一写 logger.info + publish_outbound,未区分 kind="tool_hint" 且未检查 send_tool_hints 配置。

建议修复

方案 A(最小改):tool_hint 降为 DEBUG

bridge.py, _process_message() 内

python
if update.kind == "tool_hint":
    logger.debug(
        "ohmo outbound update channel=%s chat_id=%s session_key=%s kind=%s content=%r",
        message.channel, message.chat_id, session_key,
        update.kind, _content_snippet(update.text),
    )
else:
    logger.info(
        "ohmo outbound update channel=%s chat_id=%s session_key=%s kind=%s content=%r",
        message.channel, message.chat_id, session_key,
        update.kind, _content_snippet(update.text),
    )

方案 B(配置贯穿):send_tool_hints=False 时完全跳过

python
if update.kind == "tool_hint" and not self._send_tool_hints:
    continue

不影响的功能

路径 是否受影响
kind="error"(如 "API error: Request timed out.") ❌ 不受影响,直接推 IM
kind="final"(最终回复) ❌ 不受影响
kind="tool_hint" 的 IM 显示 ❌ 本来就 False 不显示
kind="tool_hint" 的日志 ✅ 降为 DEBUG 或跳过(本 issue 修复目标)

我的 OHMO 个人助理 — 稳健小子 [steady])提交。