claude-code - 💡(How to fix) Fix ScheduleWakeup has no cancellation mechanism — causes agent loop when agent re-schedules on each wakeup

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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.

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.

Fix Action

Workaround

None currently available.

RAW_BUFFERClick to expand / collapse

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)

  1. Agent A runs, hits a condition, and schedules a wakeup (e.g. "check in 10 min").
  2. Agent A exits or completes its turn.
  3. Wakeup fires, re-spawns Agent A with the same prompt.
  4. Agent A re-schedules the wakeup.
  5. 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=N parameter on ScheduleWakeup — 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)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

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=N parameter on ScheduleWakeup — wakeup auto-cancels after N firings.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING