feat: allow tool white-listing in plan mode via settings - #7
Open
mystilleef wants to merge 3 commits into
Open
mystilleef wants to merge 3 commits into
mystilleef wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds settings-driven tool whitelisting for plan mode, updates how the agent’s active tool set and plan-mode prompt are derived, and extends the test suite to cover these behaviors.
Changes:
- Introduces
getActiveTools()to compute plan-mode tools fromplanMode.toolWhitelistplus safe defaults, while excludingwrite/edit. - Uses the computed active tool list during agent startup and renders the plan-mode prompt’s “Available tools” section dynamically.
- Adds Vitest-based tests for whitelist filtering and plan-mode tool blocking behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| plan-mode.ts | Adds settings-based active tool computation and applies it to agent startup, prompt content, and tool-call enforcement. |
| plan-mode.test.ts | Adds tests for tool whitelist filtering and tool-call behavior in plan mode (with room to extend coverage for non-whitelisted tools). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Read planMode.toolWhitelist from ~/.pi/agent/settings.json instead of non-existent ctx.settingsManager API - Validate whitelist with Array.isArray before filtering - Block non-whitelisted tools explicitly in tool_call hook - Remove getAllTools filtering that excluded extension tools - Add test for blocking non-whitelisted tools - Mock node:fs in tests instead of settingsManager Refs: qmx#6
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.
This pull request enhances the configurability and test coverage of plan mode's tool whitelisting logic. It introduces support for a customizable tool whitelist (excluding inherently unsafe tools like
writeandedit), updates the agent's available tool list and prompt accordingly, and adds comprehensive tests for these behaviors.Plan mode tool whitelist improvements:
getActiveToolsfunction inplan-mode.tsto compute the active tool list based on aplanMode.toolWhitelistsetting, always including safe defaults (read,bash) and filtering outwriteandediteven if whitelisted.tool_callhook to permit only whitelisted tools (except forwrite/edit, which are always blocked), and to apply additional safety checks forbash.Test coverage:
plan-mode.test.tsto verify correct filtering of whitelisted tools, proper blocking ofwrite/edit, and the behavior of thetool_callhook when plan mode is active.vimock utility fromvitestto support the new tests.