/clear does not cancel pending ScheduleWakeup (dynamic /loop) wakeups

Open 💬 0 comments Opened Jul 13, 2026 by chris-lumi-ai

Description

Pending ScheduleWakeup wakeups (dynamic /loop mode) survive /clear. After clearing the conversation, a previously scheduled wakeup still fires and re-runs the loop prompt into the freshly cleared session.

This is the /clear sibling of #64744 (Ctrl+C/Esc not cancelling wakeups). The foreground Ctrl+C path was fixed there, but /clear goes through a different path: it resets the transcript and regenerates the session ID while the session process and the daemon job registration (~/.claude/daemon/roster.json, ~/.claude/jobs/<id>/state.json) stay alive, so the wakeup fires as if nothing happened.

Steps to reproduce

  1. Start a dynamic loop, e.g. /loop review-watch (any prompt that calls ScheduleWakeup).
  2. Wait for the model to schedule a wakeup (e.g. 15 min).
  3. /clear.
  4. Wait for the scheduled time.

Expected: /clear cancels pending wakeups — like Ctrl+C after #64744, /clear expresses "I'm done with this task/loop"; a wakeup re-injecting an old loop prompt into a cleared conversation is never what the user wants.

Actual: The wakeup fires and the loop prompt runs in the cleared session, restarting the loop the user thought was gone.

Workarounds

  • Ask the model to call ScheduleWakeup with stop: true before clearing (requires remembering the loop exists).
  • claude daemon stop (global — kills all supervised sessions).
  • A SessionStart hook with matcher: "clear" can't help cleanly: there is no CLI to cancel a specific wakeup, only manual JSON surgery on roster/state files.

Environment

  • Claude Code 2.1.207 (CLI)
  • macOS (darwin 25.5.0)

View original on GitHub ↗