Notify on failed runs and with ntfy disabled

This commit is contained in:
2026-11-12 01:55:28 +00:00
parent 2330f50268
commit 7b1b91f452
10 changed files with 78 additions and 37 deletions
+19
View File
@@ -50,6 +50,25 @@ func newAppNotificationFixture(t *testing.T, ctx context.Context) *appNotificati
return &appNotificationFixture{t: t, ctx: ctx, store: store, runner: handler.(*runHandler).runner, url: srv.URL, def: def}
}
func TestToolNotificationRecordsAppNotificationWhenNtfyDisabled(t *testing.T) {
ctx := context.Background()
store := newOperatorStore(t)
if _, err := store.UpdateNotificationSettings(ctx, map[string]any{protocol.NotifyNtfyEnabled: false}); err != nil {
t.Fatal(err)
}
hub := &chatHub{notes: newAppNotifier(store), settings: store}
if ok, diagnostic := hub.publishToolNotification(ctx, "session-1", "Build failed", "Please inspect the run"); !ok || diagnostic != "" {
t.Fatalf("tool notification result = %v, %q", ok, diagnostic)
}
active, _, err := store.ActiveAppNotifications(ctx, "", time.Now())
if err != nil || len(active) != 1 {
t.Fatalf("app notifications = %+v, %v", active, err)
}
if active[0].Kind != protocol.NotificationChatReply || active[0].Title != "Build failed" || active[0].Message != "Please inspect the run" {
t.Fatalf("wrong tool notification: %+v", active[0])
}
}
// failRun creates a "Notify me" run and fails it, which commits a durable run
// notification intent in the same transaction, then drains the outbox.
func (f *appNotificationFixture) failRun(name string) int64 {