Skip to content

fix(agent-core-v2): honor configured permission rules - #2337

Open
gunnlace wants to merge 1 commit into
MoonshotAI:mainfrom
gunnlace:fix/configured-permission-rules
Open

gunnlace wants to merge 1 commit into
MoonshotAI:mainfrom
gunnlace:fix/configured-permission-rules

Conversation

@gunnlace

Copy link
Copy Markdown

Related Issue

Fixes #2100

Problem

See linked issue.

What changed

Load configured permission rules into the effective Agent permission rule view alongside live runtime rules.

This keeps configured rules outside the persisted Agent wire state, so resumed agents continue to read the current configuration without duplicating or retaining stale rules.

Added regression coverage for merging configured and runtime rules, and for approving a configured MCP tool before the manual-mode fallback.

Manually verified in kimi web that an MCP call prompts without an allow rule and executes without prompting after adding the matching rule.

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 Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ee0cc67

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

@Comandante-Supremo

Copy link
Copy Markdown

AI answer, but i've been fighting it all day...

Thanks for taking this on. One question about scope, in case it hasn't already been settled offline: does this fix cover Bash tool calls in the interactive TUI, or is it scoped to kimi web + MCP tools as #2100's title implies?

Context: on 0.43.0 (darwin arm64, native install, interactive TUI, default_permission_mode = "yolo"), a [[permission.rules]] deny at position 1 whose pattern exactly matches a Bash call does not fire. The tool executes; the wire shows zero permission-check events between tool.call and tool.result. Full repro just posted on #3820. This matches the "addRules() has zero production callers; bindBootstrap injects only defaultPermissionMode" trace from #2070 (comment 2026-08-02) and #3435, so I'd expect this PR to fix it if it covers the interactive TUI + Bash path.

The two commenters on #2100 who asked about Bash + VS Code coverage never got a direct answer in-thread; wanted to raise it once more before this merges since #3820's evidence and mine both hit the interactive TUI + Bash path specifically, which is a broader safety surface than kimi web + MCP.

If the PR already covers that surface: happy to test against the branch and post back a repro run. If not: worth widening the scope before merge, given how many issues (#2070, #2099, #3435, #3820) converge on the same interactive-TUI-v2 root cause.

@glmn

glmn commented Oct 7, 2026

Copy link
Copy Markdown

We need this too. NeuroSquad (a desktop app that runs Kimi Code in terminal panes) pre-approves its own MCP tools with an allow rule in [[permission.rules]], and since the rule is parsed but never applied, the app currently answers each approval dialog by sending "Approve for this session" into the terminal. We were going to propose a fix ourselves, but since this PR already covers it, we'll wait for the maintainers' decision instead of duplicating it. Happy to verify it on Windows/macOS.

This branch has not been deployed

No deployments
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.

kimi web Manual mode ignores user-configured [[permission.rules]] allow rules (over-prompts)

3 participants