Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions agent/background_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,19 +474,21 @@ def _bg_review_auto_deny(command, description, **kwargs):
quiet_mode=True,
)
}
# Allow read-only file tools for cron background review (issue #45877)
review_whitelist.update({"read_file", "search_files"})
set_thread_tool_whitelist(
review_whitelist,
deny_msg_fmt=(
"Background review denied non-whitelisted tool: "
"{tool_name}. Only memory/skill tools are allowed."
"{tool_name}. Only memory/skill/read-only-file tools are allowed."
),
)
try:
review_agent.run_conversation(
user_message=(
prompt
+ "\n\nYou can only call memory and skill "
"management tools. Other tools will be denied "
+ "\n\nYou can only call memory, skill management, and read-only file "
"tools (read_file, search_files). Other tools will be denied "
"at runtime — do not attempt them."
),
conversation_history=messages_snapshot,
Expand Down
6 changes: 6 additions & 0 deletions tests/run_agent/test_background_review_toolset_restriction.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,18 @@ def _no_init(self, *args, **kwargs):
assert "skill_manage" in whitelist
assert "skill_view" in whitelist
assert "skills_list" in whitelist
# read-only file tools must be allowed (issue #45877)
assert "read_file" in whitelist
assert "search_files" in whitelist
# dangerous tools must NOT be in the whitelist
assert "terminal" not in whitelist
assert "send_message" not in whitelist
assert "delegate_task" not in whitelist
assert "web_search" not in whitelist
assert "execute_code" not in whitelist
# write file tools must NOT be in the whitelist
assert "write_file" not in whitelist
assert "patch" not in whitelist


def test_background_review_agent_tools_are_limited():
Expand Down