Skip to content

docs(cli): document that --prompt runs in auto permission mode#2191

Open
Nas01010101 wants to merge 2 commits into
MoonshotAI:mainfrom
Nas01010101:docs/2099-prompt-auto-permission-mode
Open

docs(cli): document that --prompt runs in auto permission mode#2191
Nas01010101 wants to merge 2 commits into
MoonshotAI:mainfrom
Nas01010101:docs/2099-prompt-auto-permission-mode

Conversation

@Nas01010101

@Nas01010101 Nas01010101 commented Jul 25, 2026

Copy link
Copy Markdown

Related Issue

Resolve #2099

Problem

See linked issue.

Non-interactive runs force auto permission mode, so every tool call is approved without prompting regardless of default_permission_mode. This is deliberate — a non-interactive run has nobody to answer an approval prompt — but it was never written down, and -y/--yolo and --auto read as the explicit opt-ins, so -p looks like it should inherit the documented manual default.

Both engines do it:

  • v1 — forcePromptPermission in apps/kimi-code/src/cli/run-prompt.ts
  • v2 — forceAuto in apps/kimi-code/src/cli/v2/run-v2-print.ts

While writing this up I also found that the documented mutual-exclusion list is incomplete: apps/kimi-code/src/cli/options.ts rejects --prompt combined with --yolo, --auto and --plan, but the docs list only --yolo and --plan.

What changed

Documentation only — no behaviour change.

  • -p, --prompt help text now states that it runs in auto permission mode and that tool calls are approved without prompting.
  • docs/{en,zh}/configuration/overrides.md: the -p, --prompt row says the same, and --auto is added to the mutual-exclusion list so it matches what options.ts actually enforces.
  • docs/{en,zh}/configuration/config-files.md: the default_permission_mode row notes that non-interactive runs always use auto regardless of the setting.

The issue offered two possible resolutions — respect default_permission_mode, or document the auto-approval. This PR takes the documentation route, since the current behaviour looks intentional and changing it would break unattended -p users. Happy to follow up with the behavioural change instead if you'd prefer that direction.

Testing

No behaviour change, so there is nothing new to test. pnpm lint and pnpm typecheck are clean, and no test or snapshot asserts on the -p help string.

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. — documentation and one help string; no behaviour to test.
  • Ran gen-changesets skill, or this PR needs no changeset. — patch changeset added for @moonshot-ai/kimi-code, since the CLI help text is user-visible.
  • Ran gen-docs skill, or this PR needs no doc update. — this PR is the doc update; both en and zh are covered.

Non-interactive runs force auto permission mode on both engines
(forcePromptPermission in run-prompt.ts for v1, forceAuto in
run-v2-print.ts for v2), so every tool call is approved without
prompting regardless of default_permission_mode. Neither the -p help
text nor the permission docs said so, and -y/--auto read as the
explicit opt-ins.

Also add --auto to the documented --prompt mutual-exclusion list; the
CLI already rejects that combination in options.ts but the docs listed
only --yolo and --plan.

Closes MoonshotAI#2099
@changeset-bot

changeset-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5e9b84f

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

@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: 4da9b2a534

ℹ️ 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 apps/kimi-code/src/cli/commands.ts Outdated
new Option(
'-p, --prompt <prompt>',
'Run one prompt non-interactively and print the response.',
'Run one prompt non-interactively and print the response. Runs in auto permission mode: tool calls are approved without prompting.',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve deny-rule exceptions in the auto-mode wording

When config.toml contains a matching permission.rules deny rule, -p does not approve that tool call: both policy chains evaluate configured denies before auto approval (packages/agent-core/src/agent/permission/policies/index.ts:38-41 and packages/agent-core-v2/src/agent/permissionPolicy/permissionPolicyService.ts:48-50). The new help text—and the matching documentation—therefore incorrectly promises that tool calls are approved; qualify this as automatic approval only for calls not blocked by deny rules.

AGENTS.md reference: AGENTS.md:L9-L10

Useful? React with 👍 / 👎.

Both permission chains order UserConfiguredDeny ahead of AutoModeApprove
(packages/agent-core/src/agent/permission/policies/index.ts,
packages/agent-core-v2/src/agent/permissionPolicy/permissionPolicyService.ts),
so a deny rule still blocks a tool call under -p. Saying approvals happen
unconditionally overstated it.
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.

-p silently forces permission mode "auto", auto-approving all tool calls (undocumented)

1 participant