Skip to content

[Bug] kimi upgrade exits 0 without upgrading in non-TTY environments — automation cannot detect the no-op #2629

Open

Description

@sunny0826

Summary

In non-TTY environments (piped stdin/stdout), kimi upgrade prints the manual-update message and exits with code 0 without performing any update. Automation (CI scripts, desktop apps, wrappers) that only checks the exit code cannot distinguish "upgrade succeeded" from "upgrade was a no-op", and will silently report success while the CLI is still on the old version.

Environment

  • OS: macOS (darwin-arm64)
  • Install method: official script (~/.kimi-code/bin, native install)
  • Version: 0.31.1 -> 0.32.0

Steps to reproduce

kimi upgrade < /dev/null        # stdin/stdout not a TTY

Output:

A newer version of @moonshot-ai/kimi-code is available (0.31.1 -> 0.32.0).
Detected install source: native (windows). Auto-update is not supported on this platform.
To update manually, run: curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash
echo $?   # → 0, but `kimi --version` is still 0.31.1

For comparison, under a PTY (script -q /dev/null kimi upgrade) the CLI works as expected: it shows the interactive update menu (Source: native, Command: curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash) because canAutoInstall("native", "darwin") returns true.

Root cause

apps/kimi-code/src/cli/sub/upgrade.ts: the manual branch is taken when !canAutoInstall(...) || !isInteractive, where isInteractive = process.stdin.isTTY && process.stdout.isTTY. For piped/automation calls isInteractive is false, so the CLI always falls into the manual-message branch and returns 0.

Note this is different from (and not covered by) #2391: install-source detection is not broken on macOS — the misleading native (windows) text is just a hardcoded template in renderManualUpdateMessage. The real blocker for automation is the TTY gate combined with exit code 0.

Expected behavior

For automation, one of the following would work:

  1. A non-interactive flag (e.g. kimi upgrade --yes) that runs the install without prompting, or
  2. A non-zero exit code (or machine-readable output) when the command did not actually update, so callers can detect the no-op.

Impact

Any tool that invokes kimi upgrade programmatically (CI pipelines, desktop apps like myTauri app, package managers) will falsely report "upgrade completed" while the CLI remains outdated — with no error surfaced to the user.

Related: #2391 (misleading platform text in the manual message), #2409 (text-only fix; does not address the non-TTY exit-code behavior).

Activity

  1. changed the title [-]kimi upgrade exits 0 without upgrading in non-TTY environments — automation cannot detect the no-op[/-] [+][Bug] kimi upgrade exits 0 without upgrading in non-TTY environments — automation cannot detect the no-op[/+] on Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions