fix: check restart/shutdown before cycle in lifecycle parser
The parseLifecycleRequest function was checking for "cycle" first, but since the title already contains "lifecycle:" (which includes "cycle"), all lifecycle messages matched as cycle actions, making restart and shutdown unreachable. Fixed by: 1. Checking restart/shutdown before cycle 2. Using " cycle" (with leading space) to match the word, not prefix Closes gt-rixa 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -82,12 +82,15 @@ func (d *Daemon) parseLifecycleRequest(msg *BeadsMessage) *LifecycleRequest {
|
||||
var action LifecycleAction
|
||||
var from string
|
||||
|
||||
if strings.Contains(title, "cycle") || strings.Contains(title, "cycling") {
|
||||
action = ActionCycle
|
||||
} else if strings.Contains(title, "restart") {
|
||||
// Check restart/shutdown before cycle.
|
||||
// Note: Can't use Contains(title, "cycle") because "lifecycle:" contains "cycle".
|
||||
// Use " cycle" (with leading space) to match the word, not the prefix.
|
||||
if strings.Contains(title, "restart") {
|
||||
action = ActionRestart
|
||||
} else if strings.Contains(title, "shutdown") || strings.Contains(title, "stop") {
|
||||
action = ActionShutdown
|
||||
} else if strings.Contains(title, " cycle") || strings.Contains(title, "cycling") {
|
||||
action = ActionCycle
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user