diff --git a/services/control-plane/src/supervisor.py b/services/control-plane/src/supervisor.py index 3b229eb..3ec151a 100644 --- a/services/control-plane/src/supervisor.py +++ b/services/control-plane/src/supervisor.py @@ -103,12 +103,13 @@ class Supervisor: self._generate_recommendation(drift) def _generate_recommendation(self, drift): - action_id = f"reconcile-{int(time.time())}-{drift['node']}-{drift['service']}" - action_path = ACTIONS_DIR / "pending" / f"{action_id}.json" - - if action_path.exists(): - return # Already recommended + action_id = f"reconcile-{drift['node']}-{drift['service']}" + # Check all active states so we don't recreate after approval/execution + for state in ("pending", "approved", "running"): + if (ACTIONS_DIR / state / f"{action_id}.json").exists(): + return + action_path = ACTIONS_DIR / "pending" / f"{action_id}.json" action = { "action_id": action_id, "timestamp": time.time(),