fix(stop-continuation): persist stop state across user messages (#3276)

The /stop-continuation command was ineffective because the stop-
continuation-guard cleared its stopped state on the very next
chat.message event. Since any user message (including normal chat
after stopping) triggers chat.message, the continuation would
resume immediately.

Root cause: the chat.message handler called clear(sessionID) on
every user message, treating it as a 'user resumed work' signal.
But the user expects /stop-continuation to persist until they
explicitly start work again.

Changes:
- stop-continuation-guard chat.message: no longer clears stop state
- tool-execute-before: /start-work, /ralph-loop, /ulw-loop now
  explicitly clear the stop state (so continuation resumes when
  user intentionally restarts work)
- Updated and added tests: 12 pass (3 new), 125 related tests pass

Closes #3276
This commit is contained in:
YeonGyu-Kim
2026-04-09 21:36:10 +09:00
parent dc7a46809f
commit ab515b77d0
3 changed files with 56 additions and 6 deletions
+13
View File
@@ -184,6 +184,19 @@ export function createToolExecuteBeforeHandler(args: {
sessionID,
})
}
// Clear stop state when user explicitly resumes work via work-starting commands.
// This ensures /stop-continuation persists until the user intentionally restarts.
const workStartingCommands = ["start-work", "ralph-loop", "ulw-loop"]
if (workStartingCommands.includes(command ?? "") && sessionID) {
if (hooks.stopContinuationGuard?.isStopped(sessionID)) {
hooks.stopContinuationGuard.clear(sessionID)
log("[stop-continuation] Stop state cleared by work-starting command", {
sessionID,
command,
})
}
}
}
}
}