ScheduleWakeup has no cancellation mechanism — causes agent loop when agent re-schedules on each wakeup
Description
ScheduleWakeup has no cancel-by-ID or cancel-all API. Once a wakeup is scheduled, it cannot be canceled from outside the agent that created it. This makes it impossible to interrupt an agent that is stuck in a wakeup loop.
Failure mode (observed)
- Agent A runs, hits a condition, and schedules a wakeup (e.g. \"check in 10 min\").
- Agent A exits or completes its turn.
- Wakeup fires, re-spawns Agent A with the same prompt.
- Agent A re-schedules the wakeup.
- Steps 2–4 repeat indefinitely with no external way to break the cycle.
The only escape today is restarting Claude Code or killing the underlying process.
Steps to reproduce
Use ScheduleWakeup inside a /loop-style session where the agent's prompt instructs it to \"keep checking until X is done\". The agent will schedule a wakeup before returning, then re-schedule on every subsequent wakeup firing. Once started there is no cancel signal an operator or parent agent can send.
Expected behavior
At least one of:
cancel_wakeup(id)— cancel a specific pending wakeup by the ID returned at schedule time.list_wakeups()/CronList-equivalent for dynamic wakeups — enumerate pending wakeups so a parent/operator agent can cancel them.max_fires=Nparameter onScheduleWakeup— wakeup auto-cancels after N firings.
Root cause
ScheduleWakeup appears designed for the single-agent \"wake me up in N minutes to check on my own work\" use case. Cross-agent cancellation and an explicit cancel-by-ID mechanism were not built in. The infinite-loop failure mode only becomes visible in multi-round agentic sessions where agents schedule wakeups before returning.
Workaround
None currently available.
Environment
- Claude Code CLI
- Model: claude-sonnet-4-6
- Platform: macOS (darwin 25.4.0)
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