Fix phantom inbox badge count when failed runs exist
The server-side badge counted agent error alerts independently of failed runs, but the UI suppresses agent error alerts when individual failed run cards are already shown. This mismatch caused the badge to show e.g. 2 while only 1 item was visible. Align server logic with the client. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,8 +41,9 @@ export function sidebarBadgeRoutes(db: Db) {
|
||||
});
|
||||
const summary = await dashboard.summary(companyId);
|
||||
const staleIssueCount = await issueSvc.staleCount(companyId, 24 * 60);
|
||||
const hasFailedRuns = badges.failedRuns > 0;
|
||||
const alertsCount =
|
||||
(summary.agents.error > 0 ? 1 : 0) +
|
||||
(summary.agents.error > 0 && !hasFailedRuns ? 1 : 0) +
|
||||
(summary.costs.monthBudgetCents > 0 && summary.costs.monthUtilizationPercent >= 80 ? 1 : 0);
|
||||
badges.inbox = badges.failedRuns + alertsCount + staleIssueCount;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user