fix: ask mode tool filtering not excluding edit/write when specific-pattern rules exist#317
Open
kiloconnect[bot] wants to merge 1 commit intodevfrom
Open
fix: ask mode tool filtering not excluding edit/write when specific-pattern rules exist#317kiloconnect[bot] wants to merge 1 commit intodevfrom
kiloconnect[bot] wants to merge 1 commit intodevfrom
Conversation
…attern rules exist The disabled() function in PermissionNext was finding the last rule matching a permission regardless of pattern, then checking if it had pattern='*' and action='deny'. When .kilocodeignore or user config added specific-pattern rules for edit permission (e.g. deny *.log), these came after the ask agent's wildcard deny in the merged ruleset. findLast would find the specific-pattern rule, and since pattern!='*', the tool was not disabled. Fix: find the last wildcard rule (pattern='*') for the permission, and only keep the tool enabled if there's a specific-pattern ALLOW after it. Specific- pattern deny rules no longer prevent tool removal.
Contributor
Author
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In ask mode, write tools like
edit,write, andbash/shell should be removed from the available tool list. However, when a user has.kilocodeignorepatterns or user config with specific-pattern permission rules foredit, the tools were not being properly excluded.The error message showed:
Root Cause
The
PermissionNext.disabled()function finds the last rule matching a permission (viafindLast) and checks if it haspattern === "*" && action === "deny".When
.kilocodeignoremigration or user config adds specific-pattern rules foreditpermission (e.g.,{ permission: "edit", pattern: "*.log", action: "deny" }), these come after the ask agent's{ permission: "*", pattern: "*", action: "deny" }in the merged ruleset.findLastwould find the specific-pattern rule, and sincepattern !== "*", the tool was not disabled.Fix
Changed
disabled()to:pattern === "*") matching the permissionSpecific-pattern deny rules (from
.kilocodeignore, etc.) no longer prevent tool removal.Testing
Built for Evgeny Shurakov by Kilo for Slack