Skip to content

Bug: 模型的 Think/Reasoning 内容被错误泄露给用户 #49438

Closed

Description

@gzsiang

Bug: 模型的 Think/Reasoning 内容被错误泄露给用户

问题描述

当使用配置了 reasoning: true 的模型(如 qwen/qwen3.5-35b-a3b)时,模型的 thinking/reasoning 内容被错误地输出到了用户可见的回复中。

复现步骤

  1. 配置模型并设置 "reasoning": true
  2. 向 Agent 提问
  3. Agent 的回复中会包含类似以下内容:

"主人说理解了解决方案,我应该确认 SearXNG 功能正常,用轻松的语气回应并询问是否需要其他帮助。"

这类内容明显是模型的 internal thinking 过程,不应该暴露给用户。

环境信息

  • OpenClaw 版本:2026.3.13
  • 模型:5600x-local/qwen/qwen3.5-35b-a3b
  • 配置文件模型设置:"reasoning": true

预期行为

模型的 reasoning/thinking 内容应该被自动过滤,只向用户展示最终的回复内容。

实际行为

Think 内容被直接输出到用户可见的回复中。


临时绕过方案:将模型的 reasoning 设为 false。需要说明的是,这只是不展示思考过程,模型仍然会深度思考,回复质量不受影响。

Activity

  1. Hollychou924 commented on Mar 18, 2026

    @Hollychou924
  2. gzsiang commented on Mar 18, 2026

    @gzsiang
    Author

    Thanks for the detailed analysis! I understand the issue now - the OpenRouter-proxied Qwen models use a different format that wasn't being filtered. Looking forward to the fix in the next release!

  3. steipete commented on Apr 25, 2026

    @steipete
    Contributor

    Closing this as implemented after Codex review.

    Current main already has the reasoning-leak fix: reply delivery now prefers final_answer text, suppresses commentary-phase output, and strips/promotes <think>-style reasoning so it does not reach user-visible replies. The changelog says this shipped in v2026.4.5.

    What I checked:

    • Release note for shipped fix: CHANGELOG.md records the relevant fix under release 2026.4.5: OpenAI/reply delivery now adds assistant phase metadata and keeps commentary buffered until final_answer so visible surfaces stop leaking planning text. (CHANGELOG.md:1240)
    • Visible-text extraction prefers final answers: Current shared extraction returns final_answer text first and only falls back when phased final text is absent, preventing legacy/unphased text from reviving leaked planning content. (src/shared/chat-message-content.ts:182, f3c37a946cc4)
    • Streaming path suppresses commentary output: The embedded reply handler exits immediately for commentary phase updates before assembling visible block replies, so commentary text is not emitted to users. (src/agents/pi-embedded-subscribe.handlers.messages.ts:471, f3c37a946cc4)
    • Tagged reasoning is stripped/promoted out of visible text: OpenClaw strips <think>, <thinking>, <thought>, and related tags from visible text, and also promotes embedded think-tag text blocks into separate thinking blocks before final delivery. (src/shared/text/reasoning-tags.ts:20, f3c37a946cc4)
    • Regression coverage matches this leak class: Tests now cover suppressing commentary partials, avoiding fallback to empty final_answer leaks, and stripping <think> blocks from visible text. (src/agents/pi-embedded-subscribe.handlers.messages.test.ts:481, f3c37a946cc4)

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review notes: reviewed against f3c37a946cc4; fix evidence: release v2026.4.5.

  4. locked as resolved and limited conversation to collaborators on Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions