Skip to content

feat: add minimum version upgrade prompts - #4756

Merged
liruifengv merged 3 commits into
mainfrom
feat/client-upgrade-policy
Nov 10, 2026
Merged

liruifengv merged 3 commits into
mainfrom
feat/client-upgrade-policy

Conversation

@liruifengv

Copy link
Copy Markdown
Collaborator

Requirement or Bug

Interactive CLI users whose installed version falls below an independently configured minimum need a clear upgrade path instead of relying on passive update discovery and rollout timing. This PR adds a named client_upgrade_policy configuration with separate CLI and Desktop minimums, plus an interactive upgrade prompt that can always be skipped for the current launch after a 10-second countdown.

No tracking issue; this is an internal product feature request.

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

The change separates the minimum allowed version (client_configs) from the available update version (the existing CDN feed). The new forced path runs before passive updates only for interactive TUI launches, uses the current release channel without rollout gating, and leaves print mode, CI, unsupported source checkouts, and all other subcommands on their existing paths.

flowchart TD
    A[client_upgrade_policy] --> B[Shared schema and semver check]
    B --> C{Interactive and below minimum?}
    C -- No --> D[Existing passive update flow]
    C -- Unsupported source --> D
    C -- Yes --> E[Refresh current-channel feed]
    E --> F{Target meets minimum?}
    F -- No --> G[Error, retry, or timed skip]
    F -- Yes --> H[Install or timed skip]
Loading
Decision Choice Alternative not used Reason
Policy transport Named client_configs JSON Extend CDN latest.json Operations can change or clear the minimum independently of release artifacts and CDN caching.
Non-interactive runs No policy request or prompt Block with an upgrade error kimi -p and CI keep their existing behavior and never wait on interactive UI.
Unsupported install source Return to passive updates Show a forced prompt with no install action Source checkouts cannot safely self-update, so they retain the existing manual-update behavior.
Escape hatch In-memory skip after 10 seconds Persist a skipped version Every launch rechecks the policy; a skip affects only the current run.
Target validation Require the CDN target to meet the minimum Install the newest target unconditionally Prevents an upgrade loop when the release channel has not published a satisfying version.

Reading order:

  1. packages/product/src/client-configs/node/upgrade-policy.ts — shared wire schema, independent field parsing, and semver boundary.
  2. apps/kimi-code/src/cli/update/forced.ts — policy check, target validation, retries, skip behavior, and telemetry.
  3. apps/kimi-code/src/cli/update/forced-prompt.ts — terminal choices and countdown behavior.
  4. apps/kimi-code/src/cli/main.ts — the narrow interactive-startup integration point.
  5. packages/kap-server/src/services/clientConfigs.ts — registration of the same named config for daemon consumers.

The remaining changes are focused tests and dependency metadata for the shared semver parser.

Screenshots / Recordings

A forced prompt when a satisfying target exists:

Kimi Code Upgrade Required
This version must be upgraded before continuing.
Current  2.5.1
Minimum  2.5.2
Target   2.5.2

↑↓ choose · Enter confirm

❯ Install update now (2.5.2)
  Skip for this run (8s)

When the channel has not published a satisfying target, the primary action becomes Retry update; the same countdown gates Skip for this run.

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
Interactive TUI below the configured minimum Passive update rules could delay or skip installation A forced prompt bypasses rollout and offers install or timed skip Interactive npm/pnpm/yarn/bun/native users on an affected version Skip for this run after 10 seconds; next launch prompts again
Interactive unsupported source below the minimum A manual update notice could appear The forced flow is skipped and the existing passive notice remains Source checkouts and unsupported package layouts Existing manual update command
kimi -p and CI No interactive update prompt Unchanged; no policy request, countdown, or block Headless scripts and CI jobs No action needed
KIMI_CODE_NO_AUTO_UPDATE Disabled automatic update behavior Does not disable the new minimum-version policy Users who set the env var and fall below the minimum Timed per-run skip
CDN target below the configured minimum Newest available target could be installed without satisfying policy Installation is rejected as not ready and retry/skip is offered Users starting during a policy/release mismatch Retry or timed per-run skip
Config absent, malformed, or unreachable No forced policy Unchanged; the affected client fails open Offline users and older config deployments No action needed
Other CLI subcommands and kimi upgrade Existing command behavior Unchanged ACP, export, web, login, doctor, migration, and explicit upgrade callers No action needed

Coverage:

  • Shared parsing: independent CLI/Desktop fields, invalid values, equality, ordering, and prerelease comparison.
  • kap-server: named config registration and normalized cloud response.
  • CLI: non-interactive bypass, unsupported-source fallback, rollout bypass, per-run skip, insufficient target rejection, prompt countdown, and main-entry integration.
Verification
  • 27 product client-config tests passed.
  • 14 kap-server client-config tests passed.
  • 84 CLI main/update/prompt tests passed.
  • Typechecks passed for product, kap-server, and the CLI.
  • Product and kap-server targeted builds passed.
  • Changed-file oxlint and git diff --check passed.
  • The real test-environment response was parsed successfully as cliMinVersion=0.6.0 and desktopMinVersion=1.2.0.
  • No full-repository build, lint, or test run was performed.

