Files
Agent-System/internal/server/notification_reminder_loop.go
T
weichenandCursor b6035991d4 feat(notification): add 24h stage advance reminder and confirm on advance.
Poll pending requests every 15 minutes, emit deduplicated escalation notifications, and close requests when creator confirms stage advance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00

38 lines
827 B
Go

package server
import (
"context"
"log/slog"
"time"
)
const defaultReminderPollInterval = 15 * time.Minute
func (s *Server) startNotificationReminderLoop() {
if s == nil || s.notifySvc == nil || !s.notifySvc.Available() {
return
}
go func() {
ticker := time.NewTicker(defaultReminderPollInterval)
defer ticker.Stop()
s.runStageAdvanceReminders(context.Background())
for range ticker.C {
s.runStageAdvanceReminders(context.Background())
}
}()
}
func (s *Server) runStageAdvanceReminders(ctx context.Context) {
if s.notifySvc == nil || !s.notifySvc.Available() {
return
}
n, err := s.notifySvc.ProcessStageAdvanceReminders(ctx)
if err != nil {
slog.Warn("stage advance reminder scan failed", "error", err)
return
}
if n > 0 {
slog.Info("stage advance 24h reminders sent", "count", n)
}
}