Skip to content

feat(kimi): add Kimi K3 context variants - #1989

Merged
kevincodex1 merged 23 commits into
Twigpine:mainfrom
jatmn:k3
Jul 20, 2026
Merged

kevincodex1 merged 23 commits into
Twigpine:mainfrom
jatmn:k3

Conversation

@jatmn

@jatmn jatmn commented Jul 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add Kimi K3 to the direct Moonshot AI catalog with a 1M context window.
  • Add Kimi K3 (1M) as the normal Kimi Code selection, with Kimi K3 (256K) for the Moderato tier.
  • Route either Kimi Code selection to the K3 API model and add K2.7 Code HighSpeed metadata.

Validation

  • bun test src/integrations/runtimeMetadata.test.ts src/utils/model/routeCatalogOptions.test.ts
  • bun test src/integrations/runtimeMetadata.test.ts src/integrations/providerConfig.test.ts src/utils/model/context.test.ts src/utils/model/effort.codex.test.ts src/utils/model/routeCatalogOptions.test.ts
  • bun run typecheck

Summary by CodeRabbit

  • New Features
    • Updated Kimi Code defaults to Kimi K3 (1M) and added a distinct Kimi K3 (256K) context variant, plus a high-speed option.
    • Improved Kimi/Moonshot K3 reasoning support (including max effort) and handling for disabled thinking.
  • Bug Fixes
    • Improved model/route matching and disambiguation so K3 variants stay correctly distinct.
    • Ensured reasoning effort is only applied when the selected model supports it.
  • Documentation
    • Added guidance for Moonshot and Kimi K3 catalogs, limits, and routing.
  • Tests
    • Expanded routing, context/limit, and reasoning-effort coverage (including K3/256K).

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 14 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6faf2c9f-8ed7-4077-b26b-eda55d2ea55e

📥 Commits

Reviewing files that changed from the base of the PR and between b520c0f and 67aa643.

📒 Files selected for processing (25)
  • docs/integrations/overview.md
  • src/integrations/gateways/kimi-code.ts
  • src/integrations/index.test.ts
  • src/integrations/models/kimi.test.ts
  • src/integrations/models/kimi.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/vendors/moonshot.ts
  • src/services/api/client.test.ts
  • src/services/api/client.ts
  • src/services/api/compressToolHistory.ts
  • src/services/api/openaiShim.compression.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/providerConfig.ts
  • src/services/compact/autoCompact.test.ts
  • src/services/compact/autoCompact.ts
  • src/utils/context.test.ts
  • src/utils/context.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
  • src/utils/model/modelOptions.gateways.test.ts
  • src/utils/model/modelOptions.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/model/routeCatalogOptions.ts
📝 Walkthrough

Walkthrough

Changes

Kimi K3 and high-speed coding variants are added to Moonshot and Kimi Code catalogs. Runtime limits, route-option disambiguation, provider reasoning, OpenAI shim routing, compression, and related tests are updated.

Kimi catalog and routing

Layer / File(s) Summary
Kimi catalog and runtime metadata
src/integrations/..., src/integrations/models/..., src/integrations/vendors/...
Registers K3 variants, catalog limits, capabilities, reasoning metadata, and catalog-ID matching.
Duplicate route option values
src/utils/model/routeCatalogOptions.ts, src/utils/model/modelOptions.ts, src/utils/model/*test.ts
Uses catalog IDs when API names collide and preserves route-default recommendations.
Provider reasoning and shim routing
src/services/api/providerConfig.ts, src/services/api/client.ts, src/services/api/openaiShim.ts, src/utils/effort.ts
Adds max effort support, validates K3 reasoning levels, and routes model-specific reasoning metadata through the OpenAI shim.
Runtime limits and request validation
src/services/compact/..., src/utils/context.ts, src/services/api/*test.ts, docs/integrations/overview.md
Propagates explicit model limits through compaction and validates K3 mapping, reasoning, provider overrides, compression, and outbound requests.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested reviewers: chioarub, kevincodex1, euxaristia

🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (6 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Risk Surface Disclosed ✅ Passed PASS: The diff explicitly calls out route-specific risk (silent K3→K2.6 misroute, preserve catalog IDs) and no blocker is indicated; the change is scoped and tested.
No Hidden Policy Change ✅ Passed Policy-sensitive routing/default and reasoning changes are explicit in dedicated gateway/provider files, docs, and tests; nothing hidden in cleanup.
Title check ✅ Passed The title is concise, scoped, and accurately reflects the Kimi K3 context-variant changes.
Description check ✅ Passed The description covers the main change and validation steps, though the Impact and Notes sections are missing.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/integrations/runtimeMetadata.test.ts`:
- Around line 300-305: Add a provider-path test in the relevant runtime metadata
test alongside the catalog assertion, selecting kimi-for-coding-highspeed with
https://api.kimi.com/coding/v1 and asserting it resolves to the highspeed API
model while inheriting the kimi-for-coding runtime limits and reasoning
metadata.

In `@src/utils/model/modelOptions.ts`:
- Around line 926-932: Add a focused regression test for getCatalogOptionValue
covering duplicate K3 entries such as k3-256k and k3-1m, and verify each stored
value resolves back to its own entry ID rather than the first shared k3 entry.
Keep the existing buildRouteCatalogModelOptions coverage unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b5daa219-d35d-4c4c-8a6f-0a0bb1a9bcae

📥 Commits

Reviewing files that changed from the base of the PR and between 47123b4 and e967029.

📒 Files selected for processing (9)
  • src/integrations/gateways/kimi-code.ts
  • src/integrations/models/kimi.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/context.test.ts
  • src/utils/model/modelOptions.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/model/routeCatalogOptions.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: web
  • GitHub Check: smoke-and-tests (24.11.x)
  • GitHub Check: typecheck
  • GitHub Check: smoke-and-tests (22)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

TypeScript code in this repository must use strict mode and ESM imports.

**/*.{ts,tsx}: When changing provider behavior, avoid breaking third-party providers and test the exact provider/model path changed when possible.
Run bun run typecheck and bun run typecheck:type-tests for TypeScript changes.
Run provider tests and provider recommendation tests when changing provider behavior: bun run test:provider and bun run test:provider-recommendation.

