Skip to content

fix(agent-core): fix plan mode auto review bug#1151

Open
hewlett-packard-lovecraft wants to merge 1 commit into
MoonshotAI:mainfrom
hewlett-packard-lovecraft:fix/auto-mode-plan-mode-exception
Open

fix(agent-core): fix plan mode auto review bug#1151
hewlett-packard-lovecraft wants to merge 1 commit into
MoonshotAI:mainfrom
hewlett-packard-lovecraft:fix/auto-mode-plan-mode-exception

Conversation

@hewlett-packard-lovecraft

@hewlett-packard-lovecraft hewlett-packard-lovecraft commented Jun 27, 2026

Copy link
Copy Markdown

Related Issue

Resolve #(1150)

Problem

See linked issue.

If in Auto mode before entering Plan mode, ExitPlanMode automatically approves the plan and begins executing. In contrast, YOLO mode still shows the Plan Review prompt, so only Auto mode auto-execs plan

This is a bug - the docs for Plan mode mention that exiting Plan mode will always require user approval

What changed

  1. in packages/agent-core/src/agent/permission/policies/exit-plan-mode-review-ask.ts, remove an early-return if in auto mode
  2. in packages/agent-core/src/agent/permission/policies/index.ts , make sure that exit-plan-mode-review-ask runs before auto-mode-approve

update various tests:

  1. test/agent/permission.test.ts:
  • make sure that order of exit-plan-review-ask in asserted array is updated to match the new order (between user-configured-deny and auto-mode-approve)
  • edit ExitPlanMode permission policy test, copied over existing "requests plan-review approval in yolo mode" test for auto mode
  1. test/agent/plan.test.ts
  • update plan exit tool test to expect to request plan review before exiting plan mode in auto mode
  1. packages/agent-core/test/tools/planning/exit-plan-mode-telemetry.test.ts
  • update telemetry to match new behaviour

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.

@hewlett-packard-lovecraft hewlett-packard-lovecraft changed the title fix: change plan mode auto review behaviour - adjusted tests fix: change plan mode auto review behaviour Jun 27, 2026
@changeset-bot

changeset-bot Bot commented Jun 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 32747c4

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 Minor

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

@hewlett-packard-lovecraft hewlett-packard-lovecraft changed the title fix: change plan mode auto review behaviour fix(agent-core): change plan mode auto review behaviour Jun 27, 2026
@hewlett-packard-lovecraft hewlett-packard-lovecraft changed the title fix(agent-core): change plan mode auto review behaviour fix(agent-core): fix plan mode auto review behaviour Jun 27, 2026
@hewlett-packard-lovecraft hewlett-packard-lovecraft changed the title fix(agent-core): fix plan mode auto review behaviour fix(agent-core): fix plan mode auto review bug Jun 27, 2026
@hewlett-packard-lovecraft

Copy link
Copy Markdown
Author

@codex

@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: 32747c4c52

ℹ️ 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 thread packages/agent-core/src/agent/permission/policies/index.ts
@hewlett-packard-lovecraft

Copy link
Copy Markdown
Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 32747c4c52

ℹ️ 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".

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.

Bug: if in auto mode before entering plan mode, ExitPlanMode automatically approves the plan

1 participant