diff --git a/src/daemon/ticker.py b/src/daemon/ticker.py index d201712..5c0adba 100644 --- a/src/daemon/ticker.py +++ b/src/daemon/ticker.py @@ -480,6 +480,20 @@ class Ticker: result.get("session_id")) finally: conn.close() + elif result["status"] == "blocked": + # Guardrail 拦截:任务标记为 blocked + conn = get_connection(db_path) + try: + self._transition_status( + conn, task.id, "blocked", + agent="daemon", + detail={"reason": result.get("reason", "guardrail"), + "violations": result.get("violations", [])}, + ) + logger.info("Task %s blocked by guardrail: %s", + task.id, result.get("reason", "unknown")) + finally: + conn.close() except Exception: logger.exception("Dispatch failed for %s", task.id)