fix(agent): steer background review to permitted tools#65803
Open
henrynguyeninfo1 wants to merge 1 commit into
Open
fix(agent): steer background review to permitted tools#65803henrynguyeninfo1 wants to merge 1 commit into
henrynguyeninfo1 wants to merge 1 commit into
Conversation
Rejected: narrow review tool schemas | breaks prompt-cache byte parity with the parent agent Not-tested: live provider response after a denied file-tool call RISK: model self-correction remains probabilistic across providers
Collaborator
tonydwb
reviewed
Jul 16, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved (read-only token — formal approval requires write access)
Improves the denial message for background review when a non-whitelisted tool is called. The new message guides users toward the correct tools (skill_view, skill_manage) instead of just saying "not allowed."
- Small, helpful UX improvement
- Good test coverage verifying the new message includes skill_view, skill_manage, and memory keywords
Reviewed by Hermes Agent
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.
Summary
skills_list,skill_view, andskill_managepathread_filedenial through the real thread-local dispatch gateRoot cause
The review fork intentionally advertises the parent agent's full tool schema, but runtime dispatch only permits memory and skill tools. The denial result previously said only that memory/skill tools were allowed, so it did not redirect models from
read_fileorpatchto the APIs that satisfy the skill manager's read-before-write guard.Testing
uv run --extra dev pytest tests/run_agent/test_background_review.py tests/run_agent/test_background_review_cost_controls.py tests/run_agent/test_background_review_cache_parity.py tests/run_agent/test_background_review_summary.py tests/run_agent/test_background_review_toolset_restriction.py tests/test_background_review_session_isolation.py tests/test_background_review_list_shapes.py tests/hermes_cli/test_plugins.py::TestThreadToolWhitelist -quv run --extra dev ruff check agent/background_review.py tests/run_agent/test_background_review_toolset_restriction.pyuv run --extra dev python -m py_compile agent/background_review.py tests/run_agent/test_background_review_toolset_restriction.pyTested on macOS.
Alternative considered
Narrowing the fork's advertised schemas would eliminate invalid calls earlier, but it would break the intentional byte parity with the parent request and lose prompt-cache reuse. This change keeps parity and improves self-correction at the dispatch boundary.
Fixes #61521