Changeset: intentionally omitted per repository owner request. gen-docs was run, but its required docs/scripts/sync-changelog.mjs was absent, so no generated changelog or manual replacement was added.

Checklist

  • I have read the CONTRIBUTING document.
  • Related issue: N/A, internal product feature request.
  • 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 with its escape hatch.
  • Changeset intentionally omitted per repository owner request.
  • Ran gen-docs; its changelog sync prerequisite was unavailable, so no generated docs were changed.

Copilot AI lite review requested due to automatic review settings November 9, 2026 09:21
@changeset-bot

changeset-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 7d8ec55

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 Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T10:27:10.416521Z 7d8ec55 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 Nov 9, 2026 •

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

commit: 7d8ec55

Copilot AI 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.

🟡 Changes recommended

Active issues remain in forced-update channel resolution and retry-state handling, and missing main-handler coverage leaves key escape-hatch branches unverified.

3 open issues
1 file not reviewed
  • pnpm-lock.yaml: Generated file
What changed in this PR

Adds a cloud-controlled minimum-version policy for interactive CLI launches. Users below the configured minimum can install a qualifying release, retry when necessary, or skip the requirement for the current launch after a countdown.

Changes:

  • Adds shared client_upgrade_policy parsing and semver comparison for independent CLI and Desktop minimums.
  • Registers the policy with kap-server and adds product/server coverage.
  • Implements forced upgrade preflight, target validation, retries, telemetry, installation, and timed per-launch skipping.
  • Adds the interactive prompt, startup integration, dependency metadata, and focused tests.
File Description Final review notes
pnpm-lock.yaml Locks the new semver dependencies. No final review comment.
packages/​product/​test/​client-configs.test.ts Tests policy parsing and version comparisons. No final review comment.
packages/​product/​src/​client-configs/​node/​upgrade-policy.ts Defines the shared upgrade-policy schema and semver checks. No final review comment.
packages/​product/​src/​client-configs/​node/​index.ts Exports the upgrade-policy module. No final review comment.
packages/​product/​package.json Adds semver runtime and type dependencies. No final review comment.
packages/​kap-server/​test/​clientConfigs.test.ts Tests policy registration and response normalization. No final review comment.
packages/​kap-server/​src/​services/​clientConfigs.ts Registers client_upgrade_policy for server consumers. No final review comment.
apps/​kimi-code/​test/​cli/​update/​prompt.test.ts Tests forced-prompt countdown and keyboard behavior. No final review comment.
apps/​kimi-code/​test/​cli/​update/​preflight.test.ts Tests forced preflight decisions, retries, skips, and target validation. No final review comment.
apps/​kimi-code/​test/​cli/​main.test.ts Updates main-command mocks for forced preflight integration. Nit, 2 votes: Add coverage for skip-passive suppressing passive updates and exit stopping the shell.
apps/​kimi-code/​src/​cli/​update/​forced.ts Implements policy checks, feed refresh, validation, installation, retries, and telemetry. Moderate [P1], 2 votes: Resolve the forced check through the same source-aware channel resolver as the passive updater. Nit [P2], 2 votes: Clear targetVersion before each new feed check to prevent stale target data in the prompt and telemetry.
apps/​kimi-code/​src/​cli/​update/​forced-prompt.ts Implements the interactive forced-upgrade selector and countdown. No final review comment.
apps/​kimi-code/​src/​cli/​main.ts Runs forced upgrade handling before passive update checks for interactive startup. Nit, 2 votes: Add main-handler coverage for the new forced-result branches.

Review effort: Lite

Comment thread apps/kimi-code/src/cli/update/forced.ts Resolved
Comment thread apps/kimi-code/src/cli/main.ts Resolved
Comment thread apps/kimi-code/src/cli/update/forced.ts Resolved

@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: 9b83084204

ℹ️ 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/main.ts Resolved
Comment thread apps/kimi-code/src/cli/update/forced.ts Resolved
Comment thread apps/kimi-code/src/cli/update/forced.ts Resolved
Comment thread apps/kimi-code/src/cli/update/forced.ts Resolved
@liruifengv

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: 76b8de9301

ℹ️ 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/main.ts Resolved
@liruifengv

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: 7d8ec55190

ℹ️ 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/main.ts Resolved
@liruifengv

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 7d8ec55190

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

@liruifengv
liruifengv merged commit 61e4047 into main Nov 10, 2026
27 of 29 checks passed
@liruifengv
liruifengv deleted the feat/client-upgrade-policy branch November 10, 2026 05:31
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 11, 2026
Ingest the 15 upstream commits landed after the 2.5.3 release sync and
cluster the open backlog into themed batches. Three rows stay unassigned
pending a scope decision: prediction (MoonshotAI#4754, six packages), upgrade
prompts (MoonshotAI#4756), and the desktop-titled retry fix (MoonshotAI#4831) whose content
lives in agent-core-v2/kap-server.
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.

3 participants