Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
1934021
feat(worker): default docker image to kimi benchmark
KKK985429 Apr 25, 2026
e2f5406
test(worker): cover kimi runtime config and fenced json parsing
KKK985429 Apr 25, 2026
48cd6ce
feat(scripts): add local-only kimi integration runner
KKK985429 Apr 25, 2026
dabb8b9
test(integration): add opt-in kimi local integration pytest entry
KKK985429 Apr 25, 2026
65abefe
test(integration): cover kimi local helper functions
KKK985429 Apr 25, 2026
4552a68
test(bootstrap): assert kimi local integration assets exist
KKK985429 Apr 25, 2026
00b6445
feat(scripts): add shell wrapper for kimi local integration
KKK985429 Apr 25, 2026
0616db9
chore(config): add generic kimi local integration env template
KKK985429 Apr 25, 2026
9159d80
chore(config): add dashscope kimi integration env template
KKK985429 Apr 25, 2026
859823b
chore(config): add host-config-only kimi env template
KKK985429 Apr 25, 2026
b6306a3
docs(integration): add kimi local integration guide
KKK985429 Apr 25, 2026
e3669d1
docs(integration): add kimi local integration checklist
KKK985429 Apr 25, 2026
074e431
docs(integration): add kimi local integration troubleshooting
KKK985429 Apr 25, 2026
8a39cab
docs(integration): describe kimi local integration artifacts
KKK985429 Apr 25, 2026
15bc717
docs(readme): add kimi local integration entry to root readme
KKK985429 Apr 25, 2026
512cae7
docs(readme): add kimi local integration entry to english readme
KKK985429 Apr 25, 2026
452400a
docs(readme): add kimi local integration entry to chinese readme
KKK985429 Apr 25, 2026
b5ad2b8
docs(contributing): document kimi local integration verification
KKK985429 Apr 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,28 @@ uv run pytest
uv run pytest tests/test_leader_event_runtime.py tests/test_leader_query_set.py
```

- 若改动涉及真实 Docker Worker / Kimi 集成链路,优先补充并执行本地集成验证:

```bash
uv run --python python3.12 python scripts/run_kimi_local_integration.py
```

- 若需要把真实 Kimi 集成用例纳入 pytest,请显式打开:

```bash
RUN_KIMI_LOCAL_INTEGRATION=1 \
OPENAI_BASE_URL="https://your-openai-compatible-endpoint" \
OPENAI_API_KEY="your-api-key" \
uv run --python python3.12 pytest -q tests/test_kimi_local_integration.py
```

- 提交前建议同步检查:

```text
docs/kimi-local-integration-checklist.md
docs/kimi-local-integration-troubleshooting.md
```

- 涉及 Web 或联调改动时,至少确认开发环境可以正常启动:

```bash
Expand Down
54 changes: 54 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,60 @@ Leader-specific regression suites:
uv run pytest tests/test_leader_event_runtime.py tests/test_leader_query_set.py
```

## Kimi Local Integration

This repository now includes a real local-only Kimi Docker integration case.

It verifies:

- the real async `call_code_worker` path
- Kimi execution inside Docker
- local file creation inside the isolated worker workspace
- structured JSON parsing from the Kimi response
- no GitHub usage and no remote repository usage

Config template:

```bash
configs/kimi-local-integration.env.example
```

Manual run:

```bash
set -a
source configs/kimi-local-integration.env.example
export OPENAI_BASE_URL="https://your-openai-compatible-endpoint"
export OPENAI_API_KEY="your-api-key"
set +a

uv run --python python3.12 python scripts/run_kimi_local_integration.py
```

Optional pytest entrypoint:

```bash
RUN_KIMI_LOCAL_INTEGRATION=1 \
OPENAI_BASE_URL="https://your-openai-compatible-endpoint" \
OPENAI_API_KEY="your-api-key" \
uv run --python python3.12 pytest -q tests/test_kimi_local_integration.py
```

Detailed guide:

```text
docs/kimi-local-integration.md
```

Supporting files:

```text
docs/kimi-local-integration-checklist.md
docs/kimi-local-integration-troubleshooting.md
scripts/run_kimi_local_integration.sh
configs/kimi-local-integration.dashscope.env.example
```

## Memory Storage

Memory files are stored in a local `.memory/` directory (created lazily by runtime code):
Expand Down
61 changes: 60 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ npm run dev

## Real Docker Worker

如果你希望 `leader` 真正把任务发给 Docker 中的 Codex Worker,建议先准备一个稳定的 Worker 镜像:
如果你希望 `leader` 真正把任务发给 Docker 中的 CLI Worker,建议先准备一个稳定的 Worker 镜像:

```bash
docker build -t code-terminator/worker-codex -f docker/worker-codex/Dockerfile .
Expand All @@ -163,6 +163,58 @@ Worker 执行时会:
3. 启动 Docker 容器
4. 把结果、stdout、stderr、内部日志都落盘

### Kimi Local Integration Case

仓库现在附带一个真实的本地集成用例,专门验证:

- `call_code_worker` 真实异步链路
- Docker 内启动 Kimi
- 在隔离工作区写本地文件
- hook 回传 `structured_output`
- 全程不触发 GitHub 或远端仓库操作

样例配置文件:

```bash
configs/kimi-local-integration.env.example
```

手动运行:

```bash
set -a
source configs/kimi-local-integration.env.example
export OPENAI_BASE_URL="https://your-openai-compatible-endpoint"
export OPENAI_API_KEY="your-api-key"
set +a

uv run --python python3.12 python scripts/run_kimi_local_integration.py
```

如果你要把它作为真实 pytest 用例运行,需要显式打开:

```bash
RUN_KIMI_LOCAL_INTEGRATION=1 \
OPENAI_BASE_URL="https://your-openai-compatible-endpoint" \
OPENAI_API_KEY="your-api-key" \
uv run --python python3.12 pytest -q tests/test_kimi_local_integration.py
```

详细说明见:

```text
docs/kimi-local-integration.md
```

辅助文件:

```text
docs/kimi-local-integration-checklist.md
docs/kimi-local-integration-troubleshooting.md
scripts/run_kimi_local_integration.sh
configs/kimi-local-integration.dashscope.env.example
```

## Configuration

### Core Runtime
Expand Down Expand Up @@ -222,6 +274,13 @@ Worker 执行时会:
| `CODEX_WORKER_CONTAINER_NODE_ROOT` | `/opt/host-node` | 容器内挂载 Node 根目录 |
| `CODEX_WORKER_DOCKER_ARGS` | 空 | 额外透传给 `docker run` 的参数 |

Kimi 兼容别名:

| 变量 | 默认值 | 说明 |
| --- | --- | --- |
| `KIMI_WORKER_DOCKER_IMAGE` | 空 | 优先于 `CODEX_WORKER_DOCKER_IMAGE` |
| `KIMI_WORKER_BIN` | `kimi` | 优先于 `CODEX_WORKER_CODEX_BIN` |

代理与网络相关的高级项:

- `CODEX_WORKER_PASSTHROUGH_PROXY`
Expand Down
58 changes: 58 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,64 @@ Worker 执行时会:
3. 启动 Docker 容器
4. 把结果、stdout、stderr、内部日志都落盘

### Kimi 本地集成用例

仓库现在附带了一个真实的本地 Kimi Docker 集成用例,专门验证:

- `call_code_worker` 的真实异步链路
- Docker 内部能正常拉起 Kimi
- Worker 只在隔离工作区里写本地文件
- hook 回传的 `structured_output` 可以被主流程正确解析
- 全程不触发 GitHub 或远端仓库操作

配置样例:

```bash
configs/kimi-local-integration.env.example
```

手动运行:

```bash
uv run --python python3.12 python scripts/run_kimi_local_integration.py
```

如果你希望显式指定 API 参数:

```bash
set -a
source configs/kimi-local-integration.env.example
export OPENAI_BASE_URL="https://your-openai-compatible-endpoint"
export OPENAI_API_KEY="your-api-key"
set +a

uv run --python python3.12 python scripts/run_kimi_local_integration.py
```

如果你要把它作为真实 pytest 用例运行,需要显式开启:

```bash
RUN_KIMI_LOCAL_INTEGRATION=1 \
OPENAI_BASE_URL="https://your-openai-compatible-endpoint" \
OPENAI_API_KEY="your-api-key" \
uv run --python python3.12 pytest -q tests/test_kimi_local_integration.py
```

详细说明见:

```text
docs/kimi-local-integration.md
```

辅助文件:

```text
docs/kimi-local-integration-checklist.md
docs/kimi-local-integration-troubleshooting.md
scripts/run_kimi_local_integration.sh
configs/kimi-local-integration.dashscope.env.example
```

