Skip to content

feat: add independent dev release channel - #4425

Merged
Grapedge merged 8 commits into
mainfrom
cli-canary
Oct 27, 2026
Merged

Grapedge merged 8 commits into
mainfrom
cli-canary

Conversation

@Grapedge

@Grapedge Grapedge commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

将 stable 与 main 的 dev 构建拆成独立发布线,并确保跨渠道更新必须经用户确认。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

发布侧只接受任务开始时 main 的最新提交及其已通过的 CI。dev 版本固定为 0.0.0-dev.<run_number>,不再参考 stable 版本、changeset 或时间戳。

latest main + successful CI
  -> native artifacts for six platforms
  -> GitHub prerelease with dev.json
  -> external CDN publisher updates channels/dev.json

Re-run the same workflow
  -> keep the same version and publishedAt
  -> resume when the Release is incomplete
  -> reject an older run when a newer dev release exists

客户端将渠道解析、更新决策和安装授权放在同一条数据流中。

 check for updates
-  compare stable and canary feeds and install the higher version
+  resolve the selected channel from install source, installed version, and private configuration
+  read only that channel
+  same channel: install only a newer version
+  different channel: show source, target, and version, then require confirmation

native stage 显式保存目标 channel 和确认信息。swap 使用同一个 decideUpdate() 重新判断,未确认的跨渠道 stage 即使版本更高也不会安装。

安装来源检测先使用不启动子进程的路径和 SEA 判断,只有出现可安装更新时才补做 npm prefix 检测。CDN 请求的超时现在覆盖 headers 和完整 body,避免响应体卡住时无限等待。npm 发布开关保留但先关闭,先联调 GitHub Release 与仓外 CDN。仓外 CDN 上传和首次安装脚本仍由仓外流程负责。

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
main 开发构建发布 没有独立 dev 发布线 只发布最新 main 且 CI 通过的提交,版本来自 run number main/dev 测试用户与发布维护者 stable 的 latest 与 release 分支流程不变
stable 默认更新 读取 stable,按现有 rollout 更新 不变 所有 stable 用户 不需要
dev 默认更新 dev 可能被更高 stable hotfix 替换 默认跟随当前 dev 安装,只读取 dev,不与 stable 比较 main/dev 测试用户 不需要
dev 获取失败 回退 stable 或按版本取高 本次检查失败,不改用 stable main/dev 测试用户 使用同一 dev 缓存或稍后重试
跨渠道切换 可能被当作普通升级或后台安装 显示源渠道、目标渠道和目标版本;交互确认或显式 --yes 后才安装 显式切换发布线的用户 拒绝确认、非交互不切换
自动与后台更新 可能按版本号跨渠道安装 只允许同渠道自动更新 开启自动更新的用户 同渠道行为不变;跨渠道改为确认
Homebrew 渠道选择 可能进入 dev 提示 始终使用 stable,忽略私有渠道配置,不推荐改装其他包管理器 Homebrew 用户 不需要
native stage 与换装 只按版本顺序和单向 intent 判断 stage 保存目标渠道;双向确认切换才可跨渠道安装 native 的 main/dev 测试用户 重新下载带新元数据的 stage;旧试验 stage 不兼容且没有外部使用者
native dev 更新指引 显示 stable 安装器 显示能明确选择 dev 的更新命令 native 的 main/dev 测试用户 stable 仍使用原安装器
安装来源检测 可能提前执行 npm prefix -g 先走路径/SEA 判断,只有可安装更新出现时才补做 npm prefix npm 或未知布局的 CLI 用户 无更新时不执行 npm prefix,Homebrew 行为不变
CDN 超时 headers 返回后不再覆盖 body 等待 headers 与 body 共用超时,失败按检查错误处理 网络不稳定或响应体卡住的用户 重试或使用手动安装命令
发布重跑 tag 存在可能跳过半成品 Release,或旧 run 覆盖新入口 完整 Release 才跳过;部分 Release 补齐;旧 run 不能覆盖新 dev 发布维护者 查询故障时直接失败,不继续发布

旧路径的功能清单及去向:stable /latest.json 与 /latest 回退、stable rollout、缓存渠道标记、非法值警告、包管理器精确版本安装、native 校验与原子换装均保留。stable/dev 取高、dev 故障回退 stable、单向切换、dev 专用 rollout bypass 和 degraded 状态删除。私有渠道配置不写入公开文档或 changeset。

测试覆盖:

  • scripts/release-trigger.test.mjs、scripts/dev-release.test.mjs 共 13 项,覆盖 main/CI 限制、run number 版本、完整与部分 Release、查询错误及旧 run 防护。
  • CLI 更新相关 15 个测试文件共 320 项,覆盖 stable 回归、双向切换、Homebrew、后台确认、native stage/swap、主入口、安装来源检测和响应体超时。
  • 额外场景脚本直接调用真实 fetchChannelFeed()、decideUpdate() 和 decidePassiveUpdate(),验证 stable hotfix 不影响 dev、dev 故障不读取 stable、Homebrew 使用 stable。
  • pnpm lint 0 errors,monorepo pnpm typecheck 通过,CLI pnpm build 通过,三个 workflow YAML 均通过解析,构建产物 dist/main.mjs --version 正常运行。

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Read the canary pointer alongside latest.json when the channel is canary,
skip staged rollout for it, keep the update cache per channel, and let
`kimi update` switch a canary build back to stable after confirmation.
Unset or stable keeps the existing behavior.
Build the newest CI-green main commit as <base>-canary.<UTC stamp>, publish
it as a GitHub prerelease with a canary.json record, and optionally publish
it to npm under the canary dist-tag. _native-build.yml accepts an explicit
commit and version.
@changeset-bot