Files:

  • src/integrations/models/kimi.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/model/routeCatalogOptions.ts
  • src/integrations/gateways/kimi-code.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/model/modelOptions.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*: Keep changes focused on one problem or feature and avoid mixing unrelated cleanup into the same change.
Preserve existing repository patterns unless intentionally refactoring them.
Update documentation when setup, commands, or user-facing behavior changes.
Review AI-generated changes for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting them.
Follow the existing code style in touched files.
Prefer small, readable changes over broad rewrites.
Do not reformat unrelated files.
Keep comments useful and concise.
Provider changes must explicitly identify affected providers, limitations, and follow-up work in the pull request description.
Do not assign or use provider tags; provider tags are controlled by maintainers.
Run the relevant validation checks locally before submitting changes; pull requests must pass CI checks.
Run bun run security:pr-scan before submitting a pull request.
Dependency changes require a concrete project benefit, such as fixing a bug, addressing a security issue, or supporting an approved feature.
Do not change the project's language, core runtime, or dependency stack without prior maintainer agreement.

Files:

  • src/integrations/models/kimi.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/model/routeCatalogOptions.ts
  • src/integrations/gateways/kimi-code.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/model/modelOptions.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/integrations/models/kimi.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/model/routeCatalogOptions.ts
  • src/integrations/gateways/kimi-code.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/model/modelOptions.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when a code change affects behavior.

Files:

  • src/integrations/models/kimi.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/model/routeCatalogOptions.ts
  • src/integrations/gateways/kimi-code.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/model/modelOptions.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/models/kimi.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/model/routeCatalogOptions.ts
  • src/integrations/gateways/kimi-code.ts
  • src/services/api/providerConfig.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/model/modelOptions.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/utils/model/routeCatalogOptions.test.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.test.ts
🔇 Additional comments (8)
src/integrations/gateways/kimi-code.ts (1)

36-40: LGTM!

src/integrations/models/kimi.ts (1)

32-32: LGTM!

src/integrations/runtimeMetadata.ts (1)

55-58: LGTM!

src/integrations/runtimeMetadata.test.ts (1)

306-321: LGTM!

src/services/api/providerConfig.test.ts (1)

40-49: LGTM!

src/utils/context.test.ts (1)

804-823: LGTM!

src/utils/model/routeCatalogOptions.ts (1)

54-64: LGTM!

src/utils/model/routeCatalogOptions.test.ts (1)

32-39: LGTM!

