diff --git a/agent-node/VERSION b/agent-node/VERSION index c2320f5..b112f91 100644 --- a/agent-node/VERSION +++ b/agent-node/VERSION @@ -1 +1 @@ -1.0.20 +1.0.21 diff --git a/agent-node/src/agent_node/node.py b/agent-node/src/agent_node/node.py index 222dc6e..66852ee 100644 --- a/agent-node/src/agent_node/node.py +++ b/agent-node/src/agent_node/node.py @@ -118,18 +118,21 @@ capabilities=caps_str ) - - try: - res = self.stub.SyncConfiguration(reg_req) - if res.success: - self.sandbox.sync(res.policy) - print("[OK] Sandbox Policy Synced.") - else: - print(f"[!] Rejection: {res.error_message}") - sys.exit(1) - except Exception as e: - print(f"[!] Connection Fail: {e}") - sys.exit(1) + while True: + try: + res = self.stub.SyncConfiguration(reg_req) + if res.success: + self.sandbox.sync(res.policy) + print("[OK] Sandbox Policy Synced.") + break # Success, exit the retry loop + else: + print(f"[!] Rejection: {res.error_message}") + print("[!] Retrying handshake in 5 seconds...") + time.sleep(5) + except Exception as e: + print(f"[!] Connection Fail: {e}") + print("[!] Retrying handshake in 5 seconds...") + time.sleep(5) def start_health_reporting(self): """Streaming node metrics to the orchestrator for load balancing."""