mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-12 13:52:15 +00:00
fix(profile): gate bg-review memory tool on memory_enabled (#54937 layer 2)
background_review hardcoded enabled_toolsets=["memory", "skills"] in the review fork's whitelist, so a skill-review fork on a profile with memory_enabled: false still granted the LLM the built-in MEMORY.md read/write tool — contaminating a profile that opted out of built-in memory. The flag was already in scope (review_agent._memory_enabled). Include "memory" only when _memory_enabled or _user_profile_enabled (USER.md also needs the tool). Layer 1 of #54937 (the path leak) is fixed by this PR's thread-context propagation: get_memory_dir() is already per-call on main, so once the bg-review thread inherits the profile override its writes land in the right profile (verified). This commit closes the remaining whitelist layer.
This commit is contained in:
parent
1f1d346ced
commit
437dcacbbf
2 changed files with 79 additions and 1 deletions
|
|
@ -725,10 +725,17 @@ def _run_review_in_thread(
|
|||
clear_thread_tool_whitelist,
|
||||
)
|
||||
|
||||
# Gate the built-in memory tool on the profile's memory_enabled flag.
|
||||
# Hardcoding ["memory", "skills"] granted the review LLM the MEMORY.md
|
||||
# read/write tool even when a profile set memory_enabled: false,
|
||||
# contaminating a memory-disabled profile (#54937 layer 2).
|
||||
review_toolsets = ["skills"]
|
||||
if review_agent._memory_enabled or review_agent._user_profile_enabled:
|
||||
review_toolsets.insert(0, "memory")
|
||||
review_whitelist = {
|
||||
t["function"]["name"]
|
||||
for t in get_tool_definitions(
|
||||
enabled_toolsets=["memory", "skills"],
|
||||
enabled_toolsets=review_toolsets,
|
||||
quiet_mode=True,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue