From 256d28a58bc4b3dd035a41729f96e87af9cad309 Mon Sep 17 00:00:00 2001 From: "developing-today[bot]" <5454422+developing-today[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 23:49:27 -0600 Subject: [PATCH] fix(mcpx/settings): declare plugin.disabledTools in pluginSettings() (#5242) MCPX_PLUGIN_DISABLED_TOOLS landed in #5122 (via PR #5170) without a registry declaration, leaving TestThePluginReadsNoUndeclaredSetting red on main. Add the plugin.disabledTools entry (KindList, ScopePlugin, Repeatable) with the derived env name, the effect-probe exemption every other plugin.* setting carries, the path->env registry test map entry, and the regenerated configuration.md + plugin README listings. EffectExemptionPin deliberately raised 202 -> 203 with the reason recorded here and in the pin comment, per TestEffectExemptionsOnlyShrink: the new setting is read by the opencode plugin host (JS side), which the Go e2e harness does not drive - the same basis as all other plugin.* exemptions. Verified on the laptop: TestThePluginReadsNoUndeclaredSetting passes; full internal/settings suite shows only the pre-existing baseline failures tracked in #2716 / #2697 / #2552 (docs chapter, env-doc, scriptenv, undeclared-env-read, and the proto/script.imports effect-coverage gaps), unchanged from clean main. --- pkgs/mcpx/docs/configuration.md | 1 + pkgs/mcpx/internal/settings/effect.go | 3 ++- pkgs/mcpx/internal/settings/plugin.go | 11 +++++++++++ pkgs/mcpx/internal/settings/registry_test.go | 1 + pkgs/mcpx/plugin/opencode/README.md | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pkgs/mcpx/docs/configuration.md b/pkgs/mcpx/docs/configuration.md index e8b66c10ba..b03c5ebdb7 100644 --- a/pkgs/mcpx/docs/configuration.md +++ b/pkgs/mcpx/docs/configuration.md @@ -865,6 +865,7 @@ skipped launcher phases). | `plugin.bin` | string | `mcpx` | plugin | no | `--plugin-bin` | `MCPX_PLUGIN_BIN` | the executable the plugin invokes | | `plugin.binArgs` | list | *(empty)* | plugin | no | `--plugin-bin-args` | `MCPX_PLUGIN_BIN_ARGS` | arguments put in front of every plugin invocation of mcpx | | `plugin.daemonTools` | enum | `auto` | plugin | no | `--plugin-daemon-tools` | `MCPX_PLUGIN_DAEMON_TOOLS` | offer the tools that list and choose between daemons | +| `plugin.disabledTools` | list | *(empty)* | plugin | no | `--plugin-disabled-tools` | `MCPX_PLUGIN_DISABLED_TOOLS` | model-facing mcpx tools hidden from every session | | `plugin.discoveryRetry` | duration | `1m0s` | plugin | no | `--plugin-discovery-retry` | `MCPX_PLUGIN_DISCOVERY_RETRY` | how long the plugin waits before looking for mcpx again | | `plugin.env` | enum | `full` | plugin | no | `--plugin-env` | `MCPX_PLUGIN_ENV` | how much session context is put into each command's environment | | `plugin.headless` | enum | `auto` | plugin | no | `--plugin-headless` | `MCPX_PLUGIN_HEADLESS` | suppress toasts, because nobody is looking at a screen | diff --git a/pkgs/mcpx/internal/settings/effect.go b/pkgs/mcpx/internal/settings/effect.go index d82d71abec..ec63ef7595 100644 --- a/pkgs/mcpx/internal/settings/effect.go +++ b/pkgs/mcpx/internal/settings/effect.go @@ -252,6 +252,7 @@ var EffectExemptions = map[string]string{ "plugin.annotate": "read by the opencode plugin host (JS side); the Go e2e harness does not drive the plugin host", "plugin.headless": "read by the opencode plugin host (JS side); the Go e2e harness does not drive the plugin host", "plugin.daemonTools": "read by the opencode plugin host (JS side); the Go e2e harness does not drive the plugin host", + "plugin.disabledTools": "read by the opencode plugin host (JS side); the Go e2e harness does not drive the plugin host", "protoMessages.listMaxAge": "protocol message timing: era fixtures cover the flow end-to-end, but no per-setting with/without probe exists yet", "protoMessages.readMaxAge": "protocol message timing: era fixtures cover the flow end-to-end, but no per-setting with/without probe exists yet", "protoMessages.taskAfter": "protocol message timing: era fixtures cover the flow end-to-end, but no per-setting with/without probe exists yet", @@ -276,7 +277,7 @@ var EffectExemptions = map[string]string{ // EffectExemptionPin is the ratchet: the exemption count at the time // the guard landed. It may only ever be lowered, and only in the PR // that removes an exemption by adding the probe that replaces it. -const EffectExemptionPin = 202 // deliberate +1 for daemon.roots and +8 for model.*: model settings are covered by internal/model and daemon unit tests; settings-driven e2e probes are not yet present. Deliberate +1 (2026-11-03, #1925 slice 3) for sampling.answerLocally: same model-layer coverage, daemon unit tests in internal/daemon/sampling_local_test.go. +const EffectExemptionPin = 203 // deliberate +1 for daemon.roots and +8 for model.*: model settings are covered by internal/model and daemon unit tests; settings-driven e2e probes are not yet present. Deliberate +1 (2026-11-03, #1925 slice 3) for sampling.answerLocally: same model-layer coverage, daemon unit tests in internal/daemon/sampling_local_test.go. Deliberate +1 (2026-11-03, #5242) for plugin.disabledTools: read by the opencode plugin host (JS side); the Go e2e harness does not drive the plugin host, the same basis as every other plugin.* exemption. // CheckEffectCoverage returns one violation per way the probe and // exemption maps fail to cover reg exactly: a setting with neither, diff --git a/pkgs/mcpx/internal/settings/plugin.go b/pkgs/mcpx/internal/settings/plugin.go index 7847ac6099..9ec858fdf8 100644 --- a/pkgs/mcpx/internal/settings/plugin.go +++ b/pkgs/mcpx/internal/settings/plugin.go @@ -118,6 +118,17 @@ func pluginSettings() []Setting { Long: "Auto offers them when plugin.tools is on or when discovery found " + "more than one daemon and somebody may want to choose.", }, + { + Path: "plugin.disabledTools", Kind: KindList, Default: "", + Scope: ScopePlugin, Repeatable: true, + Name: "Disabled tools", Short: "model-facing mcpx tools hidden from every session", + Long: "Model-facing mcpx tool names (mcpx_exec, ...) hidden from every " + + "session the plugin serves: setup records it as each new " + + "session's tool-filter policy, unless that session already " + + "has a policy of its own. Names outside the mcpx_ namespace " + + "are dropped when the policy is read, so this can never hide " + + "a host tool.", + }, } } diff --git a/pkgs/mcpx/internal/settings/registry_test.go b/pkgs/mcpx/internal/settings/registry_test.go index 2df57d70d8..e8e1355ddb 100644 --- a/pkgs/mcpx/internal/settings/registry_test.go +++ b/pkgs/mcpx/internal/settings/registry_test.go @@ -361,6 +361,7 @@ func TestPluginEnvironmentNamesAreTheContractWithTheTypeScript(t *testing.T) { "plugin.annotate": "MCPX_PLUGIN_ANNOTATE", "plugin.headless": "MCPX_PLUGIN_HEADLESS", "plugin.daemonTools": "MCPX_PLUGIN_DAEMON_TOOLS", + "plugin.disabledTools": "MCPX_PLUGIN_DISABLED_TOOLS", } { set, ok := s.Lookup(path) if !ok { diff --git a/pkgs/mcpx/plugin/opencode/README.md b/pkgs/mcpx/plugin/opencode/README.md index 21f43bbdfc..872116b7c3 100644 --- a/pkgs/mcpx/plugin/opencode/README.md +++ b/pkgs/mcpx/plugin/opencode/README.md @@ -107,6 +107,7 @@ with `go test ./internal/settings -run TestThePluginReadmeListsEveryOption -upda | `annotate` | `MCPX_PLUGIN_ANNOTATE` | `true` | add mcpx's own notes to a tool result. | | `headless` | `MCPX_PLUGIN_HEADLESS` | `auto` | suppress toasts, because nobody is looking at a screen. | | `daemonTools` | `MCPX_PLUGIN_DAEMON_TOOLS` | `auto` | offer the tools that list and choose between daemons. | +| `disabledTools` | `MCPX_PLUGIN_DISABLED_TOOLS` | — | model-facing mcpx tools hidden from every session. |