Skip to content

fix: preserve empty reasoning across providers - #1676

Merged
RealKai42 merged 1 commit into
mainfrom
kaiyi/investigate-empty-thinking-error
Jul 14, 2026
Merged

fix: preserve empty reasoning across providers#1676
RealKai42 merged 1 commit into
mainfrom
kaiyi/investigate-empty-thinking-error

Conversation

@RealKai42

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue; this fixes user-reported provider failures when a model returns an explicitly empty reasoning block before a tool call.

Problem

Provider adapters treated empty reasoning strings as absent. The next multi-step request therefore omitted the reasoning field or block, which reasoning-enabled backends can reject during protocol validation.

What changed

  • Preserve explicitly empty reasoning blocks across the Kimi, OpenAI-compatible, Google/Vertex, Anthropic-compatible, and OpenAI Responses adapters in both agent engines.
  • Replay empty reasoning on subsequent requests while retaining native provider constraints, including Claude signature requirements and Google thought signatures.
  • Add regression coverage for streaming, non-streaming, and multi-step tool-call histories; absent reasoning remains absent.
  • Add a patch changeset for the CLI bundle. No user documentation update is needed because commands, configuration, and interaction flows are unchanged.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 73b1535

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@RealKai42
RealKai42 marked this pull request as ready for review July 14, 2026 06:13
@pkg-pr-new

pkg-pr-new Bot commented Jul 14, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@73b1535
npx https://pkg.pr.new/@moonshot-ai/kimi-code@73b1535

commit: 73b1535

@RealKai42
RealKai42 merged commit d1820ff into main Jul 14, 2026
16 checks passed
@RealKai42
RealKai42 deleted the kaiyi/investigate-empty-thinking-error branch July 14, 2026 06:30
@github-actions github-actions Bot mentioned this pull request Jul 14, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Jul 15, 2026
7723qqq added a commit to 7723qqq/kimi-code that referenced this pull request Jul 15, 2026
…oonshotAI#1676 MoonshotAI#1625 MoonshotAI#1746 MoonshotAI#1753 MoonshotAI#1757)

Critical fixes cherry-picked from upstream v0.24.x:
- fix(agent-core-v2): align rate-limit retries with v1 (MoonshotAI#1598)
- fix: preserve empty reasoning across providers (MoonshotAI#1676)
- fix: resolve and synchronize thinking effort (MoonshotAI#1625)
- fix: align Anthropic-compatible model capabilities (MoonshotAI#1746)
- fix(kap-server): close auth bypass via percent-encoded API paths (MoonshotAI#1753)
- fix: preserve the crash error in diagnostic logs on unexpected exit (MoonshotAI#1757)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant