The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tools): search_files only defaults None/blank paths, not wrong-typed ones
teknium1d77cf5ae5190
diff --git a/tests/tools/test_search_files_engine_selection.py b/tests/tools/test_search_files_engine_selection.pyindex 6cdb5e3616d..7bda6892b60 100644--- a/tests/tools/test_search_files_engine_selection.py+++ b/tests/tools/test_search_files_engine_selection.py@@ -305,7 +305,9 @@ def test_handler_normalizes_blank_path_to_current_directory(monkeypatch, target,assert captured["path"] == "."-def test_handler_preserves_nonblank_path(monkeypatch):[email protected]("raw_path", ["src", 5, ["src"]])+def test_handler_preserves_nonblank_path(monkeypatch, raw_path):+ """Only None/blank normalise to '.'; a wrong-typed path reaches search_tool's own error path."""captured = {}def fake_search_tool(**kwargs):@@ -314,9 +316,9 @@ def test_handler_preserves_nonblank_path(monkeypatch):monkeypatch.setattr("tools.file_tools.search_tool", fake_search_tool)- registry.dispatch("search_files", {"pattern": "needle", "path": "src"})+ registry.dispatch("search_files", {"pattern": "needle", "path": raw_path})- assert captured["path"] == "src"+ assert captured["path"] == raw_pathdef test_repeated_search_key_distinguishes_order(monkeypatch):diff --git a/tools/file_tools.py b/tools/file_tools.pyindex 4b312b63e75..a9f264978c9 100644--- a/tools/file_tools.py+++ b/tools/file_tools.py@@ -1294,7 +1294,7 @@ def _handle_search_files(args, **kw):# The schema documents path='.'; a present-but-blank (or JSON null) value# is not a missing key for dict.get, so apply the default here (#112424).path = args.get("path", ".")- if not isinstance(path, str) or not path.strip():+ if path is None or (isinstance(path, str) and not path.strip()):path = "."return search_tool(pattern=args.get("pattern", ""), target=target, path=path,