Repository navigation
[codex] add Kimi CLI provider support - #3
Conversation
|
Warning Review limit reached
Next review available in: 27 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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 63895951e90cf8c9a8eac7e0c1c7794411ab31ed and dbb795d. 📒 Files selected for processing (19)
📝 WalkthroughWalkthroughThis change adds Kimi as an Early Access provider. It includes server-side ACP integration, provider discovery, session handling, text generation, settings contracts, web and mobile presentation, documentation, and regression coverage. It also adds thread-ID copying and Shift-click thread creation behavior. ChangesKimi provider integration
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant KimiDriver
participant KimiProvider
participant KimiAdapter
participant KimiACP
Client->>KimiDriver: configure Kimi provider
KimiDriver->>KimiProvider: check status and discover capabilities
KimiProvider->>KimiACP: start ACP discovery session
KimiACP-->>KimiProvider: models, options, commands, and skills
Client->>KimiAdapter: start session and send turn
KimiAdapter->>KimiACP: prompt with permissions and attachments
KimiACP-->>KimiAdapter: runtime events and completion
KimiAdapter-->>Client: normalized provider events
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (5)
apps/server/src/provider/acp/KimiAcpSupport.test.ts (1)
7-22: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd a case for the default binary and empty settings.
buildKimiAcpSpawnInputfalls back tokimiwhenkimiSettingsisnullorundefined. No test covers that path or the omission ofenvwhenenvironmentis absent. Add one case to lock the default 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/acp/KimiAcpSupport.test.ts` around lines 7 - 22, Add a test case in the buildKimiAcpSpawnInput suite covering null or undefined kimiSettings, asserting the default command is "kimi", args contains only "acp", and env is omitted when no environment is provided.apps/server/src/provider/Layers/KimiAdapter.ts (2)
165-172: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRead the prompt capability through the typed initialize result.
initializedPromptSupportsImagesacceptsunknownand casts to a hand-written shape.started.initializeResultis already typed byeffect-acp. The cast removes compile-time checking, so a schema rename silently disables image attachments andsendTurnfalls back to path-only text at Line 664. Type the parameter asEffectAcpSchema.InitializeResponseand read the field directly.🤖 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/KimiAdapter.ts` around lines 165 - 172, Update initializedPromptSupportsImages to accept EffectAcpSchema.InitializeResponse instead of unknown, remove the hand-written cast, and read agentCapabilities.promptCapabilities.image directly from the typed initialize result. Ensure the existing true-only capability check remains unchanged so sendTurn preserves image attachments when supported.
606-738: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract the shared model-selection and mode setup.
Lines 616-630 repeat the
applyKimiAcpModelSelectioncall, itsmapAcpToAdapterErrormapping, and theapplyKimiModecall from Lines 461-475 instartSession. Extract one helper that takes the runtime, the selection, and the interaction mode. This keeps the two entry points aligned when the selection rules change.🤖 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/KimiAdapter.ts` around lines 606 - 738, Extract the repeated model-selection and mode setup into a shared helper used by both sendTurn and startSession. The helper should accept the ACP runtime, optional model selection, and interaction mode, apply applyKimiAcpModelSelection with the existing mapAcpToAdapterError handling, then applyKimiMode; replace the duplicated blocks while preserving their current selection and error behavior.apps/server/src/provider/acp/KimiUserInput.test.ts (1)
81-126: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCover the
rawInputpermission path and array answers.The tests exercise only the fallback bridge (title, text content,
allow_oncenames). Two production paths remain untested:extractKimiPermissionQuestionsreturning questions fromtoolCall.rawInput, andselectedLabelshandling an array or an{ answers: [...] }object. Add cases for both.🤖 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/acp/KimiUserInput.test.ts` around lines 81 - 126, Extend the Kimi ACP permission tests around extractKimiPermissionQuestions and selectedLabels handling to cover toolCall.rawInput-based question extraction, including its expected question and options, and add resolution cases where answers are provided as a label array and as an object containing an answers array. Verify both forms map selected labels to the corresponding opaque ACP option IDs.apps/server/src/provider/acp/AcpSessionRuntime.ts (1)
615-627: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReuse the shared started-state construction.
Lines 618-626 repeat the mode-state write, config-option write, and
AcpStartedStateconstruction that lines 710-719 already perform. Extract one helper and call it from both paths. This keeps future startup-state fields consistent across resume and load.🤖 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/acp/AcpSessionRuntime.ts` around lines 615 - 627, Extract the repeated startup-state setup from the resume branch and the existing load path into a shared helper, including the modeStateRef and configOptionsRef writes and AcpStartedState construction. Update both branches around the resumed handling and the existing startup logic to call this helper, preserving each branch’s sessionSetupResult and sessionId values while keeping future state fields centralized.
🤖 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 `@apps/mobile/src/lib/modelOptions.test.ts`:
- Around line 13-36: The mobile model-options flow must preserve Kimi’s
ServerProvider.badgeLabel through buildModelOptions and groupByProvider, then
pass and render it in ProviderHeader. Update the regression test to assert the
grouped provider badgeLabel is "Early Access" alongside the existing
providerLabel assertion.
In `@apps/server/src/provider/acp/KimiUserInput.ts`:
- Around line 122-131: Update the option lookup in
resolveKimiQuestionPermissionOption to compare trimmed values on both sides:
trim entry.name before comparing it with label, while preserving the existing
allow_once filter and optionId return behavior.
In `@apps/server/src/provider/Layers/KimiAdapter.ts`:
- Around line 506-578: Update the notification drain after Stream.runDrain in
the session startup flow to use Effect.forkIn(scope) instead of
Effect.forkChild. Keep the existing catch behavior and ensure the notification
fiber remains active until stopSessionInternal closes the session scope.
In `@docs/internals/overview.md`:
- Around line 109-110: Update the built-in driver count in the overview
documentation from “Five” to “Six” so it matches the six drivers listed under
BUILT_IN_DRIVERS, including Kimi.
---
Nitpick comments:
In `@apps/server/src/provider/acp/AcpSessionRuntime.ts`:
- Around line 615-627: Extract the repeated startup-state setup from the resume
branch and the existing load path into a shared helper, including the
modeStateRef and configOptionsRef writes and AcpStartedState construction.
Update both branches around the resumed handling and the existing startup logic
to call this helper, preserving each branch’s sessionSetupResult and sessionId
values while keeping future state fields centralized.
In `@apps/server/src/provider/acp/KimiAcpSupport.test.ts`:
- Around line 7-22: Add a test case in the buildKimiAcpSpawnInput suite covering
null or undefined kimiSettings, asserting the default command is "kimi", args
contains only "acp", and env is omitted when no environment is provided.
In `@apps/server/src/provider/acp/KimiUserInput.test.ts`:
- Around line 81-126: Extend the Kimi ACP permission tests around
extractKimiPermissionQuestions and selectedLabels handling to cover
toolCall.rawInput-based question extraction, including its expected question and
options, and add resolution cases where answers are provided as a label array
and as an object containing an answers array. Verify both forms map selected
labels to the corresponding opaque ACP option IDs.
In `@apps/server/src/provider/Layers/KimiAdapter.ts`:
- Around line 165-172: Update initializedPromptSupportsImages to accept
EffectAcpSchema.InitializeResponse instead of unknown, remove the hand-written
cast, and read agentCapabilities.promptCapabilities.image directly from the
typed initialize result. Ensure the existing true-only capability check remains
unchanged so sendTurn preserves image attachments when supported.
- Around line 606-738: Extract the repeated model-selection and mode setup into
a shared helper used by both sendTurn and startSession. The helper should accept
the ACP runtime, optional model selection, and interaction mode, apply
applyKimiAcpModelSelection with the existing mapAcpToAdapterError handling, then
applyKimiMode; replace the duplicated blocks while preserving their current
selection and error behavior.
🪄 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: f88d38f1-91f5-4924-a5cf-03794573589d
📥 Commits
Reviewing files that changed from the base of the PR and between f5fce74 and 63895951e90cf8c9a8eac7e0c1c7794411ab31ed.
📒 Files selected for processing (51)
.gitignoreapps/mobile/src/components/ProviderIcon.tsxapps/mobile/src/lib/modelOptions.test.tsapps/mobile/src/lib/modelOptions.tsapps/server/scripts/acp-mock-agent.tsapps/server/src/provider/Drivers/KimiDriver.tsapps/server/src/provider/Drivers/KimiHome.test.tsapps/server/src/provider/Drivers/KimiHome.tsapps/server/src/provider/Drivers/KimiSkills.test.tsapps/server/src/provider/Drivers/KimiSkills.tsapps/server/src/provider/Layers/KimiAdapter.test.tsapps/server/src/provider/Layers/KimiAdapter.tsapps/server/src/provider/Layers/KimiProvider.test.tsapps/server/src/provider/Layers/KimiProvider.tsapps/server/src/provider/Services/KimiAdapter.tsapps/server/src/provider/acp/AcpJsonRpcConnection.test.tsapps/server/src/provider/acp/AcpRuntimeModel.test.tsapps/server/src/provider/acp/AcpRuntimeModel.tsapps/server/src/provider/acp/AcpSessionRuntime.tsapps/server/src/provider/acp/KimiAcpCliProbe.test.tsapps/server/src/provider/acp/KimiAcpSupport.test.tsapps/server/src/provider/acp/KimiAcpSupport.tsapps/server/src/provider/acp/KimiUserInput.test.tsapps/server/src/provider/acp/KimiUserInput.tsapps/server/src/provider/builtInDrivers.tsapps/server/src/textGeneration/KimiTextGeneration.test.tsapps/server/src/textGeneration/KimiTextGeneration.tsapps/server/src/textGeneration/TextGeneration.tsapps/web/src/components/Icons.tsxapps/web/src/components/Sidebar.logic.test.tsapps/web/src/components/Sidebar.logic.tsapps/web/src/components/Sidebar.tsxapps/web/src/components/chat/providerIconUtils.test.tsapps/web/src/components/chat/providerIconUtils.tsapps/web/src/components/settings/providerDriverMeta.test.tsapps/web/src/components/settings/providerDriverMeta.tsapps/web/src/components/threadActionMenu.logic.test.tsapps/web/src/components/threadActionMenu.logic.tsapps/web/src/hooks/useThreadActionMenu.tsapps/web/src/session-logic.tsdocs/internals/glossary.mddocs/internals/overview.mddocs/internals/providers.mddocs/superpowers/plans/2026-08-11-kimi-provider.mddocs/superpowers/specs/2026-08-11-kimi-provider-design.mddocs/user/install.mddocs/user/providers-kimi.mdpackages/contracts/src/model.test.tspackages/contracts/src/model.tspackages/contracts/src/settings.test.tspackages/contracts/src/settings.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 63895951e9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
6389595 to
dbb795d
Compare
|
Review audit after dbb795d: Implemented the actionable review items: mobile badge propagation/rendering, trimmed permission matching, session-scoped notification draining, corrected driver count, pre-prompt interruption gating, effective Kimi home identity, mode fallback, representable question-shape constraints, pre-completion ACP draining, per-model capability discovery, and standard ACP model-switch fallback. I also added the requested default spawn-input, typed image-capability, raw-input, and answer-shape coverage. Intentional non-changes / false positives:
Verification on the pushed commit: 59 focused server tests and 8 focused mobile tests pass; server and mobile typechecks pass; all 19 changed review-fix files pass the formatter and git diff check. The branch was also rebased onto this fork's actual main, removing the unrelated upstream thread/sidebar changes from the PR diff. |
Problem
T3 Code could not run Kimi Code CLI as a first-party provider. Users with a Kimi subscription had no provider settings, runtime adapter, model discovery, or client entry point, so they could not start or continue Kimi sessions from T3 Code.
Root cause
The provider registry and clients had no Kimi driver, and the shared ACP runtime was missing the small pieces needed by Kimi's current ACP implementation: resume-first continuation and retained command updates.
Fix
Add Kimi as an Early Access provider using the official
kimi acptransport. The implementation registers a per-instance Kimi driver and adds:Unsupported ACP operations such as provider-side rollback remain explicit rather than being simulated. Kimi is labeled Early Access while the upstream ACP surface continues to evolve.
Verification
Model: GPT-5.6 Sol
Harness: Codex in T3 Code
Summary by CodeRabbit
New Features
Documentation