diff --git a/src/daemon/ticker.py b/src/daemon/ticker.py index 8c526c5..0c8c821 100644 --- a/src/daemon/ticker.py +++ b/src/daemon/ticker.py @@ -671,6 +671,16 @@ class Ticker: """从 Dispatcher 获取 counter""" return getattr(self.dispatcher, 'counter', None) if self.dispatcher else None + @staticmethod + def _is_pid_alive(pid: int) -> bool: + """检查进程是否存活""" + import os + try: + os.kill(pid, 0) + return True + except (ProcessLookupError, PermissionError): + return False + def _get_idle_agents(self) -> List[str]: """获取当前空闲的 Agent 列表(从 config agents 取,而非 counter._per_agent)""" if not self.counter: