Skip to content

[Bug]: reasoning_content leaks into chat output with moonshot/kimi-k2.6, frontend reasoning status out of sync #96732

Closed as not planned

Description

@BaichouRiver

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When using the moonshot/kimi-k2.6 model via the OpenClaw web gateway, internal reasoning text from the model is not filtered or separated. It is directly concatenated with the formal response and displayed to end users, resulting in visible internal monologue, self-questioning and step-by-step thinking mixed into the final answer.

Additionally, the frontend status label shows Reasoning: off, but reasoning content is still output. The frontend display is not synchronized with the actual parameters sent to the Moonshot API.

Steps to reproduce

Add and configure moonshot/kimi-k2.6 with default settings in OpenClaw.
Open the web gateway chat interface.
Send any question that requires reasoning (e.g. a logic or analysis question).
Observe the streaming output and the final rendered message.

Expected behavior

The reasoning_content field from the Moonshot API response should be hidden from users. Only the formal content field should be rendered in the chat.
When the frontend shows Reasoning: off, the parameter thinking: {"type": "disabled"} should actually be passed to the Moonshot API, and no reasoning content should be generated at all.

Actual behavior

Both reasoning content and formal answer are concatenated together and shown as a single message, with visible internal thought process (self-correction, repeated confirmation, verbose analysis) mixed into the reply.
The frontend label indicates reasoning is disabled, but reasoning content still appears in the output.

OpenClaw version

2026.6.10

Operating system

Window11

Install method

No response

Model

moonshot/kimi-k2.6

Provider / routing chain

gateway

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

According to the official Moonshot Kimi K2.6 API documentation, reasoning content is returned in the separate reasoning_content field, and the formal response is in the content field. The two fields are completely separated in the raw API response, so this issue is caused by missing field-filtering logic on the gateway side.

Temporary workaround: Manually add "thinking": {"type": "disabled"} to the model params in the config file to disable reasoning entirely at the model level.

Screenshot of the abnormal output is attached below.

