Skip to content

[Regression] WebChat: reasoning_content not streamed for Kimi Code & DeepSeek Reasoner — only MiniMax works #88079

Closed

Description

@xx1170822819

Bug Summary

In OpenClaw WebChat, the reasoning/thinking stream from Kimi Code (kimi/kimi-for-coding, Anthropic API) and DeepSeek Reasoner (deepseek/deepseek-reasoner, OpenAI-format reasoning_content) is not rendered at all (or not streamed).
MiniMax (minimax/MiniMax-M2.7-highspeed) works correctly with the same setup.

Desired Behavior

  1. Reasoning should be streamed (character-by-character / chunk-by-chunk) as it arrives from the model.
  2. Reasoning should appear before the final answer — the WebChat UI should show the thinking process first, then transition to the visible reply, matching MiniMax’s behavior.

Actual Behavior

  • Kimi Code: No reasoning UI is shown. Only the final answer appears after a long silent wait. The response definitely contains <thinking> blocks (visible in raw Anthropic stream), but WebChat never extracts or renders them.
  • DeepSeek Reasoner: The reasoning_content field is completely ignored. Only the content (final answer) is displayed, again after a silent delay.
  • MiniMax: Works perfectly — reasoning is mixed into the content stream and is rendered in real time.

Root-Cause Analysis (User-Side Investigation)

  1. Missing resolveReasoningOutputMode hook in the bundled kimi-coding plugin:
    • File: node_modules/openclaw/dist/extensions/kimi-coding/index.js
    • The plugin registers resolveThinkingProfile and wrapStreamFn, but does not define resolveReasoningOutputMode.
    • MiniMax does declare resolveReasoningOutputMode: () => "native", which allows extractThinkingCached() to classify and extract reasoning.
  2. WebChat extractThinkingCached() does not handle reasoning_content field for providers that return it as a separate field (DeepSeek, OpenAI-compatible). It seems to only handle MiniMax’s inline reasoning or explicitly tagged blocks.
  3. Kimi Code Anthropic <thinking> blocks are returned as XML in the content field. The plugin lacks a replay-family hook (e.g., buildHybridAnthropicOrOpenAIReplayPolicy) that would split <thinking> from <text> blocks, unlike MiniMax.

