Skip to content

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

fix: show unavailable disk and CoS health probes (#8277)

[._.]/ Adam Eivy460773f0c9df
diff --git a/client/src/components/SystemHealthWidget.jsx b/client/src/components/SystemHealthWidget.jsx
index f0c52f7167..f5753b1bff 100644
--- a/client/src/components/SystemHealthWidget.jsx
+++ b/client/src/components/SystemHealthWidget.jsx
@@ -68,6 +68,8 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })
}
const { overallHealth, warnings, system, processes, apps, cos } = health;
+ const diskProbeUnavailable = warnings.some(warning => warning.type === 'probe-unavailable' && warning.source === 'disk');
+ const cosProbeUnavailable = warnings.some(warning => warning.type === 'probe-unavailable' && warning.source === 'cos');
const healthStyle = HEALTH_STYLE[overallHealth] || { color: 'text-gray-400', bg: 'bg-gray-400/10', icon: Activity };
const HealthIcon = healthStyle.icon;
@@ -253,7 +255,7 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })
</div>
{/* Disk Usage */}
- {system.disk && (
+ {system.disk ? (
<Link
to="/system-resources/storage"
aria-label="Open disk usage report"
@@ -276,21 +278,26 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })
/>
</div>
</Link>
- )}
+ ) : diskProbeUnavailable ? (
+ <div className="rounded-lg bg-port-bg/50 p-3" aria-label="Disk status unavailable">
+ <div className="text-xs text-gray-500">Disk</div>
+ <div className="text-lg font-bold text-port-warning">Unavailable</div>
+ </div>
+ ) : null}
</div>
{/* CoS Status (if running) */}
- {cos && (
+ {(cos || cosProbeUnavailable) && (
<div className="mt-4 pt-4 border-t border-port-border">
<div className="flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-sm">
<div className="flex min-w-0 items-center gap-2">
- <div className={`w-2 h-2 rounded-full ${cos.running ? (cos.paused ? 'bg-port-warning' : 'bg-port-success animate-pulse') : 'bg-gray-500'}`} />
+ <div className={`w-2 h-2 rounded-full ${cosProbeUnavailable ? 'bg-port-warning' : cos.running ? (cos.paused ? 'bg-port-warning' : 'bg-port-success animate-pulse') : 'bg-gray-500'}`} />
<span className="truncate text-gray-300">Chief of Staff</span>
<span className="text-gray-500">
- {cos.running ? (cos.paused ? 'Paused' : 'Active') : 'Stopped'}
+ {cosProbeUnavailable ? 'Unavailable' : cos.running ? (cos.paused ? 'Paused' : 'Active') : 'Stopped'}
</span>
</div>
- {cos.running && (
+ {cos?.running && !cosProbeUnavailable && (
<div className="flex items-center gap-3 text-xs text-gray-500">
{cos.activeAgents > 0 && (
<span className="text-port-accent">{cos.activeAgents} agent{cos.activeAgents !== 1 ? 's' : ''}</span>
diff --git a/client/src/components/SystemHealthWidget.test.jsx b/client/src/components/SystemHealthWidget.test.jsx
index 0839a76810..48de772e7e 100644
--- a/client/src/components/SystemHealthWidget.test.jsx
+++ b/client/src/components/SystemHealthWidget.test.jsx
@@ -73,6 +73,19 @@ describe('SystemHealthWidget', () => {
expect(screen.getByRole('link', { name: /Details/ })).toHaveAttribute('href', '/system-resources/overview');
});
+ it('keeps failed disk and CoS probes visible without offering dismissal', () => {
+ const warnings = [
+ { type: 'probe-unavailable', source: 'disk', status: 'unavailable', severity: 'warning', message: 'Disk status unavailable', dismissible: false },
+ { type: 'probe-unavailable', source: 'cos', status: 'unavailable', severity: 'warning', message: 'Chief of Staff status unavailable', dismissible: false },
+ ];
+ renderWidget({ health: { ...HEALTH, warnings, system: { ...HEALTH.system, disk: null }, cos: null }, refetchHealth: vi.fn() });
+
+ expect(screen.getByLabelText('Disk status unavailable')).toHaveTextContent('Unavailable');
+ expect(screen.getByText('Chief of Staff').parentElement).toHaveTextContent('Unavailable');
+ expect(screen.queryByRole('button', { name: /Dismiss warning:/ })).not.toBeInTheDocument();
+ expect(screen.queryByText('Stopped')).not.toBeInTheDocument();
+ });
+
it('keeps memory neutral while honoring configured disk thresholds', () => {
const health = {
...HEALTH,
diff --git a/client/src/pages/SystemHealthPage.jsx b/client/src/pages/SystemHealthPage.jsx
index d497677ad2..aeadf58d3b 100644
--- a/client/src/pages/SystemHealthPage.jsx
+++ b/client/src/pages/SystemHealthPage.jsx
@@ -271,7 +271,7 @@ function SystemHealthOverview() {
pct={Math.min(100, health.system.cpu.usagePercent)}
sub={`${health.system.cpu.cores} cores · ${health.system.cpu.loadAvg1m.toFixed(2)} load`}
/>
- {health.system.disk && (
+ {health.system.disk ? (
<ResourceCard
icon={Database}
label="Disk"
@@ -280,7 +280,12 @@ function SystemHealthOverview() {
critical={t.diskCritical}
sub={`${health.system.disk.usedFormatted} / ${health.system.disk.totalFormatted}`}
/>
- )}
+ ) : health.warnings?.some(warning => warning.type === 'probe-unavailable' && warning.source === 'disk') ? (
+ <div className="bg-port-card border border-port-border rounded-xl p-4" aria-label="Disk status unavailable">
+ <div className="text-xs uppercase tracking-wide text-gray-500 mb-2">Disk</div>
+ <div className="text-3xl font-bold text-port-warning">Unavailable</div>
+ </div>
+ ) : null}
</section>
<MediaCapacityPanel media={health.media} />
diff --git a/client/src/pages/SystemHealthPage.test.jsx b/client/src/pages/SystemHealthPage.test.jsx
index ef6d2ad15c..bd2d8219be 100644
--- a/client/src/pages/SystemHealthPage.test.jsx
+++ b/client/src/pages/SystemHealthPage.test.jsx
@@ -93,6 +93,18 @@ describe('SystemHealthPage remediation links', () => {
expect(within(banner).getByRole('link', { name: /Disk usage breakdown/ })).toHaveAttribute('href', '/system-resources/storage');
});
+ it('renders an unavailable disk card when the disk probe fails', async () => {
+ api.getSystemHealth.mockResolvedValue({
+ ...HEALTH,
+ system: { ...HEALTH.system, disk: null },
+ warnings: [{ type: 'probe-unavailable', source: 'disk', status: 'unavailable', severity: 'warning', message: 'Disk status unavailable', dismissible: false }],
+ });
+ renderPage();
+
+ expect(await screen.findByLabelText('Disk status unavailable')).toHaveTextContent('Unavailable');
+ expect(screen.queryByRole('button', { name: 'Dismiss warning: Disk status unavailable' })).not.toBeInTheDocument();
+ });
+
it('links memory, process and app alerts to their own remediation page', async () => {
api.getSystemHealth.mockResolvedValue(withWarnings([
{ type: 'memory', message: 'Memory usage at or above 85%' },
diff --git a/server/lib/validation.js b/server/lib/validation.js
index 7df6bf5dd4..c74d93a29e 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -1635,9 +1635,8 @@ export const databaseExportSchema = z.object({
backend: z.enum(DB_BACKENDS).optional()
});
-// System health dashboard warnings — see server/routes/systemHealth.js. The
-// `type` enum mirrors every `rawWarnings.push({ type: ... })` call site there;
-// keep the two lists in sync.
+// Dismissible system health warnings — see server/routes/systemHealth.js.
+// Probe failures are intentionally excluded: a missing measurement cannot be dismissed.
export const SYSTEM_HEALTH_WARNING_TYPES = ['memory', 'cpu', 'disk', 'process', 'restarts', 'apps', 'database', 'forge', 'code-review', 'health-settings'];
export const systemHealthWarningParamsSchema = z.object({ type: z.enum(SYSTEM_HEALTH_WARNING_TYPES) });
export const systemHealthWarningDismissSchema = z.object({ message: z.string().trim().min(1).max(500) });
diff --git a/server/routes/health.test.js b/server/routes/health.test.js
index 332eadc5f5..6c5b8e6a57 100644
--- a/server/routes/health.test.js
+++ b/server/routes/health.test.js
@@ -157,6 +157,35 @@ describe('System Health Routes', () => {
expect(response.body).toHaveProperty('overallHealth');
});
+ it('reports failed disk and CoS probes without exposing their errors or hiding healthy measurements', async () => {
+ const diskError = 'private disk probe detail';
+ const cosError = 'private CoS probe detail';
+ const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
+ vi.mocked(statfs).mockRejectedValueOnce(new Error(diskError));
+ getStatus.mockRejectedValueOnce(new Error(cosError));
+ checkHealth.mockResolvedValueOnce({ connected: true, hasSchema: true });
+
+ try {
+ const response = await request(app).get('/api/system/health/details');
+ expect(response.status).toBe(200);
+ expect(response.body.overallHealth).toBe('warning');
+ expect(response.body.system.disk).toBeNull();
+ expect(response.body.cos).toBeNull();
+ expect(response.body.warnings).toEqual([
+ { type: 'probe-unavailable', source: 'disk', status: 'unavailable', severity: 'warning', message: 'Disk status unavailable', dismissible: false },
+ { type: 'probe-unavailable', source: 'cos', status: 'unavailable', severity: 'warning', message: 'Chief of Staff status unavailable', dismissible: false }
+ ]);
+ expect(JSON.stringify(response.body)).not.toContain(diskError);
+ expect(JSON.stringify(response.body)).not.toContain(cosError);
+ expect(errorSpy).toHaveBeenCalledTimes(2);
+
+ const dismiss = await request(app).post('/api/system/health/warnings/probe-unavailable/dismiss').send({ message: 'Disk status unavailable' });
+ expect(dismiss.status).toBe(400);
+ } finally {
+ errorSpy.mockRestore();
+ }
+ });
+
it('serves the running build on its own route (#4694)', async () => {
const response = await request(app).get('/api/system/build');
diff --git a/server/routes/systemHealth.js b/server/routes/systemHealth.js
index 83fd62b12c..006f51dd33 100644
--- a/server/routes/systemHealth.js
+++ b/server/routes/systemHealth.js
@@ -81,8 +81,8 @@ async function assertHealthSettingsWritable() {
}
const assertDismissibleWarningType = (type) => {
- if (type === 'health-settings') {
- throw new ServerError('The system health settings warning cannot be dismissed.', { status: 400 });
+ if (type === 'health-settings' || type === 'probe-unavailable') {
+ throw new ServerError('This system health warning cannot be dismissed.', { status: 400 });
}
};
@@ -155,12 +155,16 @@ router.get('/health', asyncHandler(async (req, res) => {
*/
router.get('/health/details', asyncHandler(async (req, res) => {
const startTime = Date.now();
+ const failedProbe = Symbol('failed health probe');
// Gather data in parallel
const [pm2Processes, appStatusSummary, cosStatus, cosPendingTaskIds, cosAgents, self, dbHealth, version, diskStats, memStats, healthSettings, forgeHealth, mediaCapacity, reviewerConfigHealth] = await Promise.all([
listProcesses().catch(() => []),
getAppStatusSummary().catch(() => ({ total: 0, online: 0, stopped: 0, notStarted: 0, unknown: 0, degraded: false, unmanaged: 0 })),
- cos.getStatus().catch(() => null),
+ cos.getStatus().catch((error) => {
+ console.error('Chief of Staff health probe failed', error);
+ return failedProbe;
+ }),
// Queue depth is read here rather than taken off `getStatus()`, which has no
// such field — `cosStatus.queueLength` never existed, so the widget's
// "N queued" was dead and always rendered 0. Both reads ride the same
@@ -170,7 +174,10 @@ router.get('/health/details', asyncHandler(async (req, res) => {
getSelf().catch(() => null),
checkHealth().catch(() => ({ connected: false, hasSchema: false, error: 'Health check failed' })),
getCurrentVersion().catch(() => null),
- statfs('/').catch(() => null),
+ statfs('/').catch((error) => {
+ console.error('Root filesystem health probe failed', error);
+ return failedProbe;
+ }),
getMemoryStats(),
loadHealthSettings(),
checkGhHealth().catch(() => ({ status: 'error', ok: false, detail: 'Health check failed', remedy: null, checkedAt: null })),
@@ -192,7 +199,7 @@ router.get('/health/details', asyncHandler(async (req, res) => {
// bavail = blocks available to unprivileged users (what the user can actually fill).
// Derive used/usagePercent from the same figure so `used + free === total` and
// the UI's percent corresponds to the displayed `free`.
- const parsedDisk = parseFilesystemStats(diskStats);
+ const parsedDisk = diskStats === failedProbe ? null : parseFilesystemStats(diskStats);
const disk = parsedDisk && {
total: parsedDisk.total,
used: parsedDisk.used,
@@ -250,6 +257,13 @@ router.get('/health/details', asyncHandler(async (req, res) => {
});
}
+ if (diskStats === failedProbe) {
+ rawWarnings.push({ type: 'probe-unavailable', source: 'disk', status: 'unavailable', severity: 'warning', message: 'Disk status unavailable', dismissible: false });
+ }
+ if (cosStatus === failedProbe) {
+ rawWarnings.push({ type: 'probe-unavailable', source: 'cos', status: 'unavailable', severity: 'warning', message: 'Chief of Staff status unavailable', dismissible: false });
+ }
+
if (disk) {
if (disk.usagePercent >= thresholds.diskCritical) {
rawWarnings.push({ type: 'disk', severity: 'critical', message: `Disk usage at or above ${thresholds.diskCritical}%` });
@@ -321,7 +335,7 @@ router.get('/health/details', asyncHandler(async (req, res) => {
for (const warning of rawWarnings) {
const dismissal = dismissedWarnings[warning.type];
const pendingPrune = pendingDismissalPrunes.get(warning.type);
- if (dismissal?.message === warning.message && !sameDismissal(pendingPrune, dismissal)) {
+ if (warning.dismissible !== false && dismissal?.message === warning.message && !sameDismissal(pendingPrune, dismissal)) {
nextDismissedWarnings[warning.type] = dismissal;
continue;
}
@@ -372,7 +386,7 @@ router.get('/health/details', asyncHandler(async (req, res) => {
// An unreadable list degrades to null — unknown, which the widget hides —
// rather than to a manufactured zero.
const heldByRunningAgent = runningAgentsByTaskId(cosAgents);
- const cosInfo = cosStatus ? {
+ const cosInfo = cosStatus && cosStatus !== failedProbe ? {
running: cosStatus.running,
paused: cosStatus.paused,
activeAgents: cosAgents