[Feature] Add session diagnostics and safe repair (kimi session inspect / kimi doctor --session)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- cli
調査の方向性
Start by reading the existing kimi session command and session wire handling, then compare the referenced reports #5064, #5065, #3181, and #269 to understand the failure cases. The issue proposes several inspection checks and a limited repair path, but names no source files or tests. Done means the CLI can inspect and safely repair sessions, report each change, and cover these cases with tests.
索引モデルが issue の本文から書いたものです。
説明
What feature would you like to see?
Add session diagnostics and safe repair:
kimi session inspect <sessionId> [--json]
kimi doctor --session <sessionId> [--repair]
kimi doctor --unlock <sessionId>
inspect should parse the session wire and report a human-readable + JSON summary of:
- message count by role, tool exchanges, and the latest turn / step state;
- orphaned tool calls and tool results (a
tool_call_idwith no matching message); - provider-order problems that make requests invalid (for example Gemini's "function call turn must come immediately after a user turn or a function response turn");
- duplicate tool calls and duplicate tool results within one turn;
- steps that ended without a finish reason, or turns whose last step is still open;
- token ledger consistency: measured anchors vs the provider's reported usage vs the reported context size (compare with #5064);
- messages that were deferred by the replay fold and then dropped when a compaction record was applied (compare with #5065);
- skipped/corrupt wire lines, and which raw records they displaced (compare with #3181);
- session lock state and whether the recorded owner PID is still alive.
--repair should only perform the safe subset: synthesize an interrupted tool result for an unresolved call, drop orphaned tool results, clear a stale lock whose owner is dead, and optionally truncate at a known-corrupt tail. It should print exactly what it changed.
kimi doctor --unlock <sessionId> should clear a stale lock even when the rest of the session is healthy.
Additional information
Why this is worth adding: the engine's failure modes are mostly discovered after the fact from wire.jsonl, and currently there is no first-class way to inspect or repair a session. kimi export produces a zip, and kimi session only supports list; both are useful for attaching evidence, but neither tells the user or a maintainer what is actually wrong.
Real examples from this week:
- after a force-kill during tool execution on Windows, the session lock file remained and the next resume failed with "This session is in use by another Kimi Code CLI instance"; deleting
~/.kimi-code/locks/sessions/<id>.lockby hand was the only recovery; - a resumed session with an interrupted tool call + a task-notification turn produced a provider-side
400 function call turn comes immediately after a user turn or after a function response turnduring compaction, leaving the session unable to continue; - the wire had to be folded manually to prove that a user message was dropped by compaction (#5065).
There is an open report about a single torn wire line making the whole session unloadable (#3181), and #269 is the classic orphan-tool-call case; both fit naturally under this command. PR #5058 adds a context usage view and server-side inspection routes, which helps the UI but does not provide a CLI diagnostic/repair path for a broken session.
I checked the tracker for session diagnostics/inspection and found no existing request. I understand external feature PRs are not accepted; I am only proposing the feature and can provide concrete wire examples for every check listed above.
- 主要言語
- TypeScript
- スター
- 8.3k
- フォーク
- 1.4k
- 平均マージ
- 12時間 6分
- マージ済み PR(30日)
- 596
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MoonshotAI/kimi-code のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
MoonshotAI/kimi-code#5539 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] Kimi RC workspace folder picker does not display symbolic link directories対応中かも @markankamaransheogarat-sys が 2 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
MoonshotAI/kimi-code#5296 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
MoonshotAI/kimi-code#5256 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
MoonshotAI/kimi-code#5062 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
MoonshotAI/kimi-code#5057 ·
メンテナーはふだん 1 日以内に返信
MoonshotAI/kimi-code の issue をすべて見る
似ている issue
-
Add Alice&Botオープン
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
slavakurilyak/awesome-ai-agents#1048 ·
-
bot:ai-assisted component:faucet github_actions security status:untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
midnightntwrk/midnight-faucet-api#215 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NanmiCoder/cc-haha#2034 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
mobile prio:low
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
digitalfabrik/entitlementcard#3324 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信