#12665: fix(tools): recognise tool groups that expand to plugin tools in allowlist validation
agents
size: S
trusted-contributor
experienced-contributor
Cluster:
Tool Execution and Error Handling
## Summary
Fixes #12643
`stripPluginOnlyAllowlist()` incorrectly flagged tool group entries like `group:memory` as "unknown" when the group expanded to plugin-provided tools (e.g. `memory_search`, `memory_get` from `memory-core`).
**Root cause:** The function checked whether the raw entry name (`group:memory`) was a plugin ID or plugin tool name, but never checked whether the *expanded* tool names were plugin tools. Since `group:memory` itself isn't a plugin ID, and `memory_search`/`memory_get` are plugin tools (not core tools), the entry fell through both checks and was reported as unknown.
**Fix:** After expanding a group entry via `expandToolGroups()`, also check if any of the expanded tool names exist in the `pluginTools` set. This one-line addition correctly classifies groups whose members are plugin tools.
- Moved `expandToolGroups([entry])` call before the `isPluginEntry` check
- Added `expanded.some((tool) => pluginTools.has(tool))` to the `isPluginEntry` condition
## Test plan
- [x] Write 3 new tests that reproduce the bug (all fail before fix, pass after)
- [x] Test: `group:memory` mixed with core tools → not flagged as unknown
- [x] Test: `group:memory` alone (plugin-only) → stripped but not flagged as unknown
- [x] Test: `group:memory` + plugin tools + core tools → all recognised correctly
- [x] All 6 pre-existing tests still pass (zero regressions)
- [x] All 8 tests across related test suites pass
- [x] `pnpm build` passes
- [x] `pnpm check` passes
- [x] `codex review --base main` clean (zero issues)
All 3 new tests fail before the fix, pass after (TDD).
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This change updates `stripPluginOnlyAllowlist()` to correctly treat tool-group allowlist entries (e.g. `group:memory`) as plugin entries when the group expands to plugin-provided tool names. The function now expands each entry via `expandToolGroups()` before classifying it, and considers an entry “plugin” if any expanded tool is present in the `pluginTools` set.
It also adds three Vitest cases to cover the regression from #12643, including mixed core + group entries, group-only (plugin-only) stripping behavior, and group + explicit plugin tool entries.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- The change is narrowly scoped (classification logic in `stripPluginOnlyAllowlist`) and is directly covered by new regression tests. The added condition only broadens plugin-entry detection to include group expansions and does not change how core tools are detected or how stripping decisions are made.
- No files require special attention
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#19422: fix: pass session context to plugin tool hooks in toToolDefinitions
by namabile · 2026-02-17
78.5%
#10189: fix: resolve file_path param in tool display for read/write tools
by Yida-Dev · 2026-02-06
77.4%
#23582: fix(tool-policy): add group:fs and group:runtime to group:openclaw
by arosstale · 2026-02-22
77.1%
#20499: test(plugins): add bundled+config duplicate discovery regression
by dcol91863 · 2026-02-19
77.0%
#12487: fix(agents): strip orphaned tool_result when tool_use is sanitized ...
by skylarkoo7 · 2026-02-09
76.1%
#14734: test(agents): guard against stale allowAgents in existing sessions
by davidahmann · 2026-02-12
75.9%
#23783: Tools: add strict allowlist mode and fail closed on unknown entries
by bmendonca3 · 2026-02-22
75.7%
#12596: fix(status): show third-party memory plugins as active instead of u...
by nhadaututtheky · 2026-02-09
75.6%
#14328: fix: strip incomplete tool_use blocks from errored/aborted messages...
by Kropiunig · 2026-02-12
75.5%
#4852: fix(agents): sanitize tool pairing after compaction and history tru...
by lailoo · 2026-01-30
75.4%