Compare commits

...
Author SHA1 Message Date
praisonai-triage-agent[bot]andMervin Praison ac4eafc3a0 fix: detect single-backslash, home-relative and bare relative Windows paths
Addresses Gemini and Greptile review feedback: is_path_like now recognizes
\path, ~\path and relative paths containing backslashes (e.g. knowledge\docs)
so equivalent Windows configurations resolve as knowledge sources.

Co-authored-by: Mervin Praison <[email protected]>
2026-06-27 02:07:57 +00:00
2 changed files with 18 additions and 3 deletions

No files matched your search

@@ -107,8 +107,8 @@ def is_path_like(value: str) -> bool:
if not isinstance(value, str):
return False
# Check for path indicators
if value.startswith(("./", "../", "/", "~/", ".\\", "..\\", "\\\\")):
# Check for path indicators (POSIX and Windows-style prefixes)
if value.startswith(("./", "../", "/", "~/", ".\\", "..\\", "\\\\", "\\", "~\\")):
return True
# Check for Windows drive paths like C:\data or C:/data
@@ -119,10 +119,15 @@ def is_path_like(value: str) -> bool:
and value[2] in ("\\", "/")
):
return True
# Check for directory indicator
if value.endswith(("/", "\\")):
return True
# Check for embedded backslash separators (relative Windows path like "knowledge\docs").
# Backslash is not valid in normal config string values, so it is a strong path signal.
if "\\" in value:
return True
# Check for file extension (common ones)
if "." in value:
@@ -347,6 +347,16 @@ class TestKnowledgePresets:
)
assert isinstance(result, MockKnowledgeConfig)
assert result.sources == ["C:\\knowledge"]
for windows_path in ("\\knowledge", "~\\knowledge", "knowledge\\docs"):
result = resolve(
value=windows_path,
param_name="knowledge",
config_class=MockKnowledgeConfig,
string_mode="path_as_source",
)
assert isinstance(result, MockKnowledgeConfig)
assert result.sources == [windows_path]
def test_knowledge_array_sources(self):
"""Array of paths should be sources list."""