Activity

  1. clawsweeper commented on Jun 25, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 25, 2026, 6:02 AM ET / 10:02 UTC.

    Summary
    Keep open: current main and the latest release already send Moonshot thinking: { type: "disabled" } when thinking is off and route structured reasoning_content into hidden thinking blocks, but the reporter's screenshot shows a current-release user-visible monologue and we do not yet have the raw Moonshot stream needed to prove whether this is a parser leak or Kimi emitting reasoning-like prose as normal content.

    Reproducibility: unclear. The reporter provides concrete steps and a screenshot from v2026.6.10, but current source and tests already cover the structured reasoning_content path, so a raw Moonshot stream capture is needed to reproduce the actual current-main failure mode.

    Ways to help us reproduce this

    • Add expected vs actual behavior.
    • Include redacted logs or terminal output.

    Next step
    This should not queue an automated fix until a maintainer or live test captures the raw Moonshot K2.6 stream with thinking disabled and decides whether provider-level inline-content sanitizing is acceptable.

    Security
    Needs attention: The issue is security-sensitive because, if confirmed, hidden reasoning or internal model self-analysis is exposed to end users.

    Review details

    Best possible solution:

    Capture a live or fixture-backed Moonshot K2.6 stream with thinking disabled, then fix only the proven boundary: parser/request handling if reasoning_content leaks, or a narrow provider-owned sanitizer only if Kimi emits a confirmed inline reasoning delimiter as content.

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

    Unclear. The reporter provides concrete steps and a screenshot from v2026.6.10, but current source and tests already cover the structured reasoning_content path, so a raw Moonshot stream capture is needed to reproduce the actual current-main failure mode.

    Is this the best way to solve the issue?

    Unclear. The requested gateway-side field filtering is already present for structured reasoning_content; the safer solution is raw-stream proof first, then a provider/parser fix rather than a broad semantic text stripper.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • No live Moonshot K2.6 request or raw stream capture with thinking: { type: "disabled" } was available, so the exact field shape remains unverified.
    • The screenshot shows visible self-analysis, but it does not prove whether that text arrived in reasoning_content or ordinary content; a broad text stripper could remove legitimate answers.
    • The adjacent open WebChat reasoning visibility issue overlaps the provider/UI area but asks for showing reasoning when enabled, not hiding leaked reasoning when off.

    Codex review notes: model internal, reasoning high; reviewed against 4ecb45bf7729.

    Label changes

    Label changes:

    • add P1: A current-release report of internal reasoning being shown to WebChat users is urgent because it affects user-visible provider/gateway behavior even though raw-stream proof is still needed.
    • add impact:security: The issue is about internal reasoning or model self-analysis being exposed in user-visible chat output.
    • add impact:auth-provider: The failure depends on Moonshot/Kimi provider parameters, reasoning_content handling, and model routing behavior.
    • add issue-rating: 🦐 gold shrimp: Current issue advisory state selects this label.
    • add clawsweeper:needs-info: Current issue advisory state selects this label.
    • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.
    • add clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.
    • add clawsweeper:needs-product-decision: Current issue advisory state selects this label.
    • add clawsweeper:needs-security-review: Current issue advisory state selects this label.

    Label justifications:

    • P1: A current-release report of internal reasoning being shown to WebChat users is urgent because it affects user-visible provider/gateway behavior even though raw-stream proof is still needed.
    • impact:security: The issue is about internal reasoning or model self-analysis being exposed in user-visible chat output.
    • impact:auth-provider: The failure depends on Moonshot/Kimi provider parameters, reasoning_content handling, and model routing behavior.
    Evidence reviewed

    Security concerns:

    • [medium] Potential reasoning disclosure
      The screenshot and report indicate reasoning-like internal monologue can appear in WebChat despite reasoning being off; raw stream proof is needed to identify whether this is a structured-field leak or normal content from the provider.
      Confidence: 0.72

    Acceptance criteria:

    • Capture a redacted live Moonshot K2.6 WebChat or gateway run with thinking: { type: "disabled" } and raw streamed chunks showing reasoning_content versus content.
    • If a parser gap is proven, add focused coverage in src/agents/openai-transport-stream.test.ts and the relevant Moonshot wrapper tests.
    • If WebChat projection is implicated after normalized thinking blocks are produced, add focused coverage in src/gateway/server-methods/chat.directive-tags.test.ts or ui/src/ui/chat/message-extract.test.ts.

    What I checked:

    • Repository policy read: Root AGENTS.md was read fully and applied because this issue touches provider routing, gateway/WebChat behavior, current versus shipped behavior, and a security-sensitive reasoning-disclosure boundary. (AGENTS.md:1, 4ecb45bf7729)
    • Vision fit: VISION.md prioritizes security and safe defaults, bug fixes and stability, and major model-provider support, so a Moonshot reasoning leak belongs in OpenClaw triage. (VISION.md:22, 4ecb45bf7729)
    • Issue screenshot inspected: The reporter's attached screenshot was downloaded to the scratch directory and shows WebChat displaying text such as “Reasoning: off” followed by assistant self-analysis and Chinese text saying reasoning is off; this proves user-visible monologue, but not the raw API field shape.
    • Moonshot contract checked: Official Kimi API docs say Kimi K2.6 thinking is enabled by default, can be disabled with thinking.type = "disabled", and emits reasoning via reasoning_content at the same level as content in streaming responses. (platform.moonshot.ai)
    • Request-side Moonshot thinking mapping: Current main maps an OpenClaw thinking level of off to Moonshot disabled, so the UI status is backed by a provider request path when the session thinking level is actually off. (src/llm/providers/stream-wrappers/moonshot-thinking.ts:135, 4ecb45bf7729)
    • Structured reasoning field separation: Current main reads reasoning_content, reasoning, and reasoning_text from OpenAI-compatible deltas and emits them as kind: "thinking", not normal visible text. (src/agents/openai-transport-stream.ts:3557, 4ecb45bf7729)

    Likely related people:

    • Josh Lehman: Current-line blame for the central Moonshot wrapper, OpenAI-compatible reasoning parser, session thinking default, and shared visible-text helper points to the grafted import commit; this is useful routing but not original feature ownership. (role: snapshot/imported current-line author; confidence: low; commits: 0cdb050bac19; files: src/llm/providers/stream-wrappers/moonshot-thinking.ts, src/agents/openai-transport-stream.ts, src/agents/sessions/sdk.ts)
    • xialonglee: Authored the merged Moonshot reasoning_content assistant tool-call replay backfill PR, which is adjacent to Kimi reasoning_content preservation and request behavior. (role: prior Moonshot reasoning replay contributor; confidence: medium; commits: 0063f3076c17; files: src/llm/providers/stream-wrappers/moonshot-thinking.ts, src/agents/embedded-agent-runner-extraparams-moonshot.test.ts, extensions/moonshot/moonshot.live.test.ts)
    • aniaan: Authored the merged PR that defaulted Moonshot to Kimi K2.6 and added K2.6-only thinking.keep support, directly adjacent to the reported model and setting. (role: prior Moonshot K2.6 contributor; confidence: medium; commits: c8e5150fd49f; files: docs/providers/moonshot.md, src/agents/pi-embedded-runner/moonshot-thinking-stream-wrappers.ts, src/plugin-sdk/provider-stream.ts)
    • vincentkoc: Authored merged Ollama/Kimi Moonshot payload compatibility work, relevant to the broader Kimi reasoning-parameter compatibility class even though this issue is direct Moonshot WebChat. (role: adjacent Kimi compatibility contributor; confidence: medium; commits: 1492ad20a936; files: src/agents/pi-embedded-runner/moonshot-stream-wrappers.ts, src/agents/pi-embedded-runner/extra-params.ts)
    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. BaichouRiver commented on Jun 25, 2026

    @BaichouRiver
    Author
    Image
  3. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.
    impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.
    on Jun 25, 2026
  4. openclaw-barnacle commented on Jul 10, 2026

    @openclaw-barnacle

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

  5. clawsweeper commented on Jul 10, 2026

    @clawsweeper
    Contributor

    ClawSweeper status: review started.

    I am starting a fresh review of this issue: [Bug]: reasoning_content leaks into chat output with moonshot/kimi-k2.6, frontend reasoning status out of sync This is item 1/1 in the current shard. Shard 17/32.

    This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

    Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

  6. openclaw-barnacle commented on Jul 18, 2026

    @openclaw-barnacle

    Closing due to inactivity.
    If this is still an issue, please retry on the latest OpenClaw release and share updated details.
    If you are absolutely sure it still happens on the latest release, open a new issue with fresh steps to reproduce.

  7. locked as resolved and limited conversation to collaborators on Sep 9, 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

    P1High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingclawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:securitySecurity boundary, credential, authz, sandbox, or sensitive-data risk.issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions