Skip to content

fix(anthropic): scope Kimi thinking guard to /coding endpoint only#56730

Open
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:liuhao/cron-bugfix-56727-kimi-coding-thinking
Open

fix(anthropic): scope Kimi thinking guard to /coding endpoint only#56730
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:liuhao/cron-bugfix-56727-kimi-coding-thinking

Conversation

@liuhao1024

Copy link
Copy Markdown
Contributor

What does this PR do?

Narrows the Kimi thinking guard in build_anthropic_kwargs() from _is_kimi_family_endpoint (matches ALL Kimi endpoints) to _is_kimi_coding_endpoint (matches only /coding). This restores the thinking parameter for non-/coding Kimi endpoints that were incorrectly blocked.

Related Issue

Fixes #56727

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • agent/anthropic_adapter.py: Changed line 2627 from _is_kimi_family_endpoint(base_url, model) to _is_kimi_coding_endpoint(base_url), scoping the thinking guard to only the /coding endpoint. Updated comment to clarify the scope.
  • tests/agent/test_kimi_coding_anthropic_thinking.py: Updated tests for non-/coding Kimi endpoints to assert that thinking IS present (was incorrectly asserting omission). Renamed tests to reflect new behavior.

How to Test

  1. Run python -m pytest tests/agent/test_kimi_coding_anthropic_thinking.py -v — all 17 tests should pass
  2. /coding endpoints still omit thinking (4 parametrized tests pass)
  3. Non-/coding Kimi endpoints now receive thinking (7 parametrized tests pass)
  4. Non-Kimi endpoints unchanged (native Anthropic, MiniMax tests pass)

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/agent/test_kimi_coding_anthropic_thinking.py -v and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 15.2

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

The thinking suppression in `build_anthropic_kwargs` used
`_is_kimi_family_endpoint` which matches ALL Kimi endpoints (coding,
chat_completions, custom proxied).  The `reasoning_content` validation
that necessitates this guard only applies to the `/coding` endpoint.

Non-`/coding` Kimi endpoints (e.g. `api.kimi.com/v1`, custom proxied
with `api_mode: anthropic_messages`) do not enforce this restriction
and should receive the thinking parameter normally.

Fix: narrow the guard from `_is_kimi_family_endpoint` to
`_is_kimi_coding_endpoint`.

Fixes NousResearch#56727
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/kimi Kimi / Moonshot labels Jul 2, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: fixes #56727 (Kimi thinking wrongly suppressed on non-/coding endpoints). Note the earlier, contradictory #18823, which asks for thinking to be enabled on /coding — this PR intentionally keeps /coding suppressed and only restores non-/coding. Earlier closed attempts at this guard: #49143, #18898. Maintainer should reconcile with #18823's ask.

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

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists provider/kimi Kimi / Moonshot type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kimi /coding endpoint thinking is incorrectly blocked (was PR #49143)

2 participants