diff --git a/agent-node/VERSION b/agent-node/VERSION index eea6f62..be1dcc8 100644 --- a/agent-node/VERSION +++ b/agent-node/VERSION @@ -1 +1 @@ -1.0.72 +1.0.73 diff --git a/agent-node/src/agent_node/core/watcher.py b/agent-node/src/agent_node/core/watcher.py index 3ad635d..3f50201 100644 --- a/agent-node/src/agent_node/core/watcher.py +++ b/agent-node/src/agent_node/core/watcher.py @@ -61,10 +61,14 @@ if rel_path.endswith(".cortex_tmp") or rel_path.endswith(".cortex_lock"): return + print(f" [📁🤔] Watcher on_deleted eval: event.src={event.src_path}, real_src={real_src}, root={self.root_path}, rel={rel_path}, last_sync={self.last_sync.get(rel_path)}", flush=True) + if self.last_sync.get(rel_path) == "__DELETED__": + print(f" [📁🛑] Watcher Suppressing echo delete for: {rel_path}", flush=True) return if not self.ignore_filter.is_ignored(rel_path): + print(f" [📁⚠️] Watcher EMITTING DELETE to SERVER for: {rel_path}", flush=True) self.callback(self.session_id, agent_pb2.FileSyncMessage( session_id=self.session_id, control=agent_pb2.SyncControl(action=agent_pb2.SyncControl.DELETE, path=rel_path) @@ -207,10 +211,10 @@ self.stop_watching(session_id) if not HAS_WATCHDOG: - print(f"[!] Warning: 'watchdog' not installed. File sync disabled for session {session_id}") + print(f"[!] Warning: 'watchdog' not installed. File sync disabled for session {session_id}", flush=True) return - print(f"[*] Starting Watcher for Session {session_id} at {root_path}") + print(f"[*] Starting Watcher for Session {session_id} at {root_path} (realpath: {os.path.realpath(root_path)})", flush=True) os.makedirs(root_path, exist_ok=True) handler = SyncEventHandler(session_id, root_path, self.callback) @@ -241,6 +245,7 @@ def acknowledge_remote_delete(self, session_id, rel_path): """Updates the internal hash record to match a remote delete, preventing an echo-back.""" if session_id in self.observers: + print(f"[*] Watcher explicitly acknowledging REMOTE DELETE for: {rel_path} in session {session_id}", flush=True) _, handler = self.observers[session_id] handler.last_sync[rel_path] = "__DELETED__"