Repository navigation
Keep bash off, and monitor with it, in sessions without bash - #442
Merged
Merged
Conversation
The bash override was registered while the extension loaded, and pi activates every tool an extension registers at load and at /reload, regardless of the session's tool selection. With `defaultTools: ["read"]`, `--no-builtin-tools` or `--tools -bash` the model was still sent `bash`, and a `bash` turned off during the session came back after /reload. The override is now registered at session_start only. A tool registered there under the name of an already registered tool replaces its definition and keeps its active state, on pi 0.80.5 as on 1.5.0, so `bash` is active exactly where pi's own `bash` is.
`monitor` and `task_stop` run and stop shell commands, and pi activates them on registration. With `defaultTools: ["read"]`, `--no-builtin-tools` or `--tools -bash` the model was sent `task_stop` and `monitor` although the session has no `bash`. At session_start each tool is now removed from the active set when `bash` is not in it. Nothing is activated, so a tool turned off stays off, and a session with `bash` is unchanged. Claude Code removes Monitor from the tool list where Bash is denied.
Claude Code 2.1.325 with Bash denied has no Bash and no Monitor but keeps TaskStop, and `--tools "Monitor,Read"` keeps Monitor without Bash. Here `--tools -bash`, `--no-builtin-tools` and `defaultTools: ["read"]` also removed `task_stop`, and `--tools read,monitor` removed `monitor`. `task_stop` is no longer removed where `bash` is missing. `monitor` is still removed at session_start when `bash` is not active, except where the tool selection names it: a `defaultTools` setting that lists it is read from pi's settings, and the tool is registered again after the removal, which makes pi activate it where a `--tools` allowlist names it and nowhere else.
|
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.



pi activates every tool an extension registers while it loads, whatever the session's tool selection is. Since the
bashoverride was registered at load, a session whose selection leavesbashout got it back, together withmonitor, which also runs shell commands.Shell tools sent to the model, next to Claude Code 2.1.325 for the matching configuration:
--tools -bash--disallowedTools Bash: TaskStop--exclude-tools bashdefaultTools: ["read"]--no-builtin-tools--tools read,monitor--tools "Monitor,Read": MonitorAlso fixed:
bashturned off in a session came back after/reload.session_startonly. A tool that replaces an already registered one keeps that tool's active state, sobashis the override where the session hasbashand stays off where it does not.monitoris taken out atsession_startwhenbashis not active, unless the tool selection names it: a--toolsallowlist (pi re-activates the names an allowlist lists when the tool is registered again) or adefaultToolssetting that listsmonitor.task_stopfollows pi's own selection only.Only
registerTool,getActiveToolsandsetActiveToolsare used, which exist in pi 0.80.5; thedefaultToolslookup is guarded for a pi without that setting. Verified in a real pi 1.5.0 and pi 0.87.1 process.Limits:
bashturned off mid-session leavesmonitoractive until the next session start;--tools -bash,+monitordropsmonitor, since an extension cannot see the+monitormodifier.npm run checkpasses (Biome, strict tsc, Vitest)