Repository navigation
fix(cli): report foreground web shutdown failures - #5434
Merged
Merged
Conversation
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. |
🦋 Changeset detectedLatest commit: 032cdba The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
commit: |
7723qqq
pushed a commit
to 7723qqq/kimi-code
that referenced
this pull request
Nov 25, 2026
…ndency Expose TestProcess and its options from the fixtures entry so CLI suites can spawn the product entrypoint. MoonshotAI#5434 stays in_progress: its regression test needs the signal-import support the testkit wave will add, and the fork's localized shutdown path needs a message/exit reconciliation with the upstream body.
7723qqq
pushed a commit
to 7723qqq/kimi-code
that referenced
this pull request
Nov 25, 2026
MoonshotAI#5359 and MoonshotAI#5404 need the fork's loop/ACP shapes (LiveTurn state machine, session extensions), MoonshotAI#5434 depends on testkit signal imports, and MoonshotAI#5332 needs a merged SessionAction table. Each is in_progress with the precise remaining work rather than a forced apply.
7723qqq
pushed a commit
to 7723qqq/kimi-code
that referenced
this pull request
Nov 25, 2026
Port the upstream regression suite onto the fork's localized shutdown path: the none/server/hook cases assert the exit code and the reported failing step, and TestProcess now materializes data-URL preloads to files so the Windows signal preload reaches the child (Bun ignores data: with --import). Verified: foreground-shutdown 3 pass, apps/kimi-code and testkit typecheck clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Screenshots / Recordings
实际前台子进程的关闭结果
0,stderr 为空0,stderr 为空0,stderr 为空1,stderr 包含Kimi web: server shutdown failed:及系统错误0,stderr 为空1,stderr 包含Kimi web: foreground shutdown hook failed:及错误原因Requirement or Bug
前台
kimi web的服务关闭或关闭钩子抛错时,默认日志级别会隐藏错误,命令仍返回成功。调用方需要用退出码区分正常关闭和清理失败。回归记录 002。Bug Reproduction Steps
kimi web --port 0 --no-open,等待前台横幅打印监听地址。SIGINT。基线退出码为0,stderr 为空。Root Cause
前台关闭路径捕获钩子和服务错误后写服务日志,并固定调用
process.exit(0)。默认级别为silent。服务关闭与遥测刷新还在同一个try中,服务关闭抛错会跳过刷新。Code Changes
flowchart LR Signal[前台关闭请求] --> Hook[关闭钩子] Hook --> Close[KAP 服务关闭] Close --> Telemetry[尽力刷新遥测] Telemetry --> Result{清理结果} Result -->|全部成功| OK[退出 0] Result -->|钩子或服务抛错| Error[写入并刷新 stderr] Error --> Failed[退出 1]在
startServerForeground已有的关闭流程里,按原有顺序执行关闭钩子和 KAP 服务关闭,每个阶段独立记录错误。随后调用现有遥测关闭逻辑。有清理错误时,用 CLI 已有的标准流刷新工具把失败阶段和原因送出,再退出。Behavior Changes and Affected Users
01kimi web与--remote-control用户,读取--json输出并检查退出码的调用方,TUI/web和/remote-control启动的前台服务Verification
本地验证在以
e105ef0d2为基线的 macOS 工作树中进行,用系统信号驱动真实前台子进程。基线的服务清理和钩子失败用例都返回0,stderr 为空。修复后覆盖正常关闭、服务清理失败、钩子失败后继续删除服务注册,以及诊断与标准输出分离。SIGINT和SIGTERM,全部通过。pnpm lint、CLI 构建与包产物 smoke、双语文档构建通过。Checklist