Repository navigation
feat(server): add Kimi Code CLI provider over ACP - #5243
maiconfontana wants to merge 4 commits into
Conversation
Bring Kimi into the built-in provider set with full ACP session support, prefixed model catalog (kimi-code/*), thinking effort options, thought-chunk worklog projection, and assistant streaming. Wire settings, web picker/icon, docs, and focused tests.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
Opened an issue first per CONTRIBUTING: #5244 |
ApprovabilityVerdict: Needs human review This PR adds a new provider (Kimi Code CLI) with ~3600 lines of new code including driver, adapter, ACP integration, text generation, and UI components. New feature additions of this scope introducing new user-facing capabilities warrant human review. You can customize Macroscope's approvability policy. Learn more. |
Cap and clear per-turn reasoning buffers, only open Thinking tasks on visible text, flatten grouped ACP model select entries, forward text-generation policy for branch/title, and fix the built-in driver count in overview docs. Made with Grok Build.
|
Addressed the automated review findings on
Focused Kimi provider/adapter/ACP tests pass. One pre-existing |
There was a problem hiding this comment.
Reviewed the new Kimi provider modules (KimiDriver, KimiAdapter, KimiProvider, KimiAcpSupport, KimiTextGeneration) plus the touched ACP/ingestion code against the Effect service conventions. Dependencies are acquired from the environment (yield* Crypto.Crypto, ChildProcessSpawner, ServerSettingsService, Effect.service(ServerConfig)), Effect modules are imported as subpath namespaces, no ManagedRuntime/runPromise leaks into service construction, and error handling uses Schema.TaggedErrorClass types with Effect.catchTags. One finding below on a duplicated service shape.
Posted via Macroscope — Effect Service Conventions
Forward modelSelection options into applyKimiAcpModelSelection for headless text gen, type the ACP runtime param from AcpSessionRuntime Service, teach the ACP mock agent kimi-code/* model ids so Kimi text-gen tests match resolveKimiAcpBaseModelId, and drop the incorrect branch/title policy wiring (those service inputs have no policy field). Made with Grok Build.
Review pass complete (
|
| Finding | Resolution |
|---|---|
| Reasoning buffer unbounded (High) | Cap at 24k chars |
| Whitespace Thinking task stale (Medium / Bugbot) | Only start on non-whitespace; only advance lastPublishedLength on published progress; always complete if started |
clearTurnStateForSession missed reasoning cache (Medium) |
Invalidate bufferedReasoningByTurnKey |
| Grouped ACP model entries dropped (Medium) | Flatten { options: [...] } in model discovery |
| Docs driver count 5→6 (Low) | Fixed |
Text gen ignores modelSelection.options (Medium, new) |
Pass selections: modelSelection.options into applyKimiAcpModelSelection |
| Structural ACP runtime type (Effect conventions) | Type as Pick/Partial of AcpSessionRuntime.Service |
| Kimi text-gen test mock model id | Mock agent accepts kimi-code/* ids; assertion expects prefixed id |
False positive / out of scope
| Finding | Why |
|---|---|
Pass policy to branch/title generation |
Incorrect. BranchNameGenerationInput / ThreadTitleGenerationInput have no policy field (only commit/PR do). Passing it fails typecheck. Prompt helpers accept optional policy for future use, but the service contract does not. Other providers (Claude/Codex/Cursor/Grok) also omit it. Reverted. |
Verification
- Focused tests: Kimi provider, adapter, ACP support, text generation — 19/19 pass
- CodeRabbit auto-review is disabled on this repo (settings); happy to re-trigger with
@coderabbitai reviewif maintainers want
Scope note (unchanged)
Still a large feature PR; issue #5244 remains the tracking entry. Ready for human review of the adapter surface.
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Fixup commit summary =='
git show --stat --oneline 7eb874d56
echo
echo '== Candidate files =='
fd -t f . | rg '(Kimi|ProviderRuntimeIngestion|AcpRuntimeModel|README|install|internals)' | head -200
echo
echo '== Relevant definitions and usages =='
rg -n -C 3 \
'bufferedReasoningByTurnKey|lastPublishedLength|MAX_.*REASONING|24000|24_000|clearTurnStateForSession|buildKimiDiscoveredModelsFromConfigOptions|applyKimiAcpModelSelection|selections: modelSelection\.options|AcpSessionRuntime\.Service|kimi-code/grok-mock-alt|built-in.*driver|driver.*[56]' \
. \
-g '!node_modules/**' -g '!dist/**' -g '!build/**' | head -500
echo
echo '== Fixup diff for the reported areas =='
git show --format=fuller --find-renames 7eb874d56 -- \
':!node_modules' ':!dist' ':!build' | sed -n '1,1400p'Length of output: 44358 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Symbol map =='
ast-grep outline apps/server/src/provider/Layers/KimiProvider.ts \
--items all --type function --match 'buildKimiDiscoveredModelsFromConfigOptions|buildKimiThinkingCapabilitiesFromConfigOptions'
ast-grep outline apps/server/src/textGeneration/KimiTextGeneration.ts \
--items all --type function --match 'generateBranchName|generateThreadTitle|buildBranchNamePrompt|buildThreadTitlePrompt'
ast-grep outline apps/server/src/provider/Layers/KimiProvider.test.ts \
--items all --type function --match 'discover|config|group'
echo
echo '== Grouped ACP option implementation and tests =='
sed -n '185,255p' apps/server/src/provider/Layers/KimiProvider.ts
rg -n -C 5 'group|options: \[|configOptions|discovered model' \
apps/server/src/provider/Layers/KimiProvider.test.ts \
apps/server/src/provider/acp/KimiAcpSupport.test.ts
echo
echo '== Branch/title generation input contracts and peer-provider calls =='
rg -n -C 5 \
'interface BranchNameGenerationInput|type BranchNameGenerationInput|interface ThreadTitleGenerationInput|type ThreadTitleGenerationInput|generateBranchName|generateThreadTitle' \
apps/server/src/textGeneration \
packages \
-g '*.ts' | head -550
echo
echo '== Reasoning ingestion tests =='
rg -n -C 4 \
'reasoning|Thinking|24_000|24000|whitespace|clearTurnStateForSession' \
apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts \
apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.approval.test.tsLength of output: 4442 🏁 Script executed: #!/bin/bash
set -u
echo '== Branch and title input contracts =='
rg -n -C 6 \
'BranchNameGenerationInput|ThreadTitleGenerationInput|generateBranchName|generateThreadTitle' \
. -g '*.ts' -g '!node_modules/**' -g '!dist/**' -g '!build/**' | head -700 || true
echo
echo '== Kimi model-discovery tests =='
rg -n -C 6 \
'configOptions|availableModels|group|models.*discover|discover.*models|model.*select' \
apps/server/src/provider/Layers/KimiProvider.test.ts \
apps/server/src/provider/acp/KimiAcpSupport.test.ts || true
echo
echo '== Reasoning-ingestion test coverage =='
rg -n -C 6 \
'reasoning|Thinking|whitespace|24_000|24000|session\.exited|clear.*session' \
apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts \
apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.approval.test.ts || true
echo
echo '== Kimi text-generation option propagation test coverage =='
rg -n -C 6 \
'options|thinking|set_config_option|setConfigOption|session/set_config_option' \
apps/server/src/textGeneration/KimiTextGeneration.test.ts \
apps/server/src/provider/acp/KimiAcpSupport.test.ts || trueLength of output: 84109
The I could not execute the focused tests in this environment. I found no remaining source-level issue in the addressed findings. ✏️ Learnings added
You are interacting with an AI system. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a0b60ca. Configure here.
| threadId: thread.id, | ||
| turnId, | ||
| createdAt: now, | ||
| }); |
There was a problem hiding this comment.
Stuck Thinking on session exit
Medium Severity
session.exited clears bufferedReasoningByTurnKey without completing an opened Thinking task. Kimi stopSession emits exit without turn.completed, so a mid-thought stop leaves a permanent in-progress Thinking entry in the worklog.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit a0b60ca. Configure here.
|
Note 🤖 GPT-5.6 Sol responding on behalf of Theo Closing this PR after an automated pass over open pull requests. Outside Kimi provider integration. Three separate implementations compete for the same unsupported provider. |


Summary
Adds optional Kimi Code CLI support as a first-class built-in provider, following the same ACP adapter pattern as Cursor/Grok.
kimi acpfor sessions, prompts, interrupts, approvals, resume, and text generationkimi-code/*models, thinking low/high/max)agent_thought_chunkinto thinking worklog activity and streams assistant textWhy this exists
Kimi Code CLI is a real terminal agent with official ACP support (
kimi acp). T3 already wraps multiple BYO CLIs; this fills that gap without requiring a separate product surface.Scope / CONTRIBUTING note
I read CONTRIBUTING.md. This is larger than the “small fixes only” bar you currently prefer, and I understand you may close or defer large external feature PRs. Opening this so maintainers can decide, request a split, or take the idea in-house if useful.
Happy to:
How to test
kimi→/loginkimi-code/kimi-for-coding(or K3)Test plan
kimi acpprobe: auth, model list, thought + message chunksMade with Grok Build.
Note
Medium Risk
Large new provider surface (subprocess ACP, turn/prompt lifecycle) plus shared ingestion changes for reasoning streams; mistakes could affect non-Kimi ACP providers or worklog behavior.
Overview
Adds Kimi Code CLI as a sixth built-in provider, using the same ACP pattern as Cursor/Grok (
kimi acpsessions, health checks, model discovery, andkimi upgrademaintenance).Server: New
KimiDriver,KimiAdapter(sessions, steer/interrupt prompt settlement, permissions, resume),KimiProvidersnapshot/probe, andKimiTextGenerationfor commit/PR/branch/title helpers.KimiAcpSupportnormalizeskimi-code/*model ids and applies thinking/mode via ACP config options.ACP + orchestration: Parses
agent_thought_chunkasreasoning_textcontent deltas (Cursor/Grok adapters now forwardstreamKind). Reasoning streams skip assistant segment buffering; ingestion buffers per-turn thought text into Thinking worklog tasks (progress + completion when assistant text or turn ends).Contracts & web:
KimiSettings, defaults/aliases, registry entry; picker, settings meta, andKimiIcon. Docs/README/AGENTS updated for install and provider list.Reviewed by Cursor Bugbot for commit a0b60ca. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add Kimi Code CLI as a built-in provider over ACP
makeKimiTextGeneration(KimiTextGeneration.ts) for commit messages, PR content, branch names, and thread titles via ACP-backed JSON prompts with a 180s timeout.agent_thought_chunkevents, emittingContentDeltawithstreamKind: "reasoning_text"alongside the existingassistant_textkind.Macroscope summarized a0b60ca.