changeset-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 1cad974

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T23:55:41.773221Z 1cad974 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@1cad974
npx https://pkg.pr.new/@moonshot-ai/kimi-code@1cad974

commit: 1cad974

@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: a1190da65e

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

Comment thread scripts/canary-release.mjs Resolved
Comment thread .github/workflows/canary.yml Resolved
Comment thread apps/kimi-code/src/cli/update/select.ts Resolved
…publish re-runnable

Select and record now run from the dispatched revision while the selected
commit is only read as build input, so an older green commit still builds.
A re-run skips an npm version that already exists and re-uploads assets to
an existing release. The non-interactive switch hint keeps the stable
channel, and a degraded canary pointer is logged on every refresh path.
@Grapedge

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: f920716d82

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

Comment thread scripts/canary-release.mjs Resolved
RealKai42
RealKai42 previously approved these changes Oct 26, 2026
@Grapedge Grapedge changed the title feat: add a canary update channel and release workflow feat: add independent dev release channel Oct 26, 2026
@Grapedge

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 9387719670

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

Comment thread apps/kimi-code/src/cli/update/select.ts Resolved
Comment thread .github/workflows/dev-release.yml Resolved
@Grapedge

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 8938f36c89

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

Comment thread apps/kimi-code/src/cli/update/select.ts Resolved
@Grapedge

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 1cad974ca7

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

@Grapedge
Grapedge merged commit 9793044 into main Oct 27, 2026
16 checks passed
@Grapedge
Grapedge deleted the cli-canary branch October 27, 2026 05:06
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 5, 2026
Port of upstream MoonshotAI/kimi-code 9793044 (MoonshotAI#4425) with the rest of
the chain it opened: b9fa2b1 (MoonshotAI#4469), 84a392e (MoonshotAI#4490),
ebe14e1 (MoonshotAI#4504) and f695b1f (MoonshotAI#4512). They land together because each
one rewrites files the previous introduced, and the dev->canary rename in
the middle would otherwise create and delete the same script twice.

A release channel is now part of every update decision. `stable` keeps the
existing CDN /latest + /latest.json feed; `canary` reads the
/channels/canary.json pointer and never falls back to stable, because the two
are different release lines. The rename from `dev` to `canary` (MoonshotAI#4490) is
part of this landing, so the channel name, the CDN pointer and the canary
release script's `-canary.` version suffix all agree. The channel comes from the installed version's prerelease
tag, KIMI_CODE_UPDATE_CHANNEL, or the homebrew install source (always
stable); an unusable value warns and keeps the installed channel. A pointer
for another channel is a switch, not an upgrade, and only the interactive
prompt can act on it.

The update cache and the staged native record both carry the channel, so a
stage downloaded for one line is never adopted by the other, and the hidden
downloader takes --channel / --switch-channel alongside --manual. Rollout
gating stays off for a switch. The canary release script derives its base
version from `changeset status` and refuses a run that would replace a
newer published canary.

CI gains a scripts-tests job: the root test run covers the workspace
packages only, so scripts/test (release trigger, canary release) had no job
running it anywhere.

Local-form notes:
- The fork's update tree was restructured by 8c865f4 (MoonshotAI#2994 staged
  swap): preflight injects spawn/clock through PreflightDeps, the install
  lock and auto-install gates live in install-lock.ts / auto-install.ts,
  and main() moved to cli/main.ts. The ported code keeps that shape
  instead of upstream's parameter lists.
- All new copy goes through t() with en/zh keys (14 new keys) rather than
  upstream's literals, because check:no-hardcoded-prose is a baseline gate
  here. Regenerating that baseline after the change lowers sub/upgrade.ts
  from 8 to 7 literals (the install failure message is localized now) and
  rewrites the digests of update/cdn.ts and update/native-swap.ts for
  reworded diagnostics.
- The CDN URL helpers live in constant/region-urls.ts here, not
  constant/app.ts, so kimiCodeCdnDevChannelUrl is added there.
- The fork prompts from the cache and revalidates after the user accepts,
  so the tests pin the prompt at the cached plan and the install at the
  refreshed one; upstream refreshes before prompting.
- ci.yml gets a bun scripts-tests job instead of upstream's node
  release-workflow-tests, and the canary workflow uses bun plus
  `bun pm pkg set` / `bun publish` in place of pnpm and node. The canary
  publish keeps upstream's repository_owner guard, so this fork's CI never
  publishes; per AGENTS.md the release/publish commands themselves are
  still not run from this repository.
- native-stage's two new guards are localized too, since the baseline is
  shrink-only and may not absorb new literals.

Verified: apps/kimi-code typecheck clean apart from two untouched TUI test
files (footer/welcome) that are already red at HEAD; test/cli/update 14
files 215 pass, update-download 20, upgrade 17, native-stage 34/1 skip,
scripts suite 228; oxlint --type-aware 0 errors on the touched files;
check:no-comments, check:no-hardcoded-prose, check:locale-keys,
check:locale-placeholders, check:t-coverage and check:status-surface-i18n
green.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 5, 2026
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.

4 participants