Comment thread src/integrations/runtimeMetadata.test.ts
Comment thread src/utils/model/modelOptions.ts
@jatmn jatmn self-assigned this Jul 16, 2026
@jatmn jatmn changed the title feat(kimi): add K3 context variants feat(moonshotai): add Kimi-K3 context variants Jul 16, 2026
@jatmn jatmn added the enhancement New feature or request label Jul 16, 2026
@jatmn jatmn changed the title feat(moonshotai): add Kimi-K3 context variants feat(moonshot): add K3 context variants Jul 16, 2026
@jatmn jatmn changed the title feat(moonshot): add K3 context variants feat(kimi): add Kimi K3 context variants Jul 16, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/integrations/gateways/kimi-code.ts`:
- Around line 36-40: Update the Kimi Code provider’s defaultModel configuration
from kimi-for-coding to k3 so the catalog’s K3 entry is selected by default. Add
a focused assertion verifying the exact Kimi Code provider/model default route
resolves to k3.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6e26660a-fcef-4fb8-9d95-f72ef4eda522

📥 Commits

Reviewing files that changed from the base of the PR and between e967029 and 2a01d95.

📒 Files selected for processing (8)
  • src/integrations/gateways/kimi-code.ts
  • src/integrations/models/kimi.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/context.test.ts
  • src/utils/effort.codex.test.ts
  • src/utils/model/routeCatalogOptions.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: smoke-and-tests (24.11.x)
  • GitHub Check: typecheck
  • GitHub Check: smoke-and-tests (22)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

TypeScript code in this repository must use strict mode and ESM imports.

**/*.{ts,tsx}: When changing provider behavior, avoid breaking third-party providers and test the exact provider/model path changed when possible.
Run bun run typecheck and bun run typecheck:type-tests for TypeScript changes.
Run provider tests and provider recommendation tests when changing provider behavior: bun run test:provider and bun run test:provider-recommendation.

Files:

  • src/integrations/vendors/moonshot.ts
  • src/integrations/gateways/kimi-code.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/integrations/models/kimi.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/context.test.ts
  • src/utils/effort.codex.test.ts
  • src/integrations/runtimeMetadata.test.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*: Keep changes focused on one problem or feature and avoid mixing unrelated cleanup into the same change.
Preserve existing repository patterns unless intentionally refactoring them.
Update documentation when setup, commands, or user-facing behavior changes.
Review AI-generated changes for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting them.
Follow the existing code style in touched files.
Prefer small, readable changes over broad rewrites.
Do not reformat unrelated files.
Keep comments useful and concise.
Provider changes must explicitly identify affected providers, limitations, and follow-up work in the pull request description.
Do not assign or use provider tags; provider tags are controlled by maintainers.
Run the relevant validation checks locally before submitting changes; pull requests must pass CI checks.
Run bun run security:pr-scan before submitting a pull request.
Dependency changes require a concrete project benefit, such as fixing a bug, addressing a security issue, or supporting an approved feature.
Do not change the project's language, core runtime, or dependency stack without prior maintainer agreement.

Files:

  • src/integrations/vendors/moonshot.ts
  • src/integrations/gateways/kimi-code.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/integrations/models/kimi.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/context.test.ts
  • src/utils/effort.codex.test.ts
  • src/integrations/runtimeMetadata.test.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/integrations/vendors/moonshot.ts
  • src/integrations/gateways/kimi-code.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/integrations/models/kimi.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/context.test.ts
  • src/utils/effort.codex.test.ts
  • src/integrations/runtimeMetadata.test.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when a code change affects behavior.

Files:

  • src/integrations/vendors/moonshot.ts
  • src/integrations/gateways/kimi-code.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/integrations/models/kimi.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/context.test.ts
  • src/utils/effort.codex.test.ts
  • src/integrations/runtimeMetadata.test.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/vendors/moonshot.ts
  • src/integrations/gateways/kimi-code.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/integrations/models/kimi.ts
  • src/services/api/providerConfig.test.ts
  • src/integrations/runtimeMetadata.test.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/utils/model/routeCatalogOptions.test.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/context.test.ts
  • src/utils/effort.codex.test.ts
  • src/integrations/runtimeMetadata.test.ts
🔇 Additional comments (7)
src/integrations/runtimeMetadata.test.ts (1)

309-330: The previous highspeed provider-path coverage gap remains.

The test now lists kimi-for-coding-highspeed, but still does not resolve it through https://api.kimi.com/coding/v1 or verify its API model and inherited runtime metadata. Add that exact provider-path assertion.

As per coding guidelines, behavior changes require tests; as per path instructions, provider/model changes should test the exact provider/model route.

Sources: Coding guidelines, Path instructions

src/integrations/models/kimi.ts (1)

32-32: 🎯 Functional Correctness

Verify that K3 preserves Kimi brand metadata.

The existing kimiModel() helper sets brandId: 'kimi', but the new descriptor bypasses that helper and omits brandId. Unless this is intentional, K3 may be excluded from brand-based grouping or recommendations; preserve the field and add a regression assertion.

src/integrations/vendors/moonshot.ts (1)

37-37: LGTM!

src/utils/effort.codex.test.ts (1)

476-476: LGTM!

Also applies to: 530-540

src/services/api/providerConfig.test.ts (1)

41-48: LGTM!

src/utils/context.test.ts (1)

804-814: LGTM!

Also applies to: 816-822

src/utils/model/routeCatalogOptions.test.ts (1)

32-39: LGTM!

Comment thread src/integrations/gateways/kimi-code.ts Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 16, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/services/api/openaiShim.compression.test.ts`:
- Around line 156-167: Update captureRequestBody to snapshot
CLAUDE_CODE_AUTO_COMPACT_WINDOW and CLAUDE_CODE_MAX_OUTPUT_TOKENS before
modifying them, then wrap the request/capture operation in a try/finally that
restores each environment variable exactly, preserving whether it was unset or
had an empty/string value even when the request throws.

