fix(file-tools): search_files mentions macOS protected-folder pruning only on macOS

The pruning only runs on a darwin host; Linux and Windows schemas carried the sentence for
nothing. Gate it on hermes_platform.host.facts.os_family().
This commit is contained in:
Teknium committed 2026-10-24 18:44:31 -07:00
1 parent 38968d7552
commit d4403afd9f
2 files changed
+24 -1

No files matched your search

@@ -0,0 +1,16 @@
"""search_files advertises macOS protected-folder pruning only on the host that prunes."""
import pytest
from tools.file_tools import SEARCH_FILES_SCHEMA
@pytest.mark.platforms("macos")
def test_macos_schema_explains_protected_folder_pruning():
assert "TCC-protected folders" in SEARCH_FILES_SCHEMA["description"]
@pytest.mark.platforms("not macos")
def test_other_hosts_schema_omits_macos_pruning():
description = SEARCH_FILES_SCHEMA["description"]
assert "macOS" not in description and "TCC" not in description
+8 -1
View File
@@ -26,6 +26,7 @@ from tools.file_operations import (
ShellFileOperations, normalize_read_pagination, normalize_search_pagination)
from tools.file_operations_common import DEFAULT_READ_LIMIT, count_conflict_blocks
from tools import file_state
from hermes_platform.host import facts
from agent.redact import _is_secret_file_arg, redact_sensitive_text
from tools.file_tools_paths import (
_expand_tilde, _path_resolution_warning, _resolve_base_dir, _resolve_entry_for_task,
@@ -1285,9 +1286,15 @@ def _is_openai_family_main() -> bool:
return "openai/" in model
# Pruning happens only on a macOS host (``_macos_protected_search_exclusions``), so only that
# host's schema mentions it; other hosts would pay for a sentence about an OS they are not on.
_MACOS_SEARCH_NOTE = (" On macOS, broad searches above the user home automatically skip TCC-protected folders (Desktop, "
"Documents, Downloads, Library, Movies, Music, Pictures); target one directly when access is intentional."
if facts.os_family() == "darwin" else "")
SEARCH_FILES_SCHEMA = {
"name": "search_files",
"description": "Search file contents or find files by name. Use this instead of grep/rg/find/ls in terminal. Ripgrep-backed, faster than shell equivalents. On macOS, broad searches above the user home automatically skip TCC-protected folders (Desktop, Documents, Downloads, Library, Movies, Music, Pictures); target one directly when access is intentional.\n\nContent search (target='content'): Regex search inside files. Output modes: full matches with line numbers, file paths only, or match counts.\n\nFile search (target='files'): Find files by glob pattern (e.g., '*.py', '*config*'). Also use this instead of ls. Discovery order is the fast bounded default; exact global newest-first order is an explicit opt-in and may scan the full tree.",
"description": "Search file contents or find files by name. Use this instead of grep/rg/find/ls in terminal. Ripgrep-backed, faster than shell equivalents." + _MACOS_SEARCH_NOTE + "\n\nContent search (target='content'): Regex search inside files. Output modes: full matches with line numbers, file paths only, or match counts.\n\nFile search (target='files'): Find files by glob pattern (e.g., '*.py', '*config*'). Also use this instead of ls. Discovery order is the fast bounded default; exact global newest-first order is an explicit opt-in and may scan the full tree.",
"parameters": {
"type": "object",
"properties": {