From ea8db5019494f51557e82ea888faaca2fae89aba Mon Sep 17 00:00:00 2001 From: g-but <41178744+g-but@users.noreply.github.com> Date: Mon, 11 May 2026 11:15:58 +0200 Subject: [PATCH] feat(today): surface degraded fleet projects in SummaryBar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit getFleetSummary now also reads sessionHealth from DB and counts projects whose health is degraded or critical. A new amber pill appears in SummaryBar when any exist, linking to /control — so the user sees unhealthy agents from Today without opening the Control panel. Co-Authored-By: Claude Sonnet 4.6 --- src/components/today/SummaryBar.tsx | 5 ++++- src/db/queries/today.ts | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/today/SummaryBar.tsx b/src/components/today/SummaryBar.tsx index a477dc830..558fc0c8d 100644 --- a/src/components/today/SummaryBar.tsx +++ b/src/components/today/SummaryBar.tsx @@ -1,4 +1,4 @@ -import { Target, Bell, Inbox, AlertCircle, Clock, Calendar, Users, Repeat2, Bot } from "lucide-react"; +import { Target, Bell, Inbox, AlertCircle, Clock, Calendar, Users, Repeat2, Bot, Activity } from "lucide-react"; import Link from "next/link"; import { getTodaySummary, getFleetSummary } from "@/db/queries/today"; import { getCurrentUserId } from "@/lib/session"; @@ -41,6 +41,9 @@ export async function SummaryBar() { {s.urgentAlerts > 0 && ( )} + {fleet.degraded > 0 && ( + + )} {fleet.running > 0 && ( )} diff --git a/src/db/queries/today.ts b/src/db/queries/today.ts index 252041bfb..1fe86996d 100644 --- a/src/db/queries/today.ts +++ b/src/db/queries/today.ts @@ -10,7 +10,7 @@ import { commitments, subscriptions, goals, alerts, actions, events, projectStat import { eq, and, lte, isNotNull, sql } from "drizzle-orm"; import { HEALTH_FADING_DAYS } from "@/lib/constants/people"; import { GOAL_STATUS, SUB_STATUS, COMMITMENT_STATUS, ACTION_STATUS, ALERT_SEVERITY, EVENT_STATUS } from "@/lib/constants/statuses"; -import { READY_WINDOW_S, PROMPT_RUNNING_WINDOW_S } from "@/lib/constants/control"; +import { READY_WINDOW_S, PROMPT_RUNNING_WINDOW_S, getHealthShort } from "@/lib/constants/control"; import { z } from "zod"; export const CreateCommitmentBody = z.object({ @@ -239,18 +239,24 @@ export async function getFleetSummary(userId: string) { .select({ currentPromptStartedAt: projectStates.currentPromptStartedAt, readyAt: projectStates.readyAt, + sessionHealth: projectStates.sessionHealth, }) .from(projectStates) .where(eq(projectStates.userId, userId)); let running = 0; let waiting = 0; + let degraded = 0; for (const r of rows) { if (r.currentPromptStartedAt && r.currentPromptStartedAt > cutoffRunning) { running++; } else if (r.readyAt && r.readyAt > cutoffWaiting) { waiting++; } + if (r.sessionHealth) { + const short = getHealthShort(r.sessionHealth); + if (short === "degraded" || short === "critical") degraded++; + } } - return { running, waiting }; + return { running, waiting, degraded }; }