[Bug] kimi -p /goal exits 0 while the goal is still active

オープン 初心者向け
#5,062 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
cli

調査の方向性

apps/kimi-code/src/cli/goal-prompt.ts の goalExitCode と、apps/kimi-code/test/cli/goal-prompt.test.ts のテストから始めてください。active が docs/en/guides/interaction.md に記載された終了コードにどう対応すべきか確認し、その後 pnpm -C apps/kimi-code exec vitest run test/cli/goal-prompt.test.ts を実行してください。active な goal がゼロ以外のステータスで終了し、その動作が成功するテストでカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

What version of Kimi Code is running?

2.6.3 (source main snapshot, 2026-11-18). Confirmed with a unit test.

Which open platform/subscription were you using?

None involved.

Which model were you using?

None involved.

What platform is your computer?

Windows 11 x64.

What issue are you seeing?

kimi -p "/goal ..." can exit with status 0 while the goal is still active.

When the goal does not reach a terminal state before print_wait_ceiling_s, applyPrintBackgroundPolicy warns print goal wait ceiling reached and returns. runNativeGoalTurn then calls goalExitCode('active'), which falls through to the default and returns 0. CI therefore sees success for an incomplete goal.

What steps can reproduce the bug?
  1. Run a goal that will not finish quickly:

    kimi -p "/goal <long-running objective>"
    
  2. Set a small print_wait_ceiling_s, or let the default ceiling expire.

  3. Observe the print goal wait ceiling reached warning.

  4. The process exits 0, and the goal summary still has status: active.

A unit-level reproduction is:

expect(goalExitCode('active')).toBe(GOAL_EXIT_CODES.complete); // currently passes, but is wrong

Running:

pnpm -C apps/kimi-code exec vitest run test/cli/goal-prompt.test.ts

with:

it('does not report success for an active goal', () => {
  expect(goalExitCode('active')).not.toBe(GOAL_EXIT_CODES.complete);
});

fails with expected +0 not to be +0.

What is the expected behavior?

A non-terminal goal should not exit with the success code. The docs currently define 0 for complete, 3 for blocked, and 6 for paused. active should either map to a non-zero code (for example paused, or a new incomplete code) or the process should keep waiting until the goal reaches a terminal state.

Additional information

Relevant code:

  • apps/kimi-code/src/cli/goal-prompt.ts — GOAL_EXIT_CODES / goalExitCode
  • apps/kimi-code/src/cli/v2/run-v2-print.ts — goal wait ceiling and exit-code assignment
  • packages/agent-core-v2/src/features/goal/goalOps.ts — active is a valid non-terminal status

The documented exit-code contract is in docs/en/guides/interaction.md (0 complete, 3 blocked, 6 paused), and the changelog for #1704 says kimi -p "/goal ..." stays alive until the goal reaches a terminal state.

Contribution
  • I am willing to submit a PR for this bug fix myself. I will wait for a maintainer's /approve in this issue before opening the PR.
主要言語
TypeScript
スター
8.3k
フォーク
1.4k
平均マージ
12時間 6分
マージ済み PR(30日)
596

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MoonshotAI/kimi-code のほかの issue

MoonshotAI/kimi-code の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。