Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: honor configured system health thresholds (#6757)
[._.]/ Adam Eivyfbe4017842b9
diff --git a/client/src/components/SystemHealthWidget.jsx b/client/src/components/SystemHealthWidget.jsxindex 80d3e6706f..b8e787705a 100644--- a/client/src/components/SystemHealthWidget.jsx+++ b/client/src/components/SystemHealthWidget.jsx@@ -8,8 +8,6 @@ import {Database,ChevronRight,AlertTriangle,- CheckCircle,- XCircle,Clock,Zap,RefreshCw,@@ -17,6 +15,7 @@ import {} from 'lucide-react';import { MicroGlyph } from './micrographics';import { useHealthWarningDismiss } from '../hooks/useHealthWarningDismiss.jsx';+import { HEALTH_STYLE, pctTone, barTone, resolveHealthThresholds } from '../lib/healthStyle.js';/*** SystemHealthWidget - Compact system health overview for the Dashboard@@ -70,36 +69,9 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })const { overallHealth, warnings, system, processes, apps, cos } = health;- // Get status color and icon- const getHealthStyle = () => {- switch (overallHealth) {- case 'healthy':- return { color: 'text-port-success', bg: 'bg-port-success/10', icon: CheckCircle };- case 'warning':- return { color: 'text-port-warning', bg: 'bg-port-warning/10', icon: AlertTriangle };- case 'critical':- return { color: 'text-port-error', bg: 'bg-port-error/10', icon: XCircle };- default:- return { color: 'text-gray-400', bg: 'bg-gray-400/10', icon: Activity };- }- };-- const healthStyle = getHealthStyle();+ const healthStyle = HEALTH_STYLE[overallHealth] || { color: 'text-gray-400', bg: 'bg-gray-400/10', icon: Activity };const HealthIcon = healthStyle.icon;-- // Get color for usage percentage- const getUsageColor = (percent) => {- if (percent >= 90) return 'text-port-error';- if (percent >= 75) return 'text-port-warning';- return 'text-port-success';- };-- // Get progress bar color- const getBarColor = (percent) => {- if (percent >= 90) return 'bg-port-error';- if (percent >= 75) return 'bg-port-warning';- return 'bg-port-success';- };+ const thresholds = resolveHealthThresholds(health.thresholds);return (<div className="bg-port-card border border-port-border rounded-xl p-4 sm:p-6">@@ -182,7 +154,7 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })<HardDrive size={14} className="text-purple-400" /><span className="text-xs text-gray-500">Memory</span></div>- <div className={`text-lg sm:text-xl font-bold ${getUsageColor(system.memory.usagePercent)}`}>+ <div className={`text-lg sm:text-xl font-bold ${pctTone(system.memory.usagePercent, thresholds.memoryWarn, thresholds.memoryCritical)}`}>{system.memory.usagePercent}%</div><div className="text-xs text-gray-500">@@ -190,7 +162,7 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })</div><div className="mt-2 h-1.5 bg-port-border rounded-full overflow-hidden"><div- className={`h-full rounded-full transition-all ${getBarColor(system.memory.usagePercent)}`}+ className={`h-full rounded-full transition-all ${barTone(system.memory.usagePercent, thresholds.memoryWarn, thresholds.memoryCritical)}`}style={{ width: `${system.memory.usagePercent}%` }}/></div>@@ -202,7 +174,7 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })<Cpu size={14} className="text-blue-400" /><span className="text-xs text-gray-500">CPU</span></div>- <div className={`text-lg sm:text-xl font-bold ${getUsageColor(system.cpu.usagePercent)}`}>+ <div className={`text-lg sm:text-xl font-bold ${pctTone(system.cpu.usagePercent, thresholds.cpuWarn, thresholds.cpuCritical)}`}>{system.cpu.usagePercent}%</div><div className="text-xs text-gray-500">@@ -210,7 +182,7 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })</div><div className="mt-2 h-1.5 bg-port-border rounded-full overflow-hidden"><div- className={`h-full rounded-full transition-all ${getBarColor(Math.min(100, system.cpu.usagePercent))}`}+ className={`h-full rounded-full transition-all ${barTone(Math.min(100, system.cpu.usagePercent), thresholds.cpuWarn, thresholds.cpuCritical)}`}style={{ width: `${Math.min(100, system.cpu.usagePercent)}%` }}/></div>@@ -289,7 +261,7 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })<Database size={14} className="text-cyan-400" /><span className="text-xs text-gray-500">Disk</span></div>- <div className={`text-lg sm:text-xl font-bold ${getUsageColor(system.disk.usagePercent)}`}>+ <div className={`text-lg sm:text-xl font-bold ${pctTone(system.disk.usagePercent, thresholds.diskWarn, thresholds.diskCritical)}`}>{system.disk.usagePercent}%</div><div className="text-xs text-gray-500">@@ -297,7 +269,7 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })</div><div className="mt-2 h-1.5 bg-port-border rounded-full overflow-hidden"><div- className={`h-full rounded-full transition-all ${getBarColor(system.disk.usagePercent)}`}+ className={`h-full rounded-full transition-all ${barTone(system.disk.usagePercent, thresholds.diskWarn, thresholds.diskCritical)}`}style={{ width: `${system.disk.usagePercent}%` }}/></div>diff --git a/client/src/components/SystemHealthWidget.test.jsx b/client/src/components/SystemHealthWidget.test.jsxindex 1796964653..15b5d02fdf 100644--- a/client/src/components/SystemHealthWidget.test.jsx+++ b/client/src/components/SystemHealthWidget.test.jsx@@ -18,6 +18,7 @@ vi.mock('./ui/Toast', () => {const HEALTH = {overallHealth: 'warning',warnings: [{ type: 'disk', severity: 'warning', message: 'Disk usage at or above 90%' }],+ thresholds: { memoryWarn: 85, memoryCritical: 95, diskWarn: 90, diskCritical: 98 },system: {uptimeFormatted: '3h 12m',memory: { usagePercent: 40, usedFormatted: '12 GB', totalFormatted: '32 GB' },@@ -72,6 +73,33 @@ describe('SystemHealthWidget', () => {expect(screen.getByRole('link', { name: /Details/ })).toHaveAttribute('href', '/system-resources/overview');});+ it('uses configured health thresholds for metric colors', () => {+ const health = {+ ...HEALTH,+ system: {+ ...HEALTH.system,+ memory: { ...HEALTH.system.memory, usagePercent: 80 },+ disk: { ...HEALTH.system.disk, usagePercent: 91 },+ },+ thresholds: { memoryWarn: 70, memoryCritical: 90, diskWarn: 95, diskCritical: 99 },+ };+ renderWidget({ health, refetchHealth: vi.fn() });++ expect(screen.getByText('80%')).toHaveClass('text-port-warning');+ expect(screen.getByText('91%')).toHaveClass('text-port-success');+ });++ it('uses the server defaults when threshold data is absent', () => {+ const health = {+ ...HEALTH,+ system: { ...HEALTH.system, memory: { ...HEALTH.system.memory, usagePercent: 80 } },+ thresholds: undefined,+ };+ renderWidget({ health, refetchHealth: vi.fn() });++ expect(screen.getByText('80%')).toHaveClass('text-port-success');+ });+it('dismisses a warning as resolved and refetches health', async () => {const user = userEvent.setup();const refetchHealth = vi.fn().mockResolvedValue(undefined);diff --git a/client/src/lib/README.md b/client/src/lib/README.mdindex 5b0a308245..5a3958b882 100644--- a/client/src/lib/README.md+++ b/client/src/lib/README.md@@ -147,6 +147,7 @@ grep -i "what you want to do" client/src/lib/README.md| `genUtils.js` | Shared bits between Image Gen and Video Gen pages. || `repoUrl.js` | `parseRepoUrl(url)` / `isRepoUrl(url)` / `repoBrowseUrl(parsed)` / `parseGitHubUrl(url)` / `isGitHubRepoUrl(url)` — re-exported from `server/lib/repoUrl.js`, the authoritative repo-URL rule. || `healthProvenance.js` | `PROVENANCE_LEVELS` / `getProvenanceLevel(level)` — the `data-backed`/`inferred`/`experimental`/`speculative` trust taxonomy (label, tone, description, "what would change this?" copy) behind the `ProvenanceChip` source-style chips on MeatSpace / genome / death-clock / longevity views. Pure data; the chip component maps tone→color and id→icon. |+| `healthStyle.js` | Shared health status styles and threshold-aware percentage/bar tones for system health views. || `joinInfluenceList.js` | Mirror of `joinInfluenceList` in server universe builder. || `kanbanColumns.js` | `bucketTickets` / `ticketInColumn` / `columnConfig` / `FALLBACK_COLUMNS` — pure column logic for the Jira Kanban board (`components/KanbanBoard.jsx`). Buckets tickets into resolved workflow columns (by status name, or statusCategory for the fallback board), assigns each column a stable unique `id` (Jira `name` is not unique — same-named columns map to different statuses), appends an orphan column for any unmatched status, and precomputes per-column Tailwind color config (Blocked→red, Review/QA→purple, else by category). || `localLlmBackends.js` | `LOCAL_LLM_BACKENDS` (id/label/lucide icon for Ollama + LM Studio) and `localLlmBackendLabel(id)`. The two backends PortOS keeps a model catalog for, shared by the Runtimes view's backend cards and the Model Library's backend picker so a third backend is added in one place. Exported under qualified names because the barrel is flat and `BACKENDS`/`labelFor` are too generic to claim there. |diff --git a/client/src/lib/healthStyle.js b/client/src/lib/healthStyle.jsnew file mode 100644index 0000000000..e4f5251557--- /dev/null+++ b/client/src/lib/healthStyle.js@@ -0,0 +1,32 @@+import { AlertTriangle, Activity, CheckCircle, XCircle } from 'lucide-react';++export const DEFAULT_HEALTH_THRESHOLDS = {+ memoryWarn: 85,+ memoryCritical: 95,+ diskWarn: 90,+ diskCritical: 98,+ cpuWarn: 75,+ cpuCritical: 100,+};++export const HEALTH_STYLE = {+ healthy: { color: 'text-port-success', bg: 'bg-port-success/10', icon: CheckCircle, label: 'Healthy' },+ warning: { color: 'text-port-warning', bg: 'bg-port-warning/10', icon: AlertTriangle, label: 'Warning' },+ critical: { color: 'text-port-error', bg: 'bg-port-error/10', icon: XCircle, label: 'Critical' },+};++export function resolveHealthThresholds(thresholds = {}) {+ return { ...DEFAULT_HEALTH_THRESHOLDS, ...thresholds };+}++export function pctTone(pct, warn, critical) {+ if (pct >= critical) return 'text-port-error';+ if (pct >= warn) return 'text-port-warning';+ return 'text-port-success';+}++export function barTone(pct, warn, critical) {+ if (pct >= critical) return 'bg-port-error';+ if (pct >= warn) return 'bg-port-warning';+ return 'bg-port-success';+}diff --git a/client/src/lib/index.js b/client/src/lib/index.jsindex e98425b16f..4e5085b182 100644--- a/client/src/lib/index.js+++ b/client/src/lib/index.js@@ -113,6 +113,7 @@ export * from './firstRunMissions.js';export * from './genUtils.js';export * from './repoUrl.js';export * from './healthProvenance.js';+export * from './healthStyle.js';export * from './joinInfluenceList.js';export * from './kanbanColumns.js';export * from './localLlmBackends.js';diff --git a/client/src/pages/SystemHealthPage.jsx b/client/src/pages/SystemHealthPage.jsxindex 35d3fc830b..0c85f5d992 100644--- a/client/src/pages/SystemHealthPage.jsx+++ b/client/src/pages/SystemHealthPage.jsx@@ -1,6 +1,6 @@import { useEffect, useState, useRef } from 'react';import { Link, Navigate, NavLink, useParams } from 'react-router';-import { Activity, AlertTriangle, CheckCircle, XCircle, HardDrive, Cpu, Database, ListOrdered, RefreshCw, ServerCog, X, Zap } from 'lucide-react';+import { Activity, AlertTriangle, HardDrive, Cpu, Database, ListOrdered, RefreshCw, ServerCog, X, Zap } from 'lucide-react';import * as api from '../services/api';import toast from '../components/ui/Toast';import PageSkeleton from '../components/ui/PageSkeleton';@@ -14,12 +14,7 @@ import MediaCapacityPanel from '../components/system-resources/MediaCapacityPaneimport BuildStampPanel from '../components/system-resources/BuildStampPanel.jsx';import { getPageNavTabs } from '../../../server/lib/navManifest.js';import { buildPageNavTabs } from '../lib/pageNavTabs.js';--const HEALTH_STYLE = {- healthy: { color: 'text-port-success', bg: 'bg-port-success/10', icon: CheckCircle, label: 'Healthy' },- warning: { color: 'text-port-warning', bg: 'bg-port-warning/10', icon: AlertTriangle, label: 'Warning' },- critical: { color: 'text-port-error', bg: 'bg-port-error/10', icon: XCircle, label: 'Critical' }-};+import { HEALTH_STYLE, pctTone, barTone, resolveHealthThresholds } from '../lib/healthStyle.js';// Every alert names its own next step. The server tags each warning with a// `type` (server/routes/systemHealth.js), so the banner can carry the link that@@ -42,17 +37,6 @@ const REMEDIATION = {// destination can't drift between the banner and the nav.const DRILL_INS = ['disk', 'process', 'apps'].map(type => REMEDIATION[type]);-function pctTone(pct, warn, critical) {- if (pct >= critical) return 'text-port-error';- if (pct >= warn) return 'text-port-warning';- return 'text-port-success';-}--function barTone(pct, warn, critical) {- if (pct >= critical) return 'bg-port-error';- if (pct >= warn) return 'bg-port-warning';- return 'bg-port-success';-}// Icon per tab id. The manifest (`tabGroup: 'system-resources'`) owns// id/label/order — this page owns only how each tab looks; the short page-local@@ -190,7 +174,7 @@ function SystemHealthOverview() {const style = HEALTH_STYLE[health.overallHealth] || HEALTH_STYLE.healthy;const StatusIcon = style.icon;- const t = health.thresholds;+ const t = resolveHealthThresholds(health.thresholds);const draftValid =draft &&draft.memoryWarn < draft.memoryCritical &&