Skip to content

Keep bash off, and monitor with it, in sessions without bash - #442

Merged
ilovepixelart merged 3 commits into
mainfrom
fix/bash-respects-tool-selection
Nov 15, 2026
Merged

ilovepixelart merged 3 commits into
mainfrom
fix/bash-respects-tool-selection

Conversation

@ilovepixelart

@ilovepixelart ilovepixelart commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

pi activates every tool an extension registers while it loads, whatever the session's tool selection is. Since the bash override was registered at load, a session whose selection leaves bash out got it back, together with monitor, which also runs shell commands.

Shell tools sent to the model, next to Claude Code 2.1.325 for the matching configuration:

pi configuration Before After Claude Code
--tools -bash bash, task_stop, monitor task_stop --disallowedTools Bash: TaskStop
--exclude-tools bash task_stop, monitor task_stop same row
defaultTools: ["read"] bash, task_stop, monitor task_stop deny rule: TaskStop
--no-builtin-tools bash, task_stop, monitor task_stop deny rule: TaskStop
--tools read,monitor monitor monitor --tools "Monitor,Read": Monitor
default session bash, task_stop, monitor unchanged Bash, Monitor, TaskStop

Also fixed: bash turned off in a session came back after /reload.

  • The override is now registered at session_start only. A tool that replaces an already registered one keeps that tool's active state, so bash is the override where the session has bash and stays off where it does not.
  • monitor is taken out at session_start when bash is not active, unless the tool selection names it: a --tools allowlist (pi re-activates the names an allowlist lists when the tool is registered again) or a defaultTools setting that lists monitor.
  • task_stop follows pi's own selection only.

Only registerTool, getActiveTools and setActiveTools are used, which exist in pi 0.80.5; the defaultTools lookup is guarded for a pi without that setting. Verified in a real pi 1.5.0 and pi 0.87.1 process.

Limits: bash turned off mid-session leaves monitor active until the next session start; --tools -bash,+monitor drops monitor, since an extension cannot see the +monitor modifier.

  • npm run check passes (Biome, strict tsc, Vitest)
  • Tests cover the change

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.
@ilovepixelart ilovepixelart changed the title Keep bash, monitor and task_stop off in sessions without bash Keep bash off, and monitor with it, in sessions without bash Nov 14, 2026
@sonarqubecloud

Copy link
Copy Markdown

@ilovepixelart
ilovepixelart merged commit a181aaf into main Nov 15, 2026
13 checks passed
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.

1 participant