## Configuration

### Core Runtime
Expand Down
8 changes: 8 additions & 0 deletions configs/kimi-local-integration.dashscope.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Example configuration for DashScope-compatible Kimi local integration runs.
# Fill in your real API key before use.

OPENAI_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1"
OPENAI_API_KEY="your-dashscope-api-key"
KIMI_WORKER_DOCKER_IMAGE="kimi-cliagent-benchmark:latest"
CODEX_WORKER_MODEL="qwen3.5-plus"
RUN_KIMI_LOCAL_INTEGRATION="0"
19 changes: 19 additions & 0 deletions configs/kimi-local-integration.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Real local-only Kimi Docker integration smoke test.
# This file is safe to commit because it contains placeholders only.

# Optional: OpenAI-compatible endpoint used by Kimi inside Docker.
# Leave empty if ~/.kimi/config.toml already contains the provider config.
OPENAI_BASE_URL="https://your-openai-compatible-endpoint"

# Optional: API key used by Kimi inside Docker.
# Leave empty if ~/.kimi/config.toml already contains the provider config.
OPENAI_API_KEY="your-api-key"

# Optional: real worker image. Defaults to kimi-cliagent-benchmark:latest.
KIMI_WORKER_DOCKER_IMAGE="kimi-cliagent-benchmark:latest"

# Optional: model passed to the Kimi CLI.
CODEX_WORKER_MODEL="qwen3.5-plus"

# Optional: enables the real pytest wrapper.
RUN_KIMI_LOCAL_INTEGRATION="0"
6 changes: 6 additions & 0 deletions configs/kimi-local-integration.host-config.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Minimal configuration for running the local-only Kimi integration
# entirely from the host ~/.kimi/config.toml setup.

KIMI_WORKER_DOCKER_IMAGE="kimi-cliagent-benchmark:latest"
CODEX_WORKER_MODEL="qwen3.5-plus"
RUN_KIMI_LOCAL_INTEGRATION="0"
18 changes: 18 additions & 0 deletions docs/kimi-local-integration-artifacts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Kimi Local Integration Artifacts

The local-only integration case writes its artifacts into the isolated worker job directory.

Expected files:

- `leader-task.md`
- `leader-task.json`
- `leader-task.result.txt`
- `codex.stdout.log`
- `codex.stderr.log`
- `codex.internal.log`
- `docker.stdout.log`
- `docker.stderr.log`
- `artifacts/local-case/report.txt`
- `artifacts/local-case/summary.json`

The script also prints the resolved job directory in its JSON output so the artifacts can be inspected after a run with `--keep-artifacts`.
17 changes: 17 additions & 0 deletions docs/kimi-local-integration-checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Kimi Local Integration Checklist

Before running the real local-only Kimi integration case, confirm:

- Docker daemon is reachable
- image `kimi-cliagent-benchmark:latest` exists locally or an equivalent image is configured
- host Kimi config exists at `~/.kimi/config.toml`, or `OPENAI_BASE_URL` and `OPENAI_API_KEY` are exported
- the repository is on the intended branch
- no GitHub token is required for this test

Recommended commands:

```bash
docker images | grep kimi-cliagent-benchmark
test -f ~/.kimi/config.toml && echo KIMI_CONFIG=OK || echo KIMI_CONFIG=MISSING
uv run --python python3.12 python scripts/run_kimi_local_integration.py
```
31 changes: 31 additions & 0 deletions docs/kimi-local-integration-troubleshooting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Kimi Local Integration Troubleshooting

## `ModuleNotFoundError: No module named 'src'`

Run the integration from repository root, or use:

```bash
uv run --python python3.12 python scripts/run_kimi_local_integration.py
```

The committed script already prepends the project root to `sys.path`.

## `Missing Kimi config at /host-kimi/config.toml`

Either:

- create and validate `~/.kimi/config.toml`
- or export `OPENAI_BASE_URL` and `OPENAI_API_KEY`

## Worker returns `completed` but `structured_output` is empty

The worker expects JSON. Kimi may wrap JSON in fenced code blocks. This repository now strips fenced markers before parsing, so update to the latest branch state if you still see this.

## Unexpected GitHub side effects

This local integration flow intentionally clears:

- `GH_TOKEN`
- `GITHUB_TOKEN`

If you still see GitHub activity, check for local script modifications or a different worker task payload.
Loading
Loading