diff --git a/agent-node/VERSION b/agent-node/VERSION index 32c4ece..7b8d6b7 100644 --- a/agent-node/VERSION +++ b/agent-node/VERSION @@ -1 +1 @@ -1.0.63 +1.0.65 diff --git a/agent-node/src/agent_node/core/watcher.py b/agent-node/src/agent_node/core/watcher.py index 0e24a66..6a344ae 100644 --- a/agent-node/src/agent_node/core/watcher.py +++ b/agent-node/src/agent_node/core/watcher.py @@ -19,9 +19,9 @@ """Listens for FS events and triggers gRPC delta pushes.""" def __init__(self, session_id, root_path, callback): self.session_id = session_id - self.root_path = root_path + self.root_path = os.path.realpath(root_path) self.callback = callback - self.ignore_filter = CortexIgnore(root_path) + self.ignore_filter = CortexIgnore(self.root_path) self.last_sync = {} # path -> last_hash self.locked = False self.suppressed_paths = set() # Paths currently being modified by the system @@ -45,7 +45,9 @@ def on_deleted(self, event): if not event.is_directory: - rel_path = os.path.normpath(os.path.relpath(event.src_path, self.root_path)) + # Resolve real paths to handle symlinks (e.g. /tmp -> /private/tmp on macOS) + real_src = os.path.realpath(event.src_path) + rel_path = os.path.normpath(os.path.relpath(real_src, self.root_path)) if not self.ignore_filter.is_ignored(rel_path): self.callback(self.session_id, agent_pb2.FileSyncMessage( session_id=self.session_id, @@ -61,7 +63,9 @@ if self.locked: return # Block all user edits when session is locked - rel_path = os.path.normpath(os.path.relpath(abs_path, self.root_path)) + # Resolve real paths to handle symlinks + real_abs = os.path.realpath(abs_path) + rel_path = os.path.normpath(os.path.relpath(real_abs, self.root_path)) if rel_path in self.suppressed_paths: return # Ignore changes coming from the sync manager