fix(agent): #5544 strictly enforce toolset filters for memory provide… - #5552
fix(agent): #5544 strictly enforce toolset filters for memory provide…#5552MustafaKara7 wants to merge 1 commit into
Conversation
…mory provider injection
|
Tested this approach on my local setup (RTX 3090, Qwen3-30B-A3B via llama.cpp) and the logic is correct — response time dropped from 42s to ~2s with telegram: []. |
|
Likely duplicate of #5788 — both fix memory tool injection bypassing platform_toolsets/enabled_toolsets config. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for identifying the late memory-tool injection path. The disabled-toolset part of the report remains valid on current main, but this patch needs a focused port.
Problems
- The modified inline block no longer exists: current main injects via
agent/memory_manager.py:100-145, invoked fromagent/agent_init.py:1419-1420after the base list has already been filtered atagent/agent_init.py:1159-1163. - The current helper checks only enabled toolsets at
agent/memory_manager.py:112-116; it does not readdisabled_toolsets, so the denylist bypass remains. - Do not port the direct membership check verbatim:
agent/memory_manager.py:91-94resolves composite toolsets, andtests/agent/test_memory_provider.py:1363-1368requireshermes-acpto retain provider memory tools.
Suggested changes
- Add a denylist-first
memorygate ininject_memory_provider_tools(), retain the existing composite enabled-toolset resolver, and add tests for disabled-memory precedence intests/agent/test_memory_provider.py.
Automated hermes-sweeper review.
|
|
||
| # Inject memory provider tool schemas into the tool surface | ||
| if self._memory_manager and self.tools is not None: | ||
| # Respect both enabled and disabled toolsets configurations |
There was a problem hiding this comment.
Do not carry this direct membership check into the current helper unchanged: current main supports composite toolsets through memory_provider_tools_enabled() (agent/memory_manager.py:91-94), and tests/agent/test_memory_provider.py:1363-1368 verifies that hermes-acp exposes provider memory tools. Preserve that resolver and add the disabled-toolset check separately.
…r injection
What does this PR do?
Fixes #5544
The
MemoryManagerdynamically injectsfact_storetools after the primary tool registry initialization. Previously, this bypassedenabled_toolsetsanddisabled_toolsetsfilters, causing massive token overhead and tool-loops for local models when platforms (e.g. Telegram) explicitly requested zero tools (telegram: []).Added explicit validation against both
self.enabled_toolsetsandself.disabled_toolsetsbefore appending memory schemas toself.tools, ensuring full compliance with user configurations.Fixes #5544