Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.

fix(kosong): stop sending Kimi reasoning effort implicitly - #2499

Merged
RealKai42 merged 2 commits into
mainfrom
kaiyi/kimi-reasoning-effort-high
Jul 14, 2026
Merged

RealKai42 merged 2 commits into
mainfrom
kaiyi/kimi-reasoning-effort-high

Conversation

@RealKai42

@RealKai42 RealKai42 commented Jul 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • configure Kimi thinking requests through thinking.type without automatically serializing the legacy reasoning_effort parameter
  • preserve the caller-provided thinking effort exactly as independent provider state, without implicit clamping or reverse mapping from explicit legacy parameters
  • retain explicit reasoning_effort passthrough for older compatible endpoints and add request-level, cloning, and CLI end-to-end regressions
  • document the behavior change and migration path in both English and Chinese release notes

Testing

  • env -u ANTHROPIC_BASE_URL -u ANTHROPIC_API_KEY make test-kosong (294 passed)
  • uv run pytest tests/core/test_create_llm.py tests/core/test_kimisoul_completion_budget.py tests/e2e/test_kimi_empty_tool_call_content_e2e.py -q (45 passed)
  • make check-kosong check-kimi-cli
  • isolated --print --thinking smoke test with request-body and session artifact inspection

Open in Devin Review

…effort-high

# Conflicts:
#	packages/kosong/CHANGELOG.md
#	packages/kosong/tests/api_snapshot_tests/test_kimi.py
#	tests/core/test_create_llm.py
Copilot AI review requested due to automatic review settings July 14, 2026 07:58

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Kosong’s Kimi provider and Kimi Code CLI integration so that “thinking” is controlled via thinking.type (enabled/disabled) without implicitly serializing the legacy reasoning_effort parameter, while keeping explicit legacy passthrough available for older endpoints. It also adds/updates unit and end-to-end regression tests and documents the migration path in English and Chinese release notes.

Changes:

  • Kimi provider: separate thinking_effort provider state from wire-serialized parameters; with_thinking(...) now emits thinking.type and no longer auto-populates reasoning_effort.
  • CLI/tests: assert request bodies omit implicit reasoning_effort, and add clone/regression coverage to prevent reintroducing implicit legacy serialization.
  • Docs/changelogs: document the behavior change and how to explicitly pass legacy reasoning_effort when needed.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/e2e/test_kimi_empty_tool_call_content_e2e.py Adds CLI E2E coverage asserting Kimi requests use thinking.type and omit implicit reasoning_effort, plus session artifact checks.
tests/core/test_create_llm.py Extends unit tests to assert Kimi thinking_effort state and absence of implicit reasoning_effort, plus cloning regression coverage.
packages/kosong/tests/api_snapshot_tests/test_kimi.py Updates snapshot/API tests to ensure requests omit reasoning_effort when using with_thinking, and validates effort state preservation.
packages/kosong/src/kosong/chat_provider/kimi.py Implements the behavior change: thinking_effort becomes independent provider state; with_thinking uses extra_body.thinking.type.
packages/kosong/src/kosong/chat_provider/init.py Updates ThinkingEffort documentation to reflect Kimi’s behavior (note: wording needs a small correction).
packages/kosong/CHANGELOG.md Adds an Unreleased entry describing the Kimi thinking / legacy parameter behavior change.
docs/zh/release-notes/changelog.md Adds a Chinese release-note entry for the behavior change.
docs/zh/release-notes/breaking-changes.md Documents the breaking change + migration guidance in Chinese.
docs/en/release-notes/changelog.md Adds an English release-note entry for the behavior change.
docs/en/release-notes/breaking-changes.md Documents the breaking change + migration guidance in English.
CHANGELOG.md Adds a top-level Unreleased entry summarizing the change for CLI users.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +133 to +135
- **Kimi**: requests only serialize thinking as enabled or disabled; the
caller-provided effort remains unchanged as provider state.
- **Gemini**: ``xhigh`` and ``max`` clamp to ``high`` (no native support).
@RealKai42
RealKai42 added this pull request to the merge queue Jul 14, 2026
Merged via the queue into main with commit ded99b4 Jul 14, 2026
23 checks passed
@RealKai42
RealKai42 deleted the kaiyi/kimi-reasoning-effort-high branch July 14, 2026 08:15
n-WN added a commit to n-WN/kimi-cli-contrib that referenced this pull request Jul 18, 2026
- Add `default_thinking_effort` config and per-model `thinking_effort`,
  plus a `--thinking-effort` CLI flag (precedence: CLI > per-model > global)
- Add `/effort` slash command: interactive picker when run without args,
  direct set via `/effort <level>`, `/effort default` to clear; the level
  is saved per model (falling back to the global default) and applied on
  reload
- An explicit level implies the thinking switch: the CLI flag and the
  /effort command flip thinking on/off to match (`off` disables thinking),
  while config-file levels apply only when thinking is already on
- On Kimi providers an explicit level is forwarded via the legacy
  `reasoning_effort` passthrough (retained by MoonshotAI#2499) so the server can
  actually honor it; the default path sends nothing, preserving the
  model's own default (its maximum thinking)

Closes MoonshotAI#2501
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants