diff --git a/src/daemon/ticker.py b/src/daemon/ticker.py index 47585c0..a72a365 100644 --- a/src/daemon/ticker.py +++ b/src/daemon/ticker.py @@ -590,15 +590,13 @@ class Ticker: return getattr(self.dispatcher, 'counter', None) if self.dispatcher else None def _get_idle_agents(self) -> List[str]: - """获取当前空闲的 Agent 列表""" + """获取当前空闲的 Agent 列表(从 config agents 取,而非 counter._per_agent)""" if not self.counter: return [] - idle = [] - for agent_id in self.counter._per_agent: - active = self.counter.active_agents.get(agent_id, 0) - if active == 0: - idle.append(agent_id) - return idle + # agent_profiles 在 Router 初始化时从 config 填充,是完整 Agent 列表 + all_agents = list(self.dispatcher.router.agent_profiles.keys()) if self.dispatcher else [] + active = self.counter.active_agents + return [aid for aid in all_agents if active.get(aid, 0) == 0] async def _dispatch_reviews(self, db_path: Path, project_id: str) -> List[str]: