[BUG] [BUG] /goal (and /plan) ignore an explicit cancel — Stop hook keeps blocking turn termination after the goal is cancelled, especially after auto-compaction / multi-session resume
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Title: [BUG] /goal (and /plan) ignore an explicit cancel — Stop hook keeps blocking turn termination after the goal is cancelled, especially after auto-compaction / multi-session resume
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
I cancelled an active /goal (and tried to exit /plan) explicitly, but the Stop hook kept re-triggering and refused to hand control back. The session stayed locked: every new turn auto-continued toward the cancelled/stale objective, and the only way to send my next instruction was to manually press Stop / Ctrl+C — on every single turn.
This happens on a large, multi-day task run as a single objective across many sessions (a "baton relay"): the work spans more than 24 hours, undergoes at least one mid-session auto-compaction, and resumes via --resume / --continue, so the /goal from an earlier session survives. Partway through, the requirements changed and I decided to abandon the original plan — at which point I issued the cancel.
The assistant itself reported that it was "blocked by the active goal" and that "the Stop hook is auto-looping," and explicitly noted the conflict between the still-active goal and my cancel/redirect — yet it could not escape the loop until I killed the turn by hand.
Steps to Reproduce
- Set a
/goalfor a large objective. Work across multiple sessions over 24h+, resuming with--resume/--continue; let the session auto-compact at least once. - Mid-task, requirements change. Decide to abandon the original goal.
- Explicitly cancel the goal (
/goal clear) and/or try to exit/plan. - Send a new instruction redirecting the work.
Expected Behavior
After an explicit cancel, the goal/plan is cleared, control returns to me immediately, and my next instruction is accepted normally — no further Stop-hook continuations toward the abandoned objective.
Actual Behavior
The Stop hook keeps re-evaluating the cancelled/stale goal, judges it "not met," and starts another turn instead of yielding. Control is not returned. The next instruction only gets through if I manually press Stop / Ctrl+C, and the loop resumes on the following turn. The cancel did not take effect.
Additional Context
The failure is amplified by compaction + multi-session resume: after auto-compaction the active goal is no longer visible in recent context, so a stale objective from a prior session silently keeps blocking new turns. Plan mode shows the mirror behavior — auto-compaction can re-enter plan mode unrequested, and exiting can hang/fail.
Suggested fixes:
- An explicit cancel must hard-stop the Stop hook even mid-continuation.
- An explicit human redirect should outrank the evaluator's "not done yet."
- After compaction/resume, surface any still-active goal/plan and offer keep / pause / clear.
Related Issues
- #29956 — Context auto-compaction re-enters plan mode without user request
- #30042 — No way to disable plan mode
- #19623 —
ExitPlanModehangs indefinitely - #32934 —
ExitPlanModefails when toggled via Shift+Tab
Environment
claude code web
What Should Happen?
After an explicit cancel, the goal/plan is cleared, control returns to me immediately, and my next instruction is accepted normally — no further Stop-hook continuations toward the abandoned objective.
Error Messages/Logs
Steps to Reproduce
Set a /goal for a large objective. Work across multiple sessions over 24h+, resuming with --resume / --continue; let the session auto-compact at least once.
Mid-task, requirements change. Decide to abandon the original goal.
Explicitly cancel the goal (/goal clear) and/or try to exit /plan.
Send a new instruction redirecting the work.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
/status isn't a recognized command here. Some commands only work in the Claude Code terminal.
Claude Code Version
/status isn't a recognized command here. Some commands only work in the Claude Code terminal.
Platform
Other
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