Skip to content

feat(cli): foreground-only web servers, deprecated kimi server kill - #1967

Merged
sailist merged 1 commit into
MoonshotAI:mainfrom
sailist:feat/web-foreground-only-server
Jul 20, 2026
Merged

feat(cli): foreground-only web servers, deprecated kimi server kill#1967
sailist merged 1 commit into
MoonshotAI:mainfrom
sailist:feat/web-foreground-only-server

Conversation

@sailist

@sailist sailist commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — the problem is explained below.

Problem

After the kimi web command tree made every server a foreground process, the daemon-era management surface lost its purpose, but two gaps remained:

  • The TUI /web command still offered to attach the session to an already-running server, keeping a second, harder-to-reason-about handoff path.
  • kimi web kill / kimi web ps manage background instances that the foreground model no longer creates, while the servers that actually need a kill path — background servers left behind by builds before 0.28.0, recorded in the legacy ~/.kimi-code/server/lock — were invisible to them.

What changed

  • /web now always starts a new server: the TUI exits and the current process becomes the server in the foreground, then opens the session deep link once it is listening. The instance picker is gone.
  • Removed kimi web kill and kimi web ps; foreground servers stop with Ctrl+C, and the ready banner plus the --dangerous-bypass-auth warning now say so. kimi web rotate-token is kept.
  • Kept kimi server kill as the one working command of the deprecated kimi server tree: it only stops servers started by a version before 0.28.0 (best-effort POST /api/v1/shutdown, then SIGTERM → SIGKILL on the pid recorded in the legacy lock, sweeping the lock file once the process is confirmed dead), and prints a deprecation notice with the 0.28.0 cutoff on every run.
  • Updated the en/zh command reference and added changesets.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7753eff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

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

@sailist
sailist force-pushed the feat/web-foreground-only-server branch from 11cf1c8 to d8c6f76 Compare July 20, 2026 13:30

@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: 11cf1c802c

ℹ️ 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 on lines +233 to +235
if (typeof parsed.pid !== 'number') return undefined;
return {
pid: parsed.pid,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Validate legacy lock PIDs before signaling

When <KIMI_CODE_HOME>/server/lock is corrupt (pid: 0 or negative) or stale after the OS has reused the recorded PID, this accepts the value as long as it is a number and the command later sends SIGTERM/SIGKILL to it. On POSIX, 0/negative PIDs have process-group semantics, and a reused positive PID may belong to an unrelated user process, so kimi server kill can terminate the wrong process. Please only accept positive safe integer PIDs and verify the process still matches the recorded legacy server (for example via start time/entry) before signaling.

Useful? React with 👍 / 👎.

Comment thread .changeset/server-legacy-kill.md Outdated
@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Mark removed web subcommands as breaking

This changeset declares a patch release while the same change removes kimi web kill and kimi web ps, so existing scripts invoking those CLI commands will fail after what semver advertises as a safe patch upgrade. The repository rules explicitly classify removed commands/arguments as major-version changes; either keep deprecated stubs for this release or make this a confirmed major changeset.

Useful? React with 👍 / 👎.

@pkg-pr-new

pkg-pr-new Bot commented Jul 20, 2026

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

commit: 7753eff

- the /web slash command now always starts a new server instead of offering to reuse a running one
- remove the kimi web kill and kimi web ps subcommands; foreground servers stop with Ctrl+C
- keep kimi server kill as a deprecated fallback that only stops servers started by a version before 0.28.0 (recorded in the legacy server lock)
@sailist
sailist force-pushed the feat/web-foreground-only-server branch from d8c6f76 to 7753eff Compare July 20, 2026 13:40
@sailist
sailist merged commit ad8cc85 into MoonshotAI:main Jul 20, 2026
14 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 20, 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.

1 participant