Skip to content

fix(provider): auto-enable interleaved reasoning for Kimi K2.6 models#25066

Open
DhtIsCoding wants to merge 1 commit intoanomalyco:devfrom
DhtIsCoding:fix/kimi-k2.6-interleaved-reasoning
Open

fix(provider): auto-enable interleaved reasoning for Kimi K2.6 models#25066
DhtIsCoding wants to merge 1 commit intoanomalyco:devfrom
DhtIsCoding:fix/kimi-k2.6-interleaved-reasoning

Conversation

@DhtIsCoding
Copy link
Copy Markdown

@DhtIsCoding DhtIsCoding commented Apr 30, 2026

Issue for this PR

Closes #20427
Closes #24722
Closes #23646

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When using Kimi K2.6 (and other kimi-k2 models) through OpenCode's Zen or Go providers, the model configuration was missing the interleaved capability that tells OpenCode to preserve reasoning_content in conversation history.

Without this, multi-turn tool-use conversations fail with Moonshot returning:

"thinking is enabled but reasoning_content is missing in assistant tool call message at index N"

This PR:

  1. Auto-detects interleaved reasoning for Kimi models using @ai-sdk/openai-compatible (same pattern as DeepSeek)
  2. Adds missing kimi-k2.6 entries to models-api.json for opencode (Zen) and opencode-go providers

How did you verify your code works?

  • Added test in provider.test.ts verifying custom Kimi models get interleaved: { field: "reasoning_content" } automatically
  • Manually verified model configuration structure matches existing kimi-k2.5 entries
  • Inspected ProviderTransform.message() logic confirms interleaved field triggers reasoning_content preservation on assistant messages

Screenshots / recordings

N/A - This is a backend/provider fix, not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

When using Kimi K2.6 via OpenCode Zen/Go with tool calls, the API requires
reasoning_content to be present on assistant messages. Without it, Moonshot
returns: 'thinking is enabled but reasoning_content is missing in assistant
tool call message'.

Changes:
- Auto-detect kimi-k2 models for interleaved reasoning (like DeepSeek)
- Add kimi-k2.6 to models-api.json for opencode and opencode-go providers
- Add test coverage for Kimi interleaved auto-detection

Fixes anomalyco#20427
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Apr 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

1 participant