diff --git a/src/daemon/ticker.py b/src/daemon/ticker.py index 8b78257..f71056a 100644 --- a/src/daemon/ticker.py +++ b/src/daemon/ticker.py @@ -553,6 +553,22 @@ class Ticker: ) spawned.append(agent_id) logger.info("Broadcast spawned %s (session=%s)", agent_id, session_id) + # 写广播路由审计记录 + try: + conn = get_connection(db_path) + try: + conn.execute( + "INSERT INTO routing_decisions " + "(task_id, mode, selected_agent, reason, outcome, created_at) " + "VALUES (?,?,?,?,?,datetime('now'))", + (t.id, "broadcast", agent_id, + f"Broadcast claim prompt sent", "dispatched"), + ) + conn.commit() + finally: + conn.close() + except Exception: + pass # 审计记录失败不影响广播 except Exception: self.counter.release(agent_id) logger.exception("Broadcast spawn failed for %s", agent_id)