feat(wake): re-run one-shot task agents on their wake interval (autonomous cadence)
wake_agent only re-prompted a live persistent/loop session and returned False for a dead one, so a "task" agent (one-shot, exits after its run) could not be re-run on a schedule — its wake never fired. Now, for kind=="task", a wake kills+restarts the task for a clean re-run (skipping only while its previous run is still active). This makes scheduled work like a coverage audit recur autonomously, no operator trigger. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UWTdUq2bsic7JZGqJp3nD6
This commit is contained in:
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user