Skip to content

fix(provider): discover current Kimi models - #6

Merged
aGamingGod1234 merged 4 commits into
mainfrom
feat/kimi-model-discovery
Aug 11, 2026
Merged

aGamingGod1234 merged 4 commits into
mainfrom
feat/kimi-model-discovery

Conversation

@aGamingGod1234

@aGamingGod1234 aGamingGod1234 commented Aug 11, 2026 •

Copy link
Copy Markdown
Owner

Kimi appeared without any default models in T3 Code, which also hid model-specific thinking controls and the official Highspeed choice.

Kimi Code CLI 0.29.1 moved model discovery from the legacy ACP models field to a generic model config option. T3 only read the legacy field, so the authenticated CLI's catalog was discarded before the provider snapshot reached web, desktop, or mobile.

This change normalizes the generic ACP model option at the Kimi provider boundary, falls back to legacy model state for older CLIs, and reuses the existing bounded per-model probe. The picker now follows the installed CLI and account: K2.7 Coding, K2.7 Coding Highspeed, K3, and K3-256k on the current managed catalog. K3 model switches expose the CLI-advertised Low, High, and Max thinking levels. Highspeed remains an official model rather than a synthetic toggle.

Verification:

  • pnpm exec vp test run apps/server/src/provider/Layers/KimiProvider.test.ts apps/server/src/provider/acp/KimiAcpCliProbe.test.ts with T3_KIMI_ACP_PROBE=1 — 10 tests passed, including the installed Kimi CLI 0.29.1 handshake
  • pnpm exec vp run --filter t3 typecheck — exit 0 (pre-existing Effect suggestions only)
  • git diff --check fork/main...HEAD

Implemented with GPT-5.6-sol through the Codex harness in T3 Code.

Summary by CodeRabbit

  • New Features

    • Improved Kimi model discovery to show the latest available models, including K2.7 and K3 variants.
    • Added model-specific thinking options, displayed according to each model’s capabilities.
    • Preserved distinct high-speed model availability.
  • Bug Fixes

    • Improved handling of duplicate or blank model entries.
    • Added compatibility with both current and legacy model configuration formats.
    • Improved discovery reliability when model-specific capability checks fail.

Copilot AI lite review requested due to automatic review settings August 11, 2026 16:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@aGamingGod1234, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4dcae4e2-38e4-47fb-9ab1-47095a4eed6e

📥 Commits

Reviewing files that changed from the base of the PR and between fdc9000 and 2f08d0c.

📒 Files selected for processing (3)
  • apps/server/src/provider/Layers/KimiProvider.test.ts
  • docs/superpowers/plans/2026-08-12-kimi-model-discovery.md
  • docs/superpowers/specs/2026-08-12-kimi-model-discovery-design.md
📝 Walkthrough

Walkthrough

Kimi discovery now reads models from generic ACP configuration options, filters invalid entries, and falls back to legacy session state. Tests and fixtures cover K2.7, K3, custom models, and model-specific thinking options. Design and implementation plans document the behavior and validation steps.

Changes

Kimi model discovery

Layer / File(s) Summary
Discovery contract and normalization rules
docs/superpowers/plans/2026-08-12-kimi-model-discovery.md, docs/superpowers/specs/2026-08-12-kimi-model-discovery-design.md
The plan and specification define model-option normalization, legacy fallback, model-specific capability probing, restoration behavior, compatibility requirements, and validation steps.
Provider model-state normalization
apps/server/src/provider/Layers/KimiProvider.ts
kimiModelStateFromSessionSetup derives the current and available models from generic ACP configuration options. Discovery uses this normalized state before collecting capabilities.
Fixture and discovery validation
apps/server/src/provider/Layers/KimiProvider.test.ts
Fixtures and tests cover K2.7 and K3 model identifiers, duplicate and blank filtering, legacy fallback, custom models, and select-based thinking options.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ACP as ACP session setup
  participant Provider as KimiProvider
  participant Discovery as Capability discovery
  ACP->>Provider: Return configOptions and session model state
  Provider->>Provider: Normalize model selector values
  Provider->>Discovery: Pass current and available models
  Discovery->>ACP: Probe each discovered model
  ACP-->>Discovery: Return model-specific thinking options
Loading

Possibly related PRs

  • aGamingGod1234/t3code#3: This PR refines the Kimi model discovery logic and fixtures for ACP model configuration handling.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing discovery of current Kimi models.
Description check ✅ Passed The description explains what changed, why it changed, and provides focused verification results; the omitted UI section is not applicable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/kimi-model-discovery

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/server/src/provider/Layers/KimiProvider.test.ts (1)

202-215: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover fallback when the model option has no usable values.

The helper also falls back when a model select exists but produces zero valid IDs. The current test only covers an absent model option. Add a case with a blank-only model option and legacy models, then assert that the legacy state is returned. This protects the branch in apps/server/src/provider/Layers/KimiProvider.ts, Lines 176-186.

As per coding guidelines: backend behavior changes require focused tests for the changed behavior.

🤖 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 `@apps/server/src/provider/Layers/KimiProvider.test.ts` around lines 202 - 215,
The existing test only covers an absent model option; extend the Kimi
model-state tests with a case where the model option contains only blank or
unusable values alongside legacy models. Assert that
kimiModelStateFromSessionSetup returns the legacy currentModelId and
availableModels, covering the zero-valid-ID fallback branch.

Source: Coding guidelines

🤖 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 `@docs/superpowers/plans/2026-08-12-kimi-model-discovery.md`:
- Around line 95-96: Update every documented pnpm command in the plan, including
the commands near the referenced test and later validation steps, to run through
a login shell configured with Node 24 or to explicitly prepend the Node 24
binary path. Ensure all JavaScript and TypeScript repository commands use Node
24.13.1 or compatible.

In `@docs/superpowers/specs/2026-08-12-kimi-model-discovery-design.md`:
- Around line 27-35: The design scope in
docs/superpowers/specs/2026-08-12-kimi-model-discovery-design.md lines 27-35
must explicitly decide the adapter status for Codex, Claude, Cursor, Grok, and
OpenCode, marking each unchanged or deliberately unsupported. Mirror the same
adapter decision matrix in
docs/superpowers/plans/2026-08-12-kimi-model-discovery.md lines 21-32, including
corresponding verification coverage.

---

Nitpick comments:
In `@apps/server/src/provider/Layers/KimiProvider.test.ts`:
- Around line 202-215: The existing test only covers an absent model option;
extend the Kimi model-state tests with a case where the model option contains
only blank or unusable values alongside legacy models. Assert that
kimiModelStateFromSessionSetup returns the legacy currentModelId and
availableModels, covering the zero-valid-ID fallback branch.
🪄 Autofix

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a0f36be-f2d1-4ab3-ac4b-ad975c53b00c

📥 Commits

Reviewing files that changed from the base of the PR and between c02b9b5 and fdc9000.

📒 Files selected for processing (4)
  • apps/server/src/provider/Layers/KimiProvider.test.ts
  • apps/server/src/provider/Layers/KimiProvider.ts
  • docs/superpowers/plans/2026-08-12-kimi-model-discovery.md
  • docs/superpowers/specs/2026-08-12-kimi-model-discovery-design.md

Comment thread docs/superpowers/plans/2026-08-12-kimi-model-discovery.md
Comment thread docs/superpowers/specs/2026-08-12-kimi-model-discovery-design.md
@aGamingGod1234

Copy link
Copy Markdown
Owner Author

Review fixes pushed in 2f08d0c. Added the blank-only model-option fallback case requested in the nitpick; focused Kimi tests now pass 11/11, including the live installed-CLI ACP probe. Server typecheck exits 0 on Node v24.14.0.

@aGamingGod1234
aGamingGod1234 merged commit 11adcaa into main Aug 11, 2026
1 check passed
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.

2 participants