fix(agent): allow read-only file tools in background review whitelist - #45892
Open
liuhao1024 wants to merge 1 commit into
Open
fix(agent): allow read-only file tools in background review whitelist#45892liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
read_file and search_files are side-effect-free tools that cron agents need to inspect config, prior outputs, and skill references. Blocking them forces workarounds via terminal(cat/grep) or blind operation. Fixes NousResearch#45877
AIalliAI
added a commit
to AIalliAI/Hermes
that referenced
this pull request
Jun 14, 2026
3 tasks
AIalliAI
added a commit
to AIalliAI/Hermes
that referenced
this pull request
Jun 14, 2026
teknium1
reviewed
Jul 14, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the focused whitelist change. The current HEAD premise is valid: agent/background_review.py:806-815 derives the runtime whitelist only from memory and skills, and hermes_cli/plugins.py:2135-2141 blocks non-whitelisted tools before dispatch.
Problems
agent/background_review.py:819-820and:841-843still tell the review agent that only memory and skill tools are allowed and that it must not attempt other tools. Addingread_file/search_filesto the whitelist alone therefore leaves the model instructed not to use the newly allowed tools.- The new test checks whitelist membership only.
tests/run_agent/test_background_review_toolset_restriction.py:88-158should also cover the intended boundary: read-only file tools allowed,write_fileandpatchdenied.
Suggested changes
- Update the prompt and denial text to name the two permitted read-only file tools.
- Extend the runtime-whitelist test with positive read-only and negative write-tool assertions.
Automated hermes-sweeper review.
| ) | ||
| } | ||
| # Allow read-only file tools — they have no side effects and | ||
| # are needed for the review agent to inspect config, prior |
Contributor
There was a problem hiding this comment.
Please update the unchanged review prompt and denial text below as well: they still say only memory/skill tools are allowed and explicitly tell the model not to attempt other tools. Without that, the model is instructed not to use this newly permitted tool.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds
read_fileandsearch_filesto the background review tool whitelist, allowing the review agent to inspect configuration files, prior outputs, and skill references during its post-turn memory/skill review pass.Related Issue
Fixes #45877
Type of Change
Changes Made
agent/background_review.py: Addedread_fileandsearch_filesto thereview_whitelistset after the toolset-based whitelist is constructed. These tools are read-only and side-effect-free.tests/run_agent/test_background_review_cache_parity.py: Addedtest_background_review_whitelist_includes_read_only_file_toolsto verify the whitelist includes both read-only file tools.How to Test
pytest tests/run_agent/test_background_review_cache_parity.py -xvstest_background_review_whitelist_includes_read_only_file_toolspasses alongside the 3 existing testsread_fileandsearch_fileswere added (no write tools likewrite_fileorpatch)Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
agent/background_review.py→review_whitelistconstruction (line 470),set_thread_tool_whitelistcall (line 477)