Repository navigation
feat: split experimental flags into Beta and Experimental tiers - #5333
Conversation
🦋 Changeset detectedLatest commit: 00abdb9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 50afd1eb95
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 127feabe56
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 141d0d0127
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bd0008ed17
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: efd5e64db9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…a on configChanged
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c958f6c1ca
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce3cb6810b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…k /lab idle-only in docs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3cb028c21e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 43dba6f25a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f1b56e4aa
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
… vscode changeset
|
@codex review Changes since last review (
Previously resolved design boundaries (do not re-litigate):
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8375755aa
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f07b16fa7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e966991245
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
… via ConfigService
`bun scripts/upstream-ledger.mjs --refresh` at upstream/main 4eb2919 added 126 rows, so every open upstream commit and every PR it references now has a ledger row: 0/596, down from 125 at 8bf8ba3 and 126 at the fetched tip. The refresh only reads `upstream/main ^ main`, so the three release-2.6.2 commits named by the mission (MoonshotAI#4875/MoonshotAI#4905/MoonshotAI#4922) gained rows with the refresh's row shape. Settled with live probes in this tree: - ported: MoonshotAI#5533 (docs 2.8.1 changelog), MoonshotAI#4875 (registry search_url and feedback_url plus the feedback service), MoonshotAI#4905 (Kimi upload status validation in packages/core), MoonshotAI#4922 (swarm task events in sessionTaskFeed), MoonshotAI#5438 (unload only declared dynamic tools), MoonshotAI#5592 (dynamic tool replacement order), MoonshotAI#5595 (append-log known length), MoonshotAI#5573 (skill roots for every work dir), MoonshotAI#5576 (date reminder cwd comparison), MoonshotAI#5618 (session titles for skill openers), MoonshotAI#5638 (frozen loop tool baseline), MoonshotAI#5626 (legacy turn-input origins) - partial: MoonshotAI#5505 (processLiveness source and consumers present; the upstream unit test file was never carried), MoonshotAI#5571 (program-resume and OSC 7577 present; the upstream test helper was never carried), MoonshotAI#5532 (gitService half present; fsService still leaks the environment lease at fsService.ts:1133 and :1267), MoonshotAI#5557 (app-client icon registry kept; the move to app-ui was never carried) - not-applicable: MoonshotAI#4655 (upstream reverted auto review in MoonshotAI#5649), MoonshotAI#5333 (PLAYBOOK:111 deliberate flat experimental flags) M39's "likely present" list was checked, not trusted: MoonshotAI#5438 is present (upstream test passes), MoonshotAI#5487 is not (nativeStartSettleMs/leg.nativeSettled absent), MoonshotAI#5635 is not (ToolsSettled absent), MoonshotAI#5429 needs a visual probe. The remaining 194 pending rows stay open with their reasons; no feature was ported and no upstream-drift allowlist entry was added. Verification: verify -> 332 closed rows, 332 carry every file of their PR; 317 probes pass, 2 foreign-runner skips, 0 fail; a second verify is byte-identical (ledger sha256 cbf53638...). Probe tests 29 pass; bun run lint and node scripts/checks/ratchet.mjs green.
…er wording Review round 1 on 0083736e14. `--release-refresh` said it fetched tags but only fetched upstream main, so a checkout without the release tags failed at `git log <tag>`. It now fetches each tracked tag that is missing locally, one at a time: a bulk `--tags` fetch aborts because this fork has repointed tags, and force-overwriting one would rewrite the evidence a reviewed row rests on. The fixture test deletes the tags, re-fetches them through the new helper, and pins that a locally repointed tag is not overwritten. The changeset no longer says three new entries in the CLI: two commands are new there and the helpers live in scripts/lib/upstream-ledger-probes.mjs. MoonshotAI#5176's pending evidence now names the absent route half (persistSessionWrites and the :wait calls) instead of the engine helper, which does exist. The completion report is corrected: the main-ledger verify at this tip is 316 pass / 2 skipped / 1 fail, not green. The failure is MoonshotAI#5333, whose absent:experimentalFeatures probe now finds M34's experimentalFeatures; it reproduces identically on main 650c9ed, so it is pre-existing base drift and the main-ledger owner fixes that row in a separate mission. The release verify is unchanged and green: 44 probes pass, 0 skipped, 0 fail. Verified: release verify 44/0/0 exit 0; main verify 316 pass / 2 skipped / 1 fail (MoonshotAI#5333, exit 1); upstream-ledger-release 19 pass; upstream-ledger-probes 29 pass; bun run lint 0 warnings 0 errors on 7000 files; ratchet 404 rules / 41807 findings / nothing new.
…flags port M34 (merge f643d40) ported the server-driven two-tier experimental flag system, so MoonshotAI#5333's not-applicable probe absent:experimentalFeatures started failing on main: --verify reported 316 pass / 2 skipped / 1 fail. The row is partial, not ported: the per-PR file-completeness gate counts 3 of 115 files never carried by this fork - two tests/e2e specs (the upstream Playwright suite this fork does not carry; MoonshotAI#5380 records the same) and tests/scenarios/prompt-cache.test.ts (added upstream by MoonshotAI#5474 and never carried here). 107 files are carried and 5 changesets are exempt. The landed half is the whole feature: app-core ServerMeta types and daemon mapping, the kap-server /meta wire, the app-client store writing profile buckets, and the desktop Lab UI. The flat-flag deviation PLAYBOOK:111 recorded is retired by that port. The probe is the kap-server meta case asserting /meta reports experimental_beta and experimental_features with stage, effect_timing and source; approved_by is "M45 file-level audit". No changeset: ledger bookkeeping is not user-perceivable. Verified: bun scripts/upstream-ledger.mjs --verify -> 317 probes pass, 2 skipped, 0 probe fail, 0 completeness fail; a second run leaves the ledger byte-identical (sha256 d0f17e07...). bun test --timeout 30000 scripts/test/upstream-ledger-probes.test.ts -> 29 pass / 0 fail. bun run lint and node scripts/checks/ratchet.mjs green. The branch is based on main 7e56303 and carries no spawn-snapshot WIP.
Screenshots / Recordings
桌面端与 Web 端
设置 > 实验室(Settings > Lab)拆分为Beta 功能与实验性功能两档:各档标题旁内联展示阶段说明,Beta 功能区域右上角提供全部总开关(开启后联动并锁定下方的上下文用量、提示词预测,关闭后恢复各项原有独立配置):Desktop / Web English locale (`Settings > Lab`)
TUI
/lab(保留/experiments与/experimental别名)在Beta与Experimental分组标题旁内联展示阶段说明,Enable all Beta features保持作为Beta分组首项,并对需新会话或重启生效的开关标注new sessions/restart required:/lab(默认关闭)/lab(开启全部 Beta 功能)Requirement or Bug
此前所有实验性开关混在单一平铺列表中:打磨接近完成的功能与早期探索功能无法区分,同一台机器上 TUI 与 Desktop 共用平铺
[experimental]表会导致 Beta 总开关与同名实验开关跨端互相覆盖,Desktop 登录 Shell 环境变量探测也会把用户在~/.zshrc中为 CLI 导出的KIMI_CODE_EXPERIMENTAL_*带入桌面端并锁定 UI 开关,部分实验室开关散落在浏览器localStorage而无法跨端同步,KIMI_CODE_EXPERIMENTAL_FLAG=1也会把需要改变会话心智或重启生效的探索功能一并打开。本 PR 引入按客户端表面(
tui/desktop/web)声明的experimental/beta/ga三阶段生命周期、按宿主档案隔离的[experimental.cli]+[experimental.desktop]持久化子表与两档设置界面,将留在实验室内的全部开关统一收敛进FlagRegistry与config.toml,支持按端独立一键开启全部Beta功能且保留单个开关的独立配置,并在全端统一暴露开关生效时机。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
核心思路
将实验性开关重构为两个正交维度:
ExperimentalSurface = 'tui' | 'desktop' | 'web'):决定一个开关在哪些界面展示及其生命周期阶段(experimental/beta/ga)与生效时机(immediate/next-session/restart)。ExperimentalProfile = 'cli' | 'desktop'):决定持久化读写config.toml的哪张子表:[experimental.cli]:由 CLI 终端(kimi)、kimi web与kimi rc共享(kimi web继承 CLI 域配置)。[experimental.desktop]:由 Kimi Code Desktop 及其开启的 Remote Control Web(platform === 'kimi_code_desktop')共享;同时 Desktop 登录 Shell 环境变量探测(shell-env.ts)排除KIMI_CODE_EXPERIMENTAL_*,避免~/.zshrc中的 CLI 环境变量串扰锁定桌面端开关(显式KIMI_CODE_EXPERIMENTAL_*=1 pnpm dev:desktop仍正常生效)。各子表内的
beta = true配置键与当前进程的KIMI_CODE_EXPERIMENTAL_FLAG=1环境变量收敛为 Beta 总开关,采用非破坏性求值覆盖(开启时令当前表面处于beta阶段且未被单开关环境变量锁定的功能生效,关闭时回退到各开关原有的子表配置值);Experimental阶段功能仅响应自身的配置键或专属环境变量。因为 CLI 与 Desktop 已按子表天然隔离,所有跨端能力均保持单一规范 Flag ID(如统一使用notify_user/KIMI_CODE_EXPERIMENTAL_NOTIFY_USER,无需拆出_app变体)。当前 7 个注册开关在两档中的分布如下:
Enable all Beta features/[experimental.<profile>].beta与KIMI_CODE_EXPERIMENTAL_FLAG=1):prompt_prediction(tui/desktop/web,immediate)context_inspector(desktop/web,immediate)notify_user(tui/desktop/web,next-session)session_mentions(desktop/web,immediate)sidebar_multi_tab(desktop/web,immediate)wait_for(tui,immediate)tower(tui/desktop/web,restart)原存于浏览器
localStorage的context_inspector、session_mentions与sidebar_multi_tab统一注册进FlagRegistry并持久化到当前宿主档案的[experimental.<profile>],客户端在首次拉取/api/v1/meta时对旧版localStorage已开启的值执行一次性迁移并清理旧键。旧版平铺[experimental]顶层布尔键在读取时自动归一化(CLI 专属历史键notify_user/wait_for仅归入cli,其余共享键归入未显式覆盖的cli/desktop)。对升级前已在现有安装中通过KIMI_CODE_EXPERIMENTAL_FLAG=1使用tower的用户,启动时按宿主档案一次性迁移写入[experimental.<profile>] tower = true。概念
ExperimentalProfileconfig.toml的哪张实验子表'cli'([experimental.cli]:kimi/kimi web/kimi rc)或'desktop'([experimental.desktop]:Desktop 及其 Remote Control Web)ExperimentalSurface'tui' | 'desktop' | 'web';未声明某表面的开关不在该表面的实验列表与exposedIds()中展示ExperimentalStage'experimental'(默认关,仅单独开启)、'beta'(默认关,跟随 Beta 总开关或单独开启)、'ga'(默认开且不再作为实验项列出,仅可被单开关环境变量覆盖)ExperimentalEffectTiming'immediate'(立即热重载)、'next-session'(新会话生效)、'restart'(需重启进程;active与enabled分离以提示待重启)[experimental.<profile>].beta/KIMI_CODE_EXPERIMENTAL_FLAG)结构图
flowchart LR subgraph Engine["agent-core-v2"] Cfg["ConfigService<br/>读写 [experimental.cli / desktop]"] Reg["FlagRegistry<br/>stages + effectTiming"] Svc["FlagService<br/>按 profile 求值 + 旧 MASTER_ENV 下 tower 迁移"] end subgraph Facades["SDK & Daemon"] SDK["klient + node-sdk<br/>getExperimentalFeatures / BetaState"] KAP["kap-server GET /api/v1/meta<br/>experimental_beta(profile) + experimental_features"] end subgraph Clients["客户端界面"] TUI["TUI /lab (/experiments)<br/>写入 [experimental.cli]"] App["app-core + app-client + SettingsDialog<br/>按 meta.profile 写入 cli / desktop"] end Cfg <--> Svc Reg --> Svc Svc --> SDK --> TUI Svc --> KAP --> App关键决策
config.toml中划分为[experimental.cli](kimi+kimi web+kimi rc)与[experimental.desktop](Desktop + Desktop Remote Control Web),并在 Desktopshell-env.ts中排除登录 Shell 的KIMI_CODE_EXPERIMENTAL_*[experimental]表并通过拆出notify_user_app等_app后缀开关规避冲突beta总开关与所有同名开关(notify_user、prompt_prediction、tower等)在 CLI 与 Desktop 之间天然完全隔离,无需为跨端功能复制双份 Flag ID,同时kimi web与 TUI、Desktop Remote Control 与 Desktop 各自保持一致的预期继承关系source: 'beta-config' | 'master-env')KIMI_CODE_EXPERIMENTAL_FLAG=1存量tower兼容profile将tower = true落盘到[experimental.<profile>]并写入~/.kimi-code/experimental-migrations.json标记;配置或标记文件损坏时临时回退进程级环境变量而不误打标记KIMI_CODE_EXPERIMENTAL_FLAG=1继续开启 Experimental 档,或直接断掉存量用户的towertower用户升级不断裂,又让全新安装从一开始遵循“KIMI_CODE_EXPERIMENTAL_FLAG=1只管 Beta”的新契约阅读指南
packages/agent-core-v2/src/app/flag/flagRegistry.ts、bootstrap.ts与flag.ts:理解ExperimentalProfile、ExperimentalSurface、ExperimentalStage、ExperimentalEffectTiming及[experimental.cli]/[experimental.desktop]Schema 与旧版平铺键归一化逻辑。packages/agent-core-v2/src/app/flag/flagService.ts:理解单开关环境变量 →ga→ Beta 总开关 → 当前profile子表配置 → 默认false的完整求值顺序、active/exposedIds计算,以及存量KIMI_CODE_EXPERIMENTAL_FLAG=1用户通过ConfigService.set执行的一次性tower = true迁移与内存回退。packages/kap-server/src/routes/{registerApiV1Routes,config}.ts、apps/desktop/src/main/system/shell-env.ts与packages/app-client/src/stores/config.ts:理解/api/v1/meta下发experimental_beta.profile、/api/v1/config原样保留嵌套 snake_case flag ID、Desktop 登录 Shell 隔离,以及前端按当前profile落盘与旧localStorage迁移。apps/kimi-code/src/tui/components/dialogs/experiments-selector.ts与apps/desktop/src/renderer/components/settings/SettingsDialog.vue:理解 TUI 与 Desktop/Web 两端的分组交互和锁定提示。具体变化大纲
FlagService.evaluate的求值顺序变化如下:evaluate(def, stage) if parseBooleanEnv(env[def.env]) is defined return { enabled: envOverride, source: 'env', env: def.env } + if stage === 'ga' + return { enabled: true, source: 'default', env: def.env } + if stage === 'beta' && betaState().enabled + return { enabled: true, source: betaState().source === 'env' ? 'master-env' : 'beta-config', env: def.env } - if config[def.id] is defined - return { enabled: config[def.id], source: 'config' } - if parseBooleanEnv(env[KIMI_CODE_EXPERIMENTAL_FLAG]) === true - return { enabled: true, source: 'master-env' } - return { enabled: def.default, source: 'default' } + if config[profile][def.id] is defined + return { enabled: config[profile][def.id], source: 'config', env: def.env } + return { enabled: false, source: 'default', env: def.env }GET /api/v1/meta在保留原有experimental_flags布尔字典的基础上增量扩展两个字段(HOST_API_LEVEL仍为1):Behavior Changes and Affected Users
config.toml实验配置结构与跨端隔离[experimental]表,CLI 与 Desktop 互相覆盖;Desktop 会从登录 Shell(如~/.zshrc)导入KIMI_CODE_EXPERIMENTAL_*[experimental.cli](kimi/kimi web/kimi rc)与[experimental.desktop](Desktop 及其 Remote Control Web);旧版平铺键读取时自动归一化(notify_user/wait_for仅归入cli,共享键归入双端);Desktopshell-env忽略登录 Shell 中的KIMI_CODE_EXPERIMENTAL_*[experimental]配置的用户(读取自动兼容),以及依赖~/.zshrc中export KIMI_CODE_EXPERIMENTAL_*控制桌面端的用户Settings > Lab或[experimental.desktop]中持久化开启,或以显式进程环境变量启动桌面端WaitFor工具(wait_for)默认开关状态default: true,所有入口默认向模型暴露WaitFor工具stages: { tui: 'experimental' },所有入口默认关闭,且不再随KIMI_CODE_EXPERIMENTAL_FLAG=1开启kimi -pprint 模式、Desktop/Web、ACP、SDK 用户/lab(或/experiments)开启、在config.toml设[experimental.cli] wait_for = true,或设KIMI_CODE_EXPERIMENTAL_WAIT_FOR=1KIMI_CODE_EXPERIMENTAL_FLAG=1的作用范围prompt_prediction、wait_for、tower、notify_user)Beta阶段功能(TUI:prompt_prediction;Desktop/Web:context_inspector、prompt_prediction)并锁定 Beta 总开关;不再开启Experimental阶段功能。有存量安装痕迹且设了KIMI_CODE_EXPERIMENTAL_FLAG=1的用户首次启动自动写入[experimental.<profile>] tower = trueKIMI_CODE_EXPERIMENTAL_FLAG=1期望开启notify_user、wait_for的环境变量用户,以及在全新空目录安装上仅设KIMI_CODE_EXPERIMENTAL_FLAG=1期望开启tower的用户KIMI_CODE_EXPERIMENTAL_NOTIFY_USER=1、KIMI_CODE_EXPERIMENTAL_WAIT_FOR=1、KIMI_CODE_EXPERIMENTAL_TOWER=1)或[experimental.<profile>].<id> = truecontext_inspector、session_mentions、sidebar_multi_tab存储位置localStorageconfig.toml的[experimental.<profile>](context_inspector为beta,session_mentions与sidebar_multi_tab为experimental);首次同步/api/v1/meta时自动迁移旧localStorage并清理旧键Settings > Lab、config.toml的[experimental.<profile>]或对应环境变量控制/experiments命令,平铺展示所有注册开关/lab(保留/experiments与/experimental别名),分为Beta与Experimental两组并写入[experimental.cli]/experiments用户/experiments与/experimental别名继续可用@moonshot-ai/kimi-code-sdk与agent-core-v2实验开关类型导出FlagDefinitionInput含default/surface;ExperimentalFeatureState含surface/defaultEnabled;experimental为平铺布尔字典FlagDefinitionInput改为stages/effectTiming;ExperimentalFeatureState改为stage/effectTiming/active;BetaMasterSwitchState含profile: 'cli' | 'desktop';experimental为{ cli?, desktop? }experimental对象的 TypeScript SDK 调用方experimental.cli/experimental.desktop及stage、effectTiming、active、getExperimentalBetaState()存量配置升级与首次运行核对矩阵
针对升级前常见的存量配置与环境变量组合,跨 4 种运行入口(
kimiTUI、kimi web/rc、Dock/Finder 启动 Desktop、终端命令启动 Desktop)逐一推演并验证了首次运行表现:kimiTUI /kimi web/kimi rc(cli档案)desktop档案)VAR=1 pnpm dev:desktop)[experimental](如tower = true、prompt_prediction = true、notify_user = true、wait_for = false)experimentalFromToml将全部键归入cli,tower当场组装激活(/tower立即可用),其余开关原样生效。首次修改落盘时自动转为[experimental.cli]+[experimental.desktop]且不丢另一端键值tower、prompt_prediction自动归入desktop并当场生效;wait_for与notify_user属于LEGACY_CLI_ONLY_EXPERIMENTAL_KEYS仅归入cli(旧版 Desktop 曾开平铺notify_user = true的用户桌面端回落关闭,可在设置中重开写入[experimental.desktop])~/.zshrc设export KIMI_CODE_EXPERIMENTAL_FLAG=1config.toml或sessions/credentials/user-history)且未配tower时,首次启动原子写入[experimental.cli] tower = true并记录experimental-migrations.json(幂等单次,后续手动关闭不反弹;只读文件回退进程级内存KIMI_CODE_EXPERIMENTAL_TOWER=1;全新安装仅打标记不开启tower)。Beta 总开关被环境变量锁定开启,prompt_prediction(及 Web 的context_inspector)生效;notify_user、wait_for按新契约保持关闭;CLI 更新灰度旁路继续生效shell-env.ts拦截登录 Shell 的/^KIMI_CODE_EXPERIMENTAL_/:.zshrc的FLAG=1不进入进程,Beta「全部」开关保持关闭且可自由点击;仅靠.zshrcFLAG=1(未写config.toml)的用户不会向[experimental.desktop]自动迁入tower(保持.zshrc不串扰桌面端)mergeShellEnv保留父进程已有process.env:显式传入的FLAG=1正常锁定开启 Beta,并在存量安装下对desktop桶执行一次性tower = true迁移~/.zshrc逐项设export KIMI_CODE_EXPERIMENTAL_*=1source: 'env'),/lab与 Web 设置界面显示开启并置灰锁定;已设KIMI_CODE_EXPERIMENTAL_TOWER时迁移器记stamped-noop不改盘[experimental.desktop]独立读写localStorage实验开关(context_inspector、session_mentions、sidebar_multi_tab)kimi web首次同步/api/v1/meta时,若cli桶未显式配置且localStorage为开启值,前端乐观开启并异步写入[experimental.cli]后清除旧键/api/v1/meta时乐观开启并异步写入[experimental.desktop]后清除旧键;迁入后同一内嵌 server 下的 Remote Control Web 自动共享wait_for由默认开启改为默认关闭,其余均默认关闭;未知布尔键静默忽略,手改非布尔值/非法子表由ConfigService.buildValidated按 section 隔离告警回退,不阻断启动或其他配置受影响模块与验证结论
受影响模块涵盖
packages/agent-core-v2(flag、config、notify、promptPrediction、tokenCounting、sessionIndex、tower、task-wait)、packages/klient、packages/node-sdk、packages/kap-server、packages/acp-server、packages/app-core、packages/app-client、packages/app-i18n、apps/kimi-code(TUI/lab)与apps/desktop(shell-env及SettingsDialog)。已在 macOS 本地与 Linux / Windows CI 完成全链路验证:覆盖双档案隔离、平铺旧配置归一化、存量
KIMI_CODE_EXPERIMENTAL_FLAG=1的tower单次幂等迁移与只读/损坏回退、Desktop 登录 ShellKIMI_CODE_EXPERIMENTAL_*过滤、浏览器localStorage一次性迁移、TUI/lab与 Desktop/WebSettings > Lab两档交互及真实渲染截图核验。测试覆盖清单
packages/agent-core-v2/test/app/flag/flag.test.ts:[experimental.cli]/[experimental.desktop]双桶隔离、旧平铺键归一化(含LEGACY_CLI_ONLY_EXPERIMENTAL_KEYS)、experimental/beta/ga求值优先级、Beta 总开关非破坏性覆盖、migrateLegacyMasterEnvTower按profile幂等迁移、全新安装跳过、只读/损坏/软硬链接异常回退。apps/desktop/tests/main/system/shell-env.test.ts:登录 Shell 探测过滤KIMI_CODE_EXPERIMENTAL_*并保留父进程显式环境变量。apps/desktop/tests/renderer/lab-settings.test.ts、packages/app-client/test/workspace-state.test.ts、packages/app-core/test/configClient.test.ts:Desktop / Web 两档分组与阶段说明渲染、Beta「全部」开关联动与回退、环境变量锁定态提示、restart生效时机active/enabled分离、旧localStorage键值一次性迁移与清理。apps/kimi-code/test/tui/commands/experiments.test.ts、apps/kimi-code/test/tui/components/dialogs/experiments-selector.test.ts、apps/kimi-code/test/tui/commands/resolve.test.ts:TUI/lab(含/experiments、/experimental别名)两档分组、内联阶段说明、Beta 总开关联动、写入[experimental.cli]及热重载行为。packages/kap-server/test/meta.test.ts、packages/kap-server/test/apiSurface.test.ts、packages/node-sdk/test/sdk-rpc-client-v2.test.ts:/api/v1/meta扩展字段与profile下发、/api/v1/config原样保留嵌套 snake_case flag ID、SDK 实验特性查询契约。packages/agent-core-v2/test/agent/task/tools/task-tools.test.ts、packages/agent-core-v2/test/features/notify/tools/notify-user.test.ts、packages/agent-core-v2/test/features/tower/towerFeature.test.ts:wait_for默认关闭与动态开关、notify_user统一 Flag ID 跨表面生效、tower组装激活与exposedIds行为。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.