Skip to content

Add Kimi Code V1 harness#1675

Merged
xeophon merged 5 commits into
feat/nano-as-v1from
codex/kimi-code-harness
Jun 16, 2026
Merged

Add Kimi Code V1 harness#1675
xeophon merged 5 commits into
feat/nano-as-v1from
codex/kimi-code-harness

Conversation

@xeophon

@xeophon xeophon commented Jun 14, 2026

Copy link
Copy Markdown
Member

Overview

Adds Kimi Code as a built-in V1 code-agent harness alongside the existing agent harnesses.

Details

  • Installs a pinned Kimi Code release inside the rollout runtime and runs it headlessly through the V1 interception endpoint.
  • Passes the selected model and rollout session authentication through Kimi's supported environment configuration.
  • Exposes task-owned MCP servers through an isolated Kimi Code home.
  • Propagates installer download failures through the harness's actionable install error path.
  • Registers Kimi Code in the built-in harness package and shared harness/runtime test matrix.

Stack

This PR targets feat/nano-as-v1 and is stacked on #1576.


Note

Medium Risk
Rollouts download and execute an external installer and pass the rollout session secret into the agent environment, but behavior matches existing agent CLI harnesses rather than changing core auth.

Overview
Adds Kimi Code as a built-in V1 agent harness (kimi-code), in the same family as Codex and RLM.

On rollout, the harness installs a pinned Kimi CLI (default 0.14.3) via the upstream install script (with flock and a version short-circuit), wires the V1 interception endpoint and rollout secret through KIMI_MODEL_* env vars as an OpenAI-compatible provider, writes task MCP servers to an isolated .vf-kimi-code/mcp.json, and runs kimi --prompt headlessly. It advertises SUPPORTS_TASK_TOOLS and does not append a system prompt.

The harness is re-exported from harnesses and included in the shared v1 e2e harness matrix under the slow marker.

Reviewed by Cursor Bugbot for commit cac312e. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add KimiCode harness for running Kimi Code CLI as a coding agent

  • Adds harnesses/kimi_code/ with KimiCodeHarness and KimiCodeHarnessConfig (default version 0.14.3, id kimi-code).
  • On launch, installs the pinned Kimi Code CLI into /tmp/vf-kimi-code via a flock-guarded shell script using the upstream curl installer, then runs it headlessly with --prompt.
  • Configures the CLI via environment variables for an OpenAI-compatible endpoint, model name, API key, and MCP server URLs written to mcp.json.
  • Adds kimi-code to the harness fixture in tests/v1/conftest.py as a pytest.mark.slow entry.
  • Risk: installation failures surface as ProgramError with a stderr tail, but network or version availability issues at runtime could cause flaky test results.

Macroscope summarized cac312e.

@xeophon xeophon marked this pull request as ready for review June 15, 2026 09:07

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3628ec4205

ℹ️ 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".

Comment thread packages/harnesses/harnesses/kimi_code/__init__.py Outdated
Comment thread verifiers/v1/clients/config.py Outdated
@macroscopeapp

macroscopeapp Bot commented Jun 15, 2026

Copy link
Copy Markdown

Approvability

Verdict: Needs human review

This PR introduces a new harness integration with non-trivial installation and invocation logic. Additionally, there is an unresolved high-severity review comment identifying that headless runs may hang due to missing tool permission overrides.

You can customize Macroscope's approvability policy. Learn more.

"KIMI_MODEL_BASE_URL": endpoint,
"KIMI_MODEL_CAPABILITIES": "tool_use",
"KIMI_DISABLE_TELEMETRY": "1",
"KIMI_CODE_NO_AUTO_UPDATE": "1",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wrong auto-update env var

Medium Severity

The harness sets KIMI_CODE_NO_AUTO_UPDATE, but Kimi Code reads KIMI_CLI_NO_AUTO_UPDATE to disable startup update checks and gates. With the wrong name, headless rollouts may still run update logic during launch, adding latency, network calls, or interactive blocking in pinned installs.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 47140a7. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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


mcp = {"mcpServers": {name: {"url": url} for name, url in mcp_urls.items()}}
await runtime.write(f"{KIMI_HOME}/mcp.json", json.dumps(mcp).encode())
return await runtime.run([BINARY, "--prompt", instruction], env)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Headless run lacks tool approvals

High Severity

The harness invokes kimi with only --prompt and no permission override, while SUPPORTS_TASK_TOOLS is true. Non-interactive --prompt defaults to auto permission, which still requires approval for write and shell tools, unlike Codex and Claude Code bypass flags—agentic rollouts can hang or fail when tools run.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 47140a7. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@xeophon xeophon changed the title [codex] Add Kimi Code V1 harness Add Kimi Code V1 harness Jun 15, 2026
…-code-harness

# Conflicts:
#	packages/harnesses/harnesses/__init__.py
#	tests/v1/conftest.py

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

There are 5 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit aef0057. Configure here.

Comment thread packages/harnesses/harnesses/kimi_code/__init__.py
set -e
bin="/tmp/vf-kimi-code/bin/kimi"
if [ -x "$bin" ] && [ "$("$bin" --version 2>/dev/null)" = "{version}" ]; then
exit 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Install version check mismatch

Medium Severity

The install short-circuit compares raw kimi --version stdout to the config semver string 0.14.3. Kimi Code’s own preflight/update logic normalizes version strings differently, so this equality often fails and every rollout re-downloads and re-runs the installer even when the pinned binary is already present.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit aef0057. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

wrong

Comment thread packages/harnesses/harnesses/kimi_code/__init__.py

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aef00576a9

ℹ️ 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".

Comment thread packages/harnesses/harnesses/kimi_code/__init__.py Outdated
@xeophon xeophon merged commit e906fc1 into feat/nano-as-v1 Jun 16, 2026
5 checks 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