Steps to Reproduce

  1. Configure kimi/kimi-for-coding (requires KIMI_API_KEY, anthropic-messages API, https://api.kimi.com/coding/).
  2. Enable thinking (defaultLevel: "low" — currently requires editing node_modules/openclaw/dist/extensions/kimi-coding/index.js because the default is "off").
  3. Open WebChat, send any prompt (e.g., "鸡兔同笼问题").
  4. Observe: no reasoning stream appears, only the final answer after ~14 s.
  5. Repeat with deepseek/deepseek-reasoner — same silent result.
  6. Switch to minimax/MiniMax-M2.7-highspeed — reasoning streams immediately.

Environment

  • OpenClaw version: 2026.5.27 (27ae826)
  • OS: macOS arm64
  • Node: v25.x
  • Kimi Code config:
    {
      "models.providers.kimi": {
        "baseUrl": "https://api.kimi.com/coding/",
        "api": "anthropic-messages",
        "apiKey": "${KIMI_API_KEY}",
        "models": [{ "id": "kimi-for-coding", "reasoning": true }]
      }
    }
  • DeepSeek config:
    {
      "models.providers.deepseek": {
        "baseUrl": "https://api.deepseek.com/v1",
        "api": "openai-completions",
        "models": [{ "id": "deepseek-reasoner", "reasoning": true }]
      }
    }

Workarounds Tried

  • Thinking default hack: Changed defaultLevel from "off" to "low" in compiled extensions/kimi-coding/index.js and extensions/moonshot/index.js. This enables the upstream request, but the response is still not parsed for reasoning.
  • System-prompt injection: Forcing the model to emit reasoning inside the content field works (visible in UI) but wastes billed tokens and context window. Not a viable production fix.

Related Issues

Suggested Fix

  1. Add resolveReasoningOutputMode: () => "native" (or appropriate mode) to kimi-coding and moonshot provider hooks.
  2. Update WebChat extractThinkingCached() (or equivalent stream pre-processor) to:
    • Parse OpenAI-format reasoning_content field (DeepSeek).
    • Parse Anthropic-format <thinking> XML blocks (Kimi Code).
  3. Ensure the extracted reasoning is emitted as a separate, preceding stream so it renders before the final answer content, matching MiniMax UX.

Activity

  1. clawsweeper commented on May 29, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work. Reviewed October 7, 2026, 9:17 AM ET / 13:17 UTC.

    Summary
    Current main still lacks a WebChat consumer for live thinking events, and an open closing PR already owns the repair. The September Feishu report adds useful upstream evidence but does not establish the same defect.

    Likely related people: steipete and shakkernerd, as routing candidates from recent Control UI maintenance and refactoring.

    Reproducibility: yes. for the shared WebChat defect: an admitted thinking event reaches a reducer with no display consumer. This was established from source; live Kimi, DeepSeek and Feishu reproduction was not performed.

    Next step
    Resolve the existing linked repair through review and landing or closure before dispatching another fix PR.

    Review details

    Best possible solution:

    Render authorized, run-scoped thinking through the existing WebChat projection and visibility controls, preserving history policy and validating any remaining provider-specific failure separately.

    Do we have a high-confidence way to reproduce the issue?

    Yes, for the shared WebChat defect: an admitted thinking event reaches a reducer with no display consumer. This was established from source; live Kimi, DeepSeek and Feishu reproduction was not performed.

    Is this the best way to solve the issue?

    Yes, the linked repair's provider-agnostic UI boundary is the narrowest supported direction; adding provider hooks alone cannot fix a browser that discards normalized thinking events.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The newer Feishu observation is not explained by the browser reducer defect; current Kimi and DeepSeek provider behavior remains unverified.

    Codex review notes: model internal, reasoning medium; reviewed against 7a75498beb6e.

    Label changes

    Label changes:

    No label changes.

    Label justifications:

    • P2: Live reasoning display is broken, but final answers remain available and an existing repair owns the bounded UI defect.
    • impact:ux-friction: Users wait without visible reasoning progress despite upstream thinking events.
    Evidence reviewed

    What I checked:

    • Current main and clean checkout: The checkout is main at the fetched target revision, and status remained clean after read-only inspection. (7a75498beb6e)
    • Live thinking is discarded by the browser reducer: The browser agent-event entrypoint calls handleAgentEvent and returns. Its handlers cover usage, notices, status, preambles and activity items; thinking reaches the non-tool return without creating a display projection. Searching ui/src found no explicit thinking-stream consumer. (ui/src/pages/chat/tool-stream.ts:555, 7a75498beb6e)
    • Actual browser event entrypoint: Agent and session-tool events are dispatched to the reducer; the branch returns even when the reducer reports that it did not handle the event. (ui/src/pages/chat/chat-state-events.ts:671, 7a75498beb6e)
    • Gateway already supports normalized thinking traffic: The Gateway recognizes assistant and thinking text streams and forwards their buffered payloads. This establishes a shared rendering defect without assuming a provider-specific parsing failure. (src/gateway/server-chat.ts:1064, 7a75498beb6e)
    • Reasoning parsing exists upstream: The completions transport constructs thinking blocks and emits thinking_delta events. Its inspected regression coverage supplies reasoning_content and expects a thinking delta, so the report's blanket claim that this field is ignored is not an accurate description of current source. Tests were read, not executed. (packages/ai/src/transports/openai-completions-stream.ts:191, 7a75498beb6e)
    • Existing visibility contract: Reasoning generation and display are separate controls. Current docs define stream previews and explicitly keep saved Control UI reasoning hidden in stream mode; the rendering repair should preserve that history policy. Public docs: docs/tools/thinking.md. (docs/tools/thinking.md:150, 7a75498beb6e)

    Likely related people:

    • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
    • shakkernerd: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. xx1170822819 commented on May 29, 2026

    @xx1170822819
    Author

    补充一个关键的 UX 观察:

    即使实际总耗时接近(DeepSeek ~10s, MiniMax ~14s),感知速度差异巨大:

    • MiniMax:reasoning 和 content 混在一起立刻开始流式显示,用户感知的 TTFT(首 token 时间)几乎是 0.5s 以内,感觉非常快。
    • Kimi Code / DeepSeek:reasoning 内容被静默丢弃,用户只能干等最终答案。感知的 TTFT 变成了 10-14s,在用户体验层面把模型速度劣化了 20 倍。

    这意味着这个 bug 不只是一个"显示问题"——它直接让支持 reasoning 的模型在 WebChat 里的交互体验变得极差,用户会误以为模型"卡住了"或"响应很慢",而切换到 MiniMax 后体验天差地别。

    强烈建议提升优先级,因为随着越来越多的模型支持 reasoning(Kimi K2.5, DeepSeek R1, Kimi Code 等),这个 UX regression 的影响面会越来越大。

  3. xx1170822819 commented on May 29, 2026

    @xx1170822819
    Author

    更正/补充:

    我之前的"感知速度"分析有误。经过在 OpenClaw 终端(非 WebChat) 的实际对比测试,发现:

    1. MiniMax 确实也在做 reasoning,但终端会先把 reasoning 内容输出到对话框,随后删除/清理,只保留最终答案。这给人"秒回"的错觉,但真正的结论是——
    2. 从最终结论输出来看,MiniMax 的实际速度确实比 Kimi Code 和 DeepSeek Reasoner 更快。

    所以 WebChat 的问题(reasoning 不渲染)和模型本身的推理速度是两个独立的问题:

    • WebChat bug:Kimi Code / DeepSeek 的 reasoning 完全不显示(应该修)。
    • 模型速度差异:MiniMax 本身端到端更快(这是模型/serving 层面的差异,不是 OpenClaw 的 bug)。

    如果 maintainer 需要,我可以提供同一道题(鸡兔同笼)在终端下三个模型的完整耗时日志对比。

  4. openclaw-barnacle commented on Jun 15, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  5. added
    stale
    on Jun 15, 2026
  6. added
    P2
    impact:message-loss
    impact:auth-provider
    issue-rating: 🦐 gold shrimp
    clawsweeper:needs-info
    clawsweeper:no-new-fix-pr
    clawsweeper:needs-maintainer-review
    clawsweeper:needs-product-decision
    on Jun 15, 2026
  7. removed
    stale
    on Jun 16, 2026
  8. removed
    clawsweeper:needs-info
    on Jun 19, 2026
  9. 39 remaining items

  10. added
    clawsweeper:linked-pr-open
    clawsweeper:no-new-fix-pr
    and removed
    impact:message-loss
    on Aug 9, 2026
  11. tiangle commented on Sep 2, 2026

    @tiangle

    Adding channel-side confirmation of the same root cause, with deeper evidence that this is not UI-only (WebChat) but happens at the streaming-parse layer.

    Environment

    • OpenClaw 2026.8.2, Node 22.23.2, Linux x64
    • Channel: Feishu (websocket), plugin @openclaw/[email protected]
    • Model: deepseek/deepseek-v4-pro (V4, not deepseek-reasoner)
    • Config: agents.defaults.reasoningDefault: "stream", model compat.thinkingFormat: "deepseek"

    Key evidence — the reasoning text never reaches the channel plugin

    I added temporary logging in the Feishu reply dispatcher. onReasoningEnd fires, but onReasoningStream is never called:

    [feishu-debug] reasoning diag {"streamingEnabled":true,"previewStreamingEnabled":true,"allowReasoningPreview":true,"reasoningPreviewEnabled":true,"renderMode":"auto"}
    [feishu-debug] onReasoningEnd called
    [feishu-debug] onReasoningEnd called
    

    So the reasoning start/end lifecycle signals are emitted, but no thinking_delta stream event (with text) is produced. This is upstream of WebChat's extractThinkingCached() — the channel-level onReasoningStream callback receives nothing.

    Supporting facts

    1. Direct call to https://api.deepseek.com/chat/completions (stream:true) returns delta.reasoning_content (~55 chars for a trivial prompt).
    2. openclaw agent --json reports reasoningTokens: 28 — usage stats are counted correctly.
    3. The assistant message in transcript_events does contain a thinking block with the full reasoning text — it is recorded post-hoc, not streamed live.

    Note on thinkingFormat
    Setting models.providers.deepseek.models[].compat.thinkingFormat: "deepseek" fixed reasoningTokens (0 → 28) and transcript recording, but did not restore live thinking_delta streaming. So the request-side DeepSeek wrapper handles replay/usage, while the response-side reasoning_content → thinking_delta mapping is what appears to be missing.

    Hope this helps narrow it down — the fix likely belongs in the openai-completions stream parser (mapping delta.reasoning_content to a thinking_delta event), which would cover both WebChat and channel streaming.

  12. Boris-c commented on Oct 8, 2026

    @Boris-c

    Still reproducible on 2026.9.8, and the current latest (2026.9.9) and 2026.10.1-beta.2 packages show the same gap. Adding a local-model data point:

    Setup

    • Provider: LM Studio, api: "openai-completions", Qwen3.5-9B model with reasoning: true
    • Agent: reasoningDefault: "stream", thinkingDefault: "adaptive"; agents.defaults.blockStreamingDefault: "on", blockStreamingBreak: "text_end"
    • ui.prefs.chatShowThinking: true
    • Channel: Control UI WebChat

    Observed: reasoning only appears after the full reply is finished (from the stored transcript), never live.

    What I checked, layer by layer

    1. LM Studio streams delta.reasoning_content token by token (verified with a raw curl SSE request).
    2. @openclaw/ai openai-completions-stream turns those into thinking_start / thinking_delta events.
    3. The embedded runner calls emitReasoningStream → emitAgentEvent({ stream: "thinking", data: { text, delta } }).
    4. server-chat forwards agent events with stream === "thinking" to Control UI clients (coalesced via resolveAgentTextThrottleStream).
    5. In the shipped Control UI bundle, the chat agent-event handler only branches on run_status, assistant, compaction, lifecycle and fallback. I found no consumer of stream === "thinking" in any dist/control-ui/assets/*.js for 2026.9.8, 2026.9.9 or 2026.10.1-beta.2.

    So for this route, the backend appears to deliver live thinking and the WebChat client drops it. That matches #117721 ("render live thinking agent events in WebChat"), which is still open. Is anything blocking it?

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

    P2clawsweeper:linked-pr-openclawsweeper:no-new-fix-prclawsweeper:source-reproimpact:ux-frictionissue-rating: 🦞 diamond lobster

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions