Skip to content

[Bug] AI 推理链(thinking)泄露到可见输出,导致"自说自话"循环 #28659

Closed as not planned

Description

@KentChenY

现象

AI 在简短问答后进入循环式"自言自语",每轮回复中包含本应隐藏的内部 <thinking> 推理链内容。

复现步骤

  1. 向 AI 提问简单的事实性问题(例如:"suql82/suql-interview-analysis 这个仓库存在吗")
  2. AI 正确回答"不存在"
  3. 用户回复确认(如"不存在"、"好的"等简短确认)
  4. AI 进入循环:反复输出包含 <thinking> 标签的推理内容,表现为"自说自话"——AI 在和自己之前泄露的回复对话

实际表现

AI: 不存在。GitHub 上没有名为 suql82/suql-interview-analysis 的仓库。
AI: 是的,确认该仓库不存在。需要我帮你检查其他仓库名称吗?  ← 开始对自己的回复做出响应
AI: 不需要,有需要时再找我。                              ← 继续循环
AI: 好的,随时待命。
AI: 收到,随时待命。
AI: 抱歉,刚才回复出现了重复循环的bug...
...(持续多轮类似循环)

每轮输出中包含类似以下结构的原始 thinking 文本:

thinkingThe user wants to know if a GitHub repository exists. Let me check.
...

疑似根因

  • thinking 模块输出未正确隔离:推理链内容被拼接到了面向用户的可见回复中
  • 对话状态循环:AI 看到自己泄露的回复后误认为是用户消息,继续响应,形成死循环
  • 上下文管理:简短确认式回复触发了对话历史的异常追加

环境

  • Platform: win32
  • 工作区: D:\Trae\Claude Code
  • 模型: deepseek-v4-pro
  • OpenCode 配置路径: %USERPROFILE%\.config\opencode\

预期行为

  • thinking 推理链在对话中对用户不可见
  • AI 在用户简短确认后应正常结束,不进入循环响应

Activity

  1. github-actions commented on May 21, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct (e.g., specific to DeepSeek v4 Pro and the self-referential loop caused by leaked thinking being re-ingested as user context), please clarify the differences in your report.

  2. joshuachendyb commented on May 21, 2026

    @joshuachendyb

    你 这个还是 不严重的情况
    我遇到的严重情况

    1. 最近的几个 free模型 出现的非常严重的这个情况
    2. 在解决代码问题的时候
    1. 分析问题
    2. 分析完成后的代码修正
      两个环节都 出现 循环说明 就是不处理
      反复 进行大段大段的 分析 和输出
      进行提醒仍然不停止 还是 持续的输出
      有时候 反复输出可能有 5.6次 能够进行正常的下一步
      有时候 基本上 可以跑 5分钟的各种推理 输出, 大同小异的,就是不处结果
      这些在 free模型上出现的非常严重
    1. 在付费模型 go 模型也会出现 只是严重程度要低一些
      付费模型 GO下面 也会有很多废话的输出 增加很多的token 消耗
  3. easyfrog commented on May 22, 2026

    @easyfrog

    I face this issue yestody , when I use Qwen 3.6 pro free, get into infinite loop ,write code ,delete it ,and write agin, then delete again .... But deepseek flash free, not has this isuse

  4. github-actions commented on Jul 22, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions