Skip to content

fix(agent): #5544 strictly enforce toolset filters for memory provide…#5552

Open
MustafaKara7 wants to merge 1 commit into
NousResearch:mainfrom
MustafaKara7:patch-4
Open

fix(agent): #5544 strictly enforce toolset filters for memory provide…#5552
MustafaKara7 wants to merge 1 commit into
NousResearch:mainfrom
MustafaKara7:patch-4

Conversation

@MustafaKara7

Copy link
Copy Markdown
Contributor

…r injection

What does this PR do?

Fixes #5544

The MemoryManager dynamically injects fact_store tools after the primary tool registry initialization. Previously, this bypassed enabled_toolsets and disabled_toolsets filters, 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_toolsets and self.disabled_toolsets before appending memory schemas to self.tools, ensuring full compliance with user configurations.

Fixes #5544

@thundercat49

Copy link
Copy Markdown

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: [].
Minor: line 3 (if self._memory_manager and self.tools is not None:) looks like a leftover from the original code — it has no body and falls through silently. Should be removed to keep the diff clean.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder tool/memory Memory tool and memory providers labels May 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #5788 — both fix memory tool injection bypassing platform_toolsets/enabled_toolsets config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug + feature request: Memory provider tools auto-injected regardless of platform_toolsets config — 10x latency penalty on local models

3 participants