Skip to content

fix(background-review): whitelist dynamic memory-provider tools - #39746

Open
infernix wants to merge 1 commit into
NousResearch:mainfrom
infernix:fix-background-review-memory-tools
Open

fix(background-review): whitelist dynamic memory-provider tools#39746
infernix wants to merge 1 commit into
NousResearch:mainfrom
infernix:fix-background-review-memory-tools

Conversation

@infernix

@infernix infernix commented Jun 5, 2026

Copy link
Copy Markdown

What does this PR do?

Fixes background review for dynamic memory-provider tools. The review thread previously built its runtime whitelist from the static memory and skills toolsets only, which excluded tools injected at runtime by memory providers such as Honcho (honcho_profile, honcho_search, honcho_context, etc.). As a result, background reviews inherited those tools in the schema but then denied them at dispatch time.

This PR keeps the existing static whitelist and extends it with tool names reported by the parent agent’s active MemoryManager. That preserves the safety boundary while allowing the review fork to call the same memory-provider tools already present in the parent agent’s live tool surface.

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Updated agent/background_review.py so the background review whitelist starts from the static memory and skills toolsets, then unions in dynamic tool names from agent._memory_manager.get_all_tool_names().
  • Kept the whitelist scoped to the parent agent’s active memory-provider surface instead of broadening background review access to unrelated tools.
  • Added regression coverage in tests/run_agent/test_background_review_toolset_restriction.py for dynamically injected memory-provider tools, including Honcho-style honcho_* names.

How to Test

  1. Check out fix-background-review-memory-tools.
  2. Run:
    scripts/run_tests.sh tests/run_agent/test_background_review_toolset_restriction.py
  3. Confirm the regression passes: dynamically injected memory-provider tools are whitelisted for background review, while non-memory tools remain denied.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Linux

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

scripts/run_tests.sh tests/run_agent/test_background_review_toolset_restriction.py

Passed: 1 files, 4 tests passed, 0 failed.

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint tool/memory Memory tool and memory providers P3 Low — cosmetic, nice to have labels Jun 5, 2026
@infernix
infernix marked this pull request as ready for review June 5, 2026 11:16
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for tracing the runtime whitelist boundary.

Problems

  • This change cannot make a dynamic provider tool callable on current main. The review fork is created with skip_memory=True at agent/background_review.py:713; initialization therefore leaves its _memory_manager unset (agent/agent_init.py:1383-1384). Dynamic provider dispatch requires that manager at agent/tool_executor.py:1430-1445.
  • The new test stops at the whitelist installation after replacing AIAgent.__init__ with a no-op, so it verifies names only—not schema exposure or dispatch.

Suggested changes

  • Please do not whitelist provider names independently. A viable follow-up needs a deliberately isolated provider bridge and an end-to-end test proving the review cannot ingest its harness prompt into the user's external memory namespace. That isolation is explicitly guarded by tests/run_agent/test_background_review.py:316-360.

This is an automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users area/memory Memory subsystem: store, providers, sync, background reviews labels Jul 14, 2026
@infernix
infernix force-pushed the fix-background-review-memory-tools branch from 327fe86 to b9d607c Compare August 25, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/memory Memory subsystem: store, providers, sync, background reviews comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state 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.

3 participants