From 399dc3aa74cead04e83be9a78eccd2ab3f31f975 Mon Sep 17 00:00:00 2001 From: vominh1919 Date: Tue, 21 Apr 2026 10:42:58 +0700 Subject: [PATCH] fix: _paths_overlap() false positives for sibling paths The old implementation compared a common-length prefix of path parts, which incorrectly reported overlaps for sibling paths sharing a directory (e.g. /a/b/c and /a/b/d both report True). The fix only returns True when one path is a proper prefix of the other by comparing the shorter path's parts against the same-length prefix of the longer path. --- run_agent.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/run_agent.py b/run_agent.py index 5005153b3..bf316e808 100644 --- a/run_agent.py +++ b/run_agent.py @@ -332,8 +332,9 @@ def _paths_overlap(left: Path, right: Path) -> bool: if not left_parts or not right_parts: # Empty paths shouldn't reach here (guarded upstream), but be safe. return bool(left_parts) == bool(right_parts) and bool(left_parts) - common_len = min(len(left_parts), len(right_parts)) - return left_parts[:common_len] == right_parts[:common_len] + if len(left_parts) < len(right_parts): + return left_parts == right_parts[:len(left_parts)] + return right_parts == left_parts[:len(right_parts)]