diff --git a/agents.py b/agents.py index 733429e..3996e67 100755 --- a/agents.py +++ b/agents.py @@ -578,6 +578,15 @@ def wake_agent(cfg, agent): if not wake: return True session = agent["session"] + # A one-shot `task` is "woken" by RE-RUNNING it fresh — it has no persistent REPL to re-prompt — so + # scheduled work (e.g. a coverage audit) recurs autonomously on its interval, no operator needed. + # Skip only while its previous run is still going; otherwise kill + restart for a clean re-run. + if agent.get("kind") == "task": + if session_alive(session) and pane_active(cfg, agent, capture_pane(session, 25)): + return False + log(f"wake: re-running task {agent['name']} ({session})") + start_agent(cfg, agent, force=True) + return True if not session_alive(session): return False backend = backend_of(cfg, agent)