Skip to content

fix(kap-server): apply plan mode from prompt submissions - #2869

Open
Hexthebaldy wants to merge 2 commits into
MoonshotAI:mainfrom
Hexthebaldy:fix/web-plan-mode-prompt
Open

fix(kap-server): apply plan mode from prompt submissions#2869
Hexthebaldy wants to merge 2 commits into
MoonshotAI:mainfrom
Hexthebaldy:fix/web-plan-mode-prompt

Conversation

@Hexthebaldy

Copy link
Copy Markdown

Related Issue

Resolve #2658

Problem

When Plan Mode is enabled before sending the first prompt of a new Web session, the frontend includes plan_mode: true in the prompt submission. However, the prompt route did not apply this value before starting the turn.

As a result, the Web UI still appeared to be in Plan Mode, but the first prompt ran in normal mode. Existing sessions were unaffected because toggling Plan Mode there also updates the session profile before the next prompt.

What changed

  • Apply the submitted plan_mode value before enqueueing the prompt.
  • Enter or exit Plan Mode only when the requested value differs from the agent's current state.
  • Add regression tests for enabling Plan Mode on a new session's first prompt and disabling an active Plan Mode.
  • Add a patch changeset for @moonshot-ai/kimi-code.

This keeps prompt submissions consistent with the existing session profile update path.

Validation

  • pnpm exec vitest run packages/kap-server/test/prompts.test.ts
  • pnpm --filter @moonshot-ai/kap-server test — 1026 tests passed
  • pnpm typecheck
  • pnpm lint
  • Manually verified the new-session Plan Mode flow in the Web UI
a6771242876e0ae61ce5e89d3776ee37

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 Aug 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 91dfc68

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

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.

web 模式, 新建session, 启用plan模式, 输入任意提示词开始会话后, plan模式自动退出

1 participant