MoonshotAI / MoonshotAI/kimi-code

Bug: `config.toml` 里 `[experimental] tower = true` 无法启用 tower 模式,只能用环境变量

Open
#3,373 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

What version of Kimi Code is running?

Kimi Code CLI 0.39.1(native binary,Linux x64)

Which open platform/subscription were you using?

kimi auth

Which model were you using?

k3

What platform is your computer?

native binary,Linux x64

What issue are you seeing?

~/.kimi-code/config.toml 中写:

[experimental]
tower = true

后启动 kimi/experiments 面板会显示 Tower mode · enabled · config,但执行 /tower on/tower <目标> 时报错:

Error: Failed to enable tower mode: tower mode could not be enabled — the tower feature is unavailable in this process, or another live session owns the workspace tower

这里「another live session owns the workspace tower」是误导信息:当前目录没有 .tower/,没有 state.json,也没有其他正在运行的 kimi 进程。

What steps can reproduce the bug?
复现步骤
  1. 确保 ~/.kimi-code/config.toml 中有 [experimental] tower = true,且环境变量 未设置 KIMI_CODE_EXPERIMENTAL_TOWER
  2. 进入任意有 ≥1 次 commit 的 git 仓库,运行 kimi
  3. /experiments → Tower mode 显示 enabled · config
  4. /tower on → 报上面的错误 ❌
  5. 退出,用 KIMI_CODE_EXPERIMENTAL_TOWER=1 kimi 重新启动,/tower on → 成功 ✅

同一目录、同一二进制、同一 config,唯一变量是启动方式。

What is the expected behavior?

No response

Additional information
疑似根因

tower 功能服务似乎只在进程启动时组装一次,并且只读取环境变量isTowerFeatureAssembled(flags) / assembledFlagServices);而 config.toml 里的 [experimental] 标志是在之后合并进 flag 服务的。/experiments 面板读的是合并后的状态,所以显示「enabled · config」,但 feature 组装快照已经完成,当时 tower flag 仍是关闭状态。

总开关 KIMI_CODE_EXPERIMENTAL_FLAG=1 同样有这个问题,也只认环境变量。

其他 [experimental] 标志(如 tool-selectsubagent_fork)从 config 启用是正常的——tower 特殊之处在于它需要启动期服务组装。

建议
  • [experimental] 标志也纳入启动期组装路径;或者
  • 报错信息区分「启动时 flag 未开」和「工作区被其他会话占用」;或者
  • /experiments 面板提示 tower 需要环境变量才能生效。
临时 workaround
export KIMI_CODE_EXPERIMENTAL_TOWER=1
# 建议写进 ~/.bashrc
Contribution
  • I am willing to submit a PR for this bug fix myself (please wait for maintainer approval in this issue first)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the startup paths named in the report: isTowerFeatureAssembled(flags) and assembledFlagServices, then compare them with the later config.toml flag merge. Reproduce with [experimental] tower = true and without KIMI_CODE_EXPERIMENTAL_TOWER; done means /tower on works without the environment variable and the misleading ownership error is avoided.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.