fix(cli): honor external directory allows in Ask mode#9838
Merged
marius-kilocode merged 2 commits intomainfrom May 4, 2026
Merged
fix(cli): honor external directory allows in Ask mode#9838marius-kilocode merged 2 commits intomainfrom
marius-kilocode merged 2 commits intomainfrom
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Reviewed by gpt-5.5-20260423 · 301,951 tokens |
lambertjosh
approved these changes
May 4, 2026
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.
Summary
external_directoryapprovals when Ask/Plan hard rules evaluate the external-directory boundary check.*deny for theexternal_directorypermission check, while explicitexternal_directorydenies still win.Regression
This regressed after #9556 (
fix(cli): harden ask and plan modes). That PR correctly made Ask/Plan hard-deny writes even when session or saved permissions would otherwise allow them, but the mode-wide*deny also started hard-vetoing external-directory read approvals.The failing user flow was:
permission.external_directory["/tmp/kilo-external-permission-smoke/*"] = "allow".The user has specified a rule which prevents you from using this specific tool call, even though the directory was explicitly approved.Fix
The fix keeps the stricter Ask/Plan hard rules for actual tools like
editand mutatingbash, but evaluates theexternal_directoryboundary permission without the Ask/Plan mode-wide*deny. Permission-specific denies still apply, soexternal_directory["/path/*"] = "deny"continues to block access.Manual Testing
Used a local fixture outside the worktree:
/tmp/kilo-external-permission-smoke/legacy-service.ts.external_directoryallow for the fixture path: read succeeded without a hard permission denial.external_directorydeny for the fixture path, after reloading the window so config was refreshed: read failed with the permission-rule denial.Automated Testing
bun test test/kilocode/permission/next.always-rules.test.tsbun test test/kilocode/permission/external-directory-allow.test.ts test/tool/read.test.ts test/tool/bash.test.ts test/tool/external-directory.test.tsbun run typecheckfrompackages/opencodebun run script/check-opencode-annotations.ts