fix: deliver heartbeat LLM response to user during plan interview/review

After restart, heartbeat runs the LLM which sees MEMORY.md and generates
a contextual response, but it was always silently discarded. Now check
plan status after the LLM responds and return UserResult when interviewing
or review so the conversation can resume.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
dj-oyu 2026-02-24 07:21:53 +09:00
parent 886673415a
commit dcbb88066b
2 changed files with 14 additions and 2 deletions

View file

@ -115,8 +115,11 @@ func gatewayCmd() {
if response == "HEARTBEAT_OK" {
return tools.SilentResult("Heartbeat OK")
}
// For heartbeat, always return silent - the subagent result will be
// sent to user via processSystemMessage when the async task completes
// Deliver response to user when a plan interview/review needs resuming.
// For async tasks (spawn), results are delivered separately via processSystemMessage.
if status := agentLoop.GetPlanStatus(); status == "interviewing" || status == "review" {
return tools.UserResult(response)
}
return tools.SilentResult(response)
})

View file

@ -2301,6 +2301,15 @@ func (al *AgentLoop) GetPlanInfo() (hasPlan bool, status string, currentPhase, t
return
}
// GetPlanStatus returns the current plan status ("interviewing", "executing", "review", etc.) or "".
func (al *AgentLoop) GetPlanStatus() string {
agent := al.registry.GetDefaultAgent()
if agent == nil {
return ""
}
return agent.ContextBuilder.GetPlanStatus()
}
// GetPlanPhases returns structured phase/step data from the default agent's plan.
func (al *AgentLoop) GetPlanPhases() []PlanPhase {
agent := al.registry.GetDefaultAgent()