In `@src/services/api/providerConfig.ts`:
- Around line 1003-1018: Update the reasoning validation near requestedReasoning
and isKimiCodeK3 so every applicable selected catalog entry, including direct
Moonshot K3, rejects efforts not present in its declared reasoning.levels while
preserving valid levels and existing max-support behavior; add invalid-level
regression cases in src/services/api/providerConfig.test.ts at lines 76-86 using
https://api.moonshot.ai/v1.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1ef53003-0e32-48d9-baa1-47967efad281

📥 Commits

Reviewing files that changed from the base of the PR and between 2a01d95 and 8ed500e.

📒 Files selected for processing (17)
  • src/integrations/gateways/kimi-code.ts
  • src/integrations/models/kimi.test.ts
  • src/integrations/models/kimi.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/services/api/client.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.compression.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/providerConfig.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
  • src/utils/model/modelOptions.gateways.test.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/model/routeCatalogOptions.ts
  • src/utils/providerProfiles.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: smoke-and-tests (22)
  • GitHub Check: smoke-and-tests (24.11.x)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

TypeScript code in this repository must use strict mode and ESM imports.

**/*.{ts,tsx}: When changing provider behavior, avoid breaking third-party providers and test the exact provider/model path changed when possible.
Run bun run typecheck and bun run typecheck:type-tests for TypeScript changes.
Run provider tests and provider recommendation tests when changing provider behavior: bun run test:provider and bun run test:provider-recommendation.

Files:

  • src/integrations/models/kimi.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/providerProfiles.test.ts
  • src/integrations/gateways/kimi-code.ts
  • src/utils/model/modelOptions.gateways.test.ts
  • src/utils/model/routeCatalogOptions.ts
  • src/integrations/models/kimi.ts
  • src/services/api/client.test.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/openaiShim.compression.test.ts
  • src/utils/effort.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/services/api/client.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*: Keep changes focused on one problem or feature and avoid mixing unrelated cleanup into the same change.
Preserve existing repository patterns unless intentionally refactoring them.
Update documentation when setup, commands, or user-facing behavior changes.
Review AI-generated changes for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting them.
Follow the existing code style in touched files.
Prefer small, readable changes over broad rewrites.
Do not reformat unrelated files.
Keep comments useful and concise.
Provider changes must explicitly identify affected providers, limitations, and follow-up work in the pull request description.
Do not assign or use provider tags; provider tags are controlled by maintainers.
Run the relevant validation checks locally before submitting changes; pull requests must pass CI checks.
Run bun run security:pr-scan before submitting a pull request.
Dependency changes require a concrete project benefit, such as fixing a bug, addressing a security issue, or supporting an approved feature.
Do not change the project's language, core runtime, or dependency stack without prior maintainer agreement.

Files:

  • src/integrations/models/kimi.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/providerProfiles.test.ts
  • src/integrations/gateways/kimi-code.ts
  • src/utils/model/modelOptions.gateways.test.ts
  • src/utils/model/routeCatalogOptions.ts
  • src/integrations/models/kimi.ts
  • src/services/api/client.test.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/openaiShim.compression.test.ts
  • src/utils/effort.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/services/api/client.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/integrations/models/kimi.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/providerProfiles.test.ts
  • src/integrations/gateways/kimi-code.ts
  • src/utils/model/modelOptions.gateways.test.ts
  • src/utils/model/routeCatalogOptions.ts
  • src/integrations/models/kimi.ts
  • src/services/api/client.test.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/openaiShim.compression.test.ts
  • src/utils/effort.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/services/api/client.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when a code change affects behavior.

Files:

  • src/integrations/models/kimi.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/providerProfiles.test.ts
  • src/integrations/gateways/kimi-code.ts
  • src/utils/model/modelOptions.gateways.test.ts
  • src/utils/model/routeCatalogOptions.ts
  • src/integrations/models/kimi.ts
  • src/services/api/client.test.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/openaiShim.compression.test.ts
  • src/utils/effort.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/services/api/client.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/models/kimi.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/providerProfiles.test.ts
  • src/integrations/gateways/kimi-code.ts
  • src/utils/model/modelOptions.gateways.test.ts
  • src/utils/model/routeCatalogOptions.ts
  • src/integrations/models/kimi.ts
  • src/services/api/client.test.ts
  • src/services/api/openaiShim.compression.test.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/services/api/client.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/integrations/models/kimi.test.ts
  • src/utils/model/routeCatalogOptions.test.ts
  • src/utils/providerProfiles.test.ts
  • src/utils/model/modelOptions.gateways.test.ts
  • src/services/api/client.test.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/openaiShim.compression.test.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/services/api/providerConfig.test.ts
🔇 Additional comments (19)
src/utils/model/routeCatalogOptions.ts (1)

7-10: LGTM!

Also applies to: 51-75

src/utils/model/routeCatalogOptions.test.ts (1)

32-42: LGTM!

src/utils/model/modelOptions.gateways.test.ts (1)

108-117: 🩺 Stability & Availability

No env cleanup issue here. Shared beforeEach clears these env vars and afterEach restores the originals, so this test remains isolated.

			> Likely an incorrect or invalid review comment.
src/utils/effort.ts (1)

47-49: LGTM!

Also applies to: 201-209, 565-565

src/services/api/client.ts (1)

16-20: LGTM!

Also applies to: 364-415

src/services/api/openaiShim.ts (2)

49-49: LGTM!

Also applies to: 3527-3532, 5066-5078


3799-3843: 🎯 Functional Correctness

No K3 test gap here. The K3 catalog variants, shared k3 wire model, and native max reasoning path are already covered in src/integrations/runtimeMetadata.test.ts, src/services/api/providerConfig.test.ts, src/services/api/openaiShim.compression.test.ts, src/services/api/client.test.ts, and src/utils/effort.codex.test.ts.

			> Likely an incorrect or invalid review comment.
src/integrations/gateways/kimi-code.ts (2)

8-8: LGTM!


36-40: 📐 Maintainability & Code Quality

Confirm the new K3 options are documented.

This exposes a new default, two context-window variants, and a HighSpeed option. Ensure the integration overview and relevant how-to documentation explain k3 vs. k3-256k, affected providers, and the HighSpeed limitations.

As per coding guidelines, update documentation when user-facing behavior changes; as per path instructions, provider changes require checking the integration overview and relevant how-to docs.

Sources: Coding guidelines, Path instructions

src/integrations/models/kimi.ts (1)

32-32: LGTM!

src/integrations/vendors/moonshot.ts (1)

37-37: LGTM!

src/integrations/runtimeMetadata.test.ts (1)

230-237: LGTM!

Also applies to: 269-273, 309-342

src/integrations/models/kimi.test.ts (1)

1-8: LGTM!

src/services/api/providerConfig.ts (1)

129-133: LGTM!

Also applies to: 298-298, 369-380, 963-972

src/services/api/providerConfig.test.ts (1)

40-74: LGTM!

Also applies to: 88-107

src/services/api/client.test.ts (1)

1893-1929: LGTM!

Also applies to: 1931-1966

src/services/api/openaiShim.compression.test.ts (1)

299-312: LGTM!

src/utils/effort.codex.test.ts (1)

476-476: LGTM!

Also applies to: 530-541

src/utils/providerProfiles.test.ts (1)

2304-2304: LGTM!

Comment thread src/services/api/openaiShim.compression.test.ts
Comment thread src/services/api/providerConfig.ts Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 17, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/services/api/client.test.ts (1)

1893-1929: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Assert the provider route and outgoing model, not only reasoning_effort.

These tests can pass if K3 is routed through the wrong provider or the request uses the wrong model, because they only inspect reasoning_effort. Capture the fetch URL and assert the Kimi Code endpoint plus the outgoing model is k3 in each provider-override case.

Also applies to: 1931-1944, 1946-1981

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/services/api/client.test.ts` around lines 1893 - 1929, Update the
providerOverride tests around “providerOverride K3 preserves max reasoning from
its model query” and the other listed cases to capture the fetch request URL and
assert it targets the Kimi Code endpoint. Also assert the parsed request body’s
outgoing model is “k3” while retaining the existing reasoning_effort assertions,
ensuring each provider-override case validates routing and model translation.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/integrations/vendors/moonshot.ts`:
- Line 37: Update the relevant Moonshot documentation under docs/integrations/
to document the Kimi K3 model, including its 1,048,576-token context window,
32,768-token maximum output, supported capabilities, and max-only reasoning
limitation using reasoning_effort.

---

Outside diff comments:
In `@src/services/api/client.test.ts`:
- Around line 1893-1929: Update the providerOverride tests around
“providerOverride K3 preserves max reasoning from its model query” and the other
listed cases to capture the fetch request URL and assert it targets the Kimi
Code endpoint. Also assert the parsed request body’s outgoing model is “k3”
while retaining the existing reasoning_effort assertions, ensuring each
provider-override case validates routing and model translation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a467b04f-fb85-426c-b018-dafff36e2033

📥 Commits

Reviewing files that changed from the base of the PR and between 878ea75 and 5ee77f6.

📒 Files selected for processing (5)
  • src/integrations/index.test.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/services/api/client.test.ts
  • src/utils/effort.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: smoke-and-tests (24.11.x)
  • GitHub Check: typecheck
  • GitHub Check: smoke-and-tests (22)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

TypeScript code in this repository must use strict mode and ESM imports.

**/*.{ts,tsx}: When changing provider behavior, avoid breaking third-party providers and test the exact provider/model path changed when possible.
Run bun run typecheck and bun run typecheck:type-tests for TypeScript changes.
Run provider tests and provider recommendation tests when changing provider behavior: bun run test:provider and bun run test:provider-recommendation.

Files:

  • src/integrations/index.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/services/api/client.test.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*: Keep changes focused on one problem or feature and avoid mixing unrelated cleanup into the same change.
Preserve existing repository patterns unless intentionally refactoring them.
Update documentation when setup, commands, or user-facing behavior changes.
Review AI-generated changes for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting them.
Follow the existing code style in touched files.
Prefer small, readable changes over broad rewrites.
Do not reformat unrelated files.
Keep comments useful and concise.
Provider changes must explicitly identify affected providers, limitations, and follow-up work in the pull request description.
Do not assign or use provider tags; provider tags are controlled by maintainers.
Run the relevant validation checks locally before submitting changes; pull requests must pass CI checks.
Run bun run security:pr-scan before submitting a pull request.
Dependency changes require a concrete project benefit, such as fixing a bug, addressing a security issue, or supporting an approved feature.
Do not change the project's language, core runtime, or dependency stack without prior maintainer agreement.

Files:

  • src/integrations/index.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/services/api/client.test.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/integrations/index.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/services/api/client.test.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when a code change affects behavior.

Files:

  • src/integrations/index.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/services/api/client.test.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/index.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/services/api/client.test.ts
  • src/integrations/runtimeMetadata.test.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/integrations/index.test.ts
  • src/services/api/client.test.ts
  • src/integrations/runtimeMetadata.test.ts
🔇 Additional comments (3)
src/integrations/runtimeMetadata.test.ts (1)

230-237: LGTM!

Also applies to: 270-270, 309-342

src/integrations/index.test.ts (1)

99-105: LGTM!

src/utils/effort.ts (1)

47-49: LGTM!

Also applies to: 201-209, 565-565, 947-954

Comment thread src/integrations/vendors/moonshot.ts Outdated

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/services/api/client.test.ts`:
- Around line 1935-1952: Add a direct-Moonshot outbound regression test beside
the existing Kimi Code providerOverride tests, using baseURL
https://api.moonshot.ai/v1 and model kimi-k3. Exercise the client creation and
beta.messages.create flow, then assert the captured request body contains model
kimi-k3 and reasoning_effort max, while preserving the existing fetch cleanup
pattern.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: bdf21f9c-4dd6-479f-ad3e-97bc3e91b780

📥 Commits

Reviewing files that changed from the base of the PR and between 5ee77f6 and f345eac.

📒 Files selected for processing (9)
  • docs/integrations/overview.md
  • src/services/api/client.test.ts
  • src/services/api/compressToolHistory.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/providerConfig.ts
  • src/services/compact/autoCompact.test.ts
  • src/services/compact/autoCompact.ts
  • src/utils/context.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: smoke-and-tests (22)
  • GitHub Check: smoke-and-tests (24.11.x)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

TypeScript code in this repository must use strict mode and ESM imports.

**/*.{ts,tsx}: When changing provider behavior, avoid breaking third-party providers and test the exact provider/model path changed when possible.
Run bun run typecheck and bun run typecheck:type-tests for TypeScript changes.
Run provider tests and provider recommendation tests when changing provider behavior: bun run test:provider and bun run test:provider-recommendation.

Files:

  • src/services/api/compressToolHistory.ts
  • src/services/compact/autoCompact.ts
  • src/services/compact/autoCompact.test.ts
  • src/services/api/client.test.ts
  • src/utils/context.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*: Keep changes focused on one problem or feature and avoid mixing unrelated cleanup into the same change.
Preserve existing repository patterns unless intentionally refactoring them.
Update documentation when setup, commands, or user-facing behavior changes.
Review AI-generated changes for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting them.
Follow the existing code style in touched files.
Prefer small, readable changes over broad rewrites.
Do not reformat unrelated files.
Keep comments useful and concise.
Provider changes must explicitly identify affected providers, limitations, and follow-up work in the pull request description.
Do not assign or use provider tags; provider tags are controlled by maintainers.
Run the relevant validation checks locally before submitting changes; pull requests must pass CI checks.
Run bun run security:pr-scan before submitting a pull request.
Dependency changes require a concrete project benefit, such as fixing a bug, addressing a security issue, or supporting an approved feature.
Do not change the project's language, core runtime, or dependency stack without prior maintainer agreement.

Files:

  • src/services/api/compressToolHistory.ts
  • docs/integrations/overview.md
  • src/services/compact/autoCompact.ts
  • src/services/compact/autoCompact.test.ts
  • src/services/api/client.test.ts
  • src/utils/context.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/services/api/compressToolHistory.ts
  • docs/integrations/overview.md
  • src/services/compact/autoCompact.ts
  • src/services/compact/autoCompact.test.ts
  • src/services/api/client.test.ts
  • src/utils/context.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when a code change affects behavior.

Files:

  • src/services/api/compressToolHistory.ts
  • src/services/compact/autoCompact.ts
  • src/services/compact/autoCompact.test.ts
  • src/services/api/client.test.ts
  • src/utils/context.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/services/api/compressToolHistory.ts
  • src/services/api/client.test.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.ts
docs/integrations/**/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Provider changes must follow the documented integration patterns, beginning with docs/integrations/overview.md and the focused guides under docs/integrations/how-to/.

Files:

  • docs/integrations/overview.md
{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}

⚙️ CodeRabbit configuration file

{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}: Review docs for accuracy against current code behavior. Flag security or provider claims that overpromise, stale install commands, missing setup caveats, and instructions that could push users toward unsafe credential handling. Keep purely wording-level suggestions non-blocking.

Files:

  • docs/integrations/overview.md
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/services/compact/autoCompact.test.ts
  • src/services/api/client.test.ts
  • src/services/api/providerConfig.test.ts
🔇 Additional comments (11)
src/services/api/providerConfig.ts (1)

285-285: LGTM!

src/services/api/openaiShim.ts (2)

3527-3532: LGTM!


3799-3858: LGTM!

src/services/compact/autoCompact.ts (1)

35-52: LGTM!

src/utils/context.ts (1)

223-268: LGTM!

src/services/api/compressToolHistory.ts (1)

217-236: LGTM!

src/services/compact/autoCompact.test.ts (2)

26-146: LGTM!


269-301: LGTM!

src/services/api/providerConfig.test.ts (1)

51-138: LGTM!

src/services/api/client.test.ts (1)

1954-1989: LGTM!

docs/integrations/overview.md (1)

137-140: 📐 Maintainability & Code Quality

Qualify the HighSpeed entitlement claim.

“Six times the speed and three times the quota” is a provider/plan claim. Cite the authoritative provider terms and its tier/region constraints, or soften it to avoid promising an entitlement that may not apply to every eligible subscription.

Sources: Coding guidelines, Path instructions

Comment thread src/services/api/client.test.ts
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 17, 2026

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/services/api/client.test.ts (1)

2109-2142: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Cover direct-Moonshot disabled thinking.

This only tests kimi-k3?reasoning=low; add kimi-k3?thinking=disabled and assert thinking: { type: 'disabled' } with no reasoning_effort. The new Moonshot-specific branch could otherwise regress independently of Kimi Code.

As per coding guidelines, “Add or update tests when a code change affects behavior” and provider changes should “test the exact provider/model path changed when possible”; as per path instructions, “Block when risky runtime changes lack focused regression coverage.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/services/api/client.test.ts` around lines 2109 - 2142, Extend the
direct-Moonshot coverage in the providerOverride tests around getAnthropicClient
to use model `kimi-k3?thinking=disabled`, then assert the request body contains
thinking with type `disabled` and does not contain reasoning_effort. Keep the
existing reasoning=low case intact so both Moonshot query paths are covered
independently.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/services/api/client.test.ts`:
- Around line 2109-2142: Extend the direct-Moonshot coverage in the
providerOverride tests around getAnthropicClient to use model
`kimi-k3?thinking=disabled`, then assert the request body contains thinking with
type `disabled` and does not contain reasoning_effort. Keep the existing
reasoning=low case intact so both Moonshot query paths are covered
independently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8860163a-1097-407f-883e-f1f21e21b76f

📥 Commits

Reviewing files that changed from the base of the PR and between 157fdb8 and b520c0f.

📒 Files selected for processing (11)
  • docs/integrations/overview.md
  • src/integrations/gateways/kimi-code.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/vendors/moonshot.ts
  • src/services/api/client.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/providerConfig.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: typecheck
  • GitHub Check: smoke-and-tests (22)
  • GitHub Check: smoke-and-tests (24.11.x)
🧰 Additional context used
📓 Path-based instructions (7)
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*: Keep changes focused on one problem or feature and avoid mixing unrelated cleanup into the same change.
Preserve existing repository patterns unless intentionally refactoring them.
Update documentation when setup, commands, or user-facing behavior changes.
Review AI-generated changes for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting them.
Follow the existing code style in touched files.
Prefer small, readable changes over broad rewrites.
Do not reformat unrelated files.
Keep comments useful and concise.
Provider changes must explicitly identify affected providers, limitations, and follow-up work in the pull request description.
Do not assign or use provider tags; provider tags are controlled by maintainers.
Run the relevant validation checks locally before submitting changes; pull requests must pass CI checks.
Run bun run security:pr-scan before submitting a pull request.
Dependency changes require a concrete project benefit, such as fixing a bug, addressing a security issue, or supporting an approved feature.
Do not change the project's language, core runtime, or dependency stack without prior maintainer agreement.

Files:

  • docs/integrations/overview.md
  • src/integrations/vendors/moonshot.ts
  • src/integrations/gateways/kimi-code.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/services/api/client.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
  • src/services/api/openaiShim.ts
  • src/services/api/client.test.ts
  • src/services/api/providerConfig.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • docs/integrations/overview.md
  • src/integrations/vendors/moonshot.ts
  • src/integrations/gateways/kimi-code.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/services/api/client.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
  • src/services/api/openaiShim.ts
  • src/services/api/client.test.ts
  • src/services/api/providerConfig.ts
docs/integrations/**/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Provider changes must follow the documented integration patterns, beginning with docs/integrations/overview.md and the focused guides under docs/integrations/how-to/.

Files:

  • docs/integrations/overview.md
{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}

⚙️ CodeRabbit configuration file

{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}: Review docs for accuracy against current code behavior. Flag security or provider claims that overpromise, stale install commands, missing setup caveats, and instructions that could push users toward unsafe credential handling. Keep purely wording-level suggestions non-blocking.

Files:

  • docs/integrations/overview.md
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

TypeScript code in this repository must use strict mode and ESM imports.

**/*.{ts,tsx}: When changing provider behavior, avoid breaking third-party providers and test the exact provider/model path changed when possible.
Run bun run typecheck and bun run typecheck:type-tests for TypeScript changes.
Run provider tests and provider recommendation tests when changing provider behavior: bun run test:provider and bun run test:provider-recommendation.

Files:

  • src/integrations/vendors/moonshot.ts
  • src/integrations/gateways/kimi-code.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/services/api/client.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
  • src/services/api/openaiShim.ts
  • src/services/api/client.test.ts
  • src/services/api/providerConfig.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when a code change affects behavior.

Files:

  • src/integrations/vendors/moonshot.ts
  • src/integrations/gateways/kimi-code.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/services/api/client.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
  • src/services/api/openaiShim.ts
  • src/services/api/client.test.ts
  • src/services/api/providerConfig.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/vendors/moonshot.ts
  • src/integrations/gateways/kimi-code.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/services/api/client.ts
  • src/services/api/providerConfig.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/client.test.ts
  • src/services/api/providerConfig.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/integrations/runtimeMetadata.test.ts
  • src/services/api/providerConfig.test.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/client.test.ts
🔇 Additional comments (10)
src/integrations/gateways/kimi-code.ts (1)

8-10: LGTM!

Also applies to: 38-42

src/integrations/vendors/moonshot.ts (1)

37-37: LGTM!

src/integrations/runtimeMetadata.test.ts (1)

230-236: LGTM!

Also applies to: 270-270, 325-325

src/services/api/providerConfig.ts (1)

134-136: LGTM!

Also applies to: 970-1032

src/utils/effort.ts (1)

47-49: LGTM!

Also applies to: 201-209, 565-565, 947-957

src/services/api/client.ts (1)

364-423: LGTM!

src/services/api/openaiShim.ts (1)

3799-3858: LGTM!

Also applies to: 3873-3884

docs/integrations/overview.md (1)

129-142: LGTM!

src/services/api/providerConfig.test.ts (1)

40-119: LGTM!

src/utils/effort.codex.test.ts (1)

534-540: LGTM!

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 17, 2026
@jatmn
jatmn marked this pull request as ready for review July 17, 2026 22:47

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@kevincodex1

Copy link
Copy Markdown
Member

hello bro please rebase to main and fix conflicts

@jatmn

jatmn commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator Author

@kevincodex1

@kevincodex1

Copy link
Copy Markdown
Member

bro please rebase to main branc again

@jatmn

jatmn commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

@kevincodex1 please merge

@kevincodex1 kevincodex1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@kevincodex1
kevincodex1 merged commit e3fb051 into Twigpine:main Jul 20, 2026
5 checks passed
@jatmn
jatmn deleted the k3 branch July 20, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants