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: monitor runtime data filesystem capacity independently (#9957)

[._.]/ Adam Eivy620aed15391d
diff --git a/client/src/components/SystemHealthWidget.jsx b/client/src/components/SystemHealthWidget.jsx
index 9723865da2..100009b5af 100644
--- a/client/src/components/SystemHealthWidget.jsx
+++ b/client/src/components/SystemHealthWidget.jsx
@@ -40,7 +40,8 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })
// so React's hook count stays stable across renders.
const memPct = health?.system?.memory?.usagePercent;
const cpuPct = health?.system?.cpu?.usagePercent;
- const diskPct = health?.system?.disk?.usagePercent;
+ const diskPct = Object.hasOwn(health?.system || {}, 'dataDisk')
+ ? health.system.dataDisk?.usagePercent : health?.system?.disk?.usagePercent;
const procOnline = health?.processes?.online;
const procTotal = health?.processes?.total;
const appOnline = health?.apps?.online;
@@ -266,36 +267,41 @@ const SystemHealthWidget = memo(function SystemHealthWidget({ dashboardState })
)}
</div>
- {/* Disk Usage */}
- {system.disk ? (
+ {/* Root fields remain compatible with older health responses. */}
+ {[{ disk: system.disk, label: 'Root disk', unavailable: diskProbeUnavailable },
+ ...(Object.hasOwn(system, 'dataDisk') ? [{ disk: system.dataDisk, label: 'Runtime data disk', unavailable: true }] : [])
+ ].map(({ disk, label, unavailable }) => (
+ disk ? (
<Link
+ key={label}
to="/system-resources/storage"
- aria-label="Open disk usage report"
+ aria-label={label === 'Root disk' ? 'Open disk usage report' : 'Open runtime data disk usage report'}
className="block rounded-lg bg-port-bg/50 p-3 transition-colors hover:bg-port-bg/80 focus:outline-none focus:ring-2 focus:ring-port-accent/60"
>
<div className="flex min-w-0 items-center gap-2 mb-1">
<Database size={14} className="hidden shrink-0 text-cyan-400 @2xs:block" />
- <span className="truncate text-xs text-gray-500">Disk</span>
+ <span className="truncate text-xs text-gray-500">{label}</span>
</div>
- <div className={`text-lg @sm:text-xl font-bold ${pctTone(system.disk.usagePercent, thresholds.diskWarn, thresholds.diskCritical)}`}>
- {system.disk.usagePercent}%
+ <div className={`text-lg @sm:text-xl font-bold ${pctTone(disk.usagePercent, thresholds.diskWarn, thresholds.diskCritical)}`}>
+ {disk.usagePercent}%
</div>
<div className="text-xs text-gray-500">
- {system.disk.usedFormatted} / {system.disk.totalFormatted}
+ {disk.usedFormatted} / {disk.totalFormatted}
</div>
<div className="mt-2 h-1.5 bg-port-border rounded-full overflow-hidden">
<div
- className={`h-full rounded-full transition-all ${barTone(system.disk.usagePercent, thresholds.diskWarn, thresholds.diskCritical)}`}
- style={{ width: `${system.disk.usagePercent}%` }}
+ className={`h-full rounded-full transition-all ${barTone(disk.usagePercent, thresholds.diskWarn, thresholds.diskCritical)}`}
+ style={{ width: `${disk.usagePercent}%` }}
/>
</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>
+ ) : unavailable ? (
+ <div className="rounded-lg bg-port-bg/50 p-3" key={label} aria-label={label === 'Root disk' ? 'Disk status unavailable' : `${label} status unavailable`}>
+ <div className="text-xs text-gray-500">{label}</div>
<div className="text-lg font-bold text-port-warning">Unavailable</div>
</div>
- ) : null}
+ ) : null
+ ))}
</div>
{/* CoS Status (if running) */}
diff --git a/client/src/components/SystemHealthWidget.test.jsx b/client/src/components/SystemHealthWidget.test.jsx
index a07bfecfa4..fef004703d 100644
--- a/client/src/components/SystemHealthWidget.test.jsx
+++ b/client/src/components/SystemHealthWidget.test.jsx
@@ -194,3 +194,14 @@ describe('SystemHealthWidget', () => {
expect(refetchHealth).not.toHaveBeenCalled();
});
});
+
+
+it('distinguishes root and data capacity and never hides unavailable data behind root', () => {
+ const health = { ...HEALTH, system: { ...HEALTH.system, dataDisk: { usagePercent: 99, usedFormatted: '99 GB', totalFormatted: '100 GB' } } };
+ const { rerender } = renderWidget({ health });
+ expect(screen.getByText('Root disk')).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'Open runtime data disk usage report' })).toHaveTextContent('99%');
+ rerender(<MemoryRouter><SystemHealthWidget dashboardState={{ health: { ...health, system: { ...health.system, dataDisk: null } } }} /></MemoryRouter>);
+ expect(screen.getByLabelText('Runtime data disk status unavailable')).toHaveTextContent('Unavailable');
+ expect(screen.getByRole('link', { name: 'Open disk usage report' })).toHaveTextContent('60%');
+});
diff --git a/client/src/components/system-resources/StoragePanel.jsx b/client/src/components/system-resources/StoragePanel.jsx
index e2666b023a..ed460dc860 100644
--- a/client/src/components/system-resources/StoragePanel.jsx
+++ b/client/src/components/system-resources/StoragePanel.jsx
@@ -40,18 +40,20 @@ function ReportEmpty({ loading, onRun }) {
);
}
-function DiskGauge({ filesystem }) {
- if (!filesystem) return null;
+function DiskGauge({ filesystem, label }) {
+ if (!filesystem) return <section className="rounded-2xl border border-port-border bg-port-card p-5" aria-label={`${label} status unavailable`}><h3>{label}</h3><p className="text-port-warning">Unavailable</p></section>;
const pct = Math.min(100, Math.max(0, filesystem.usagePercent));
const color = pct >= 98 ? '#ef4444' : pct >= 90 ? '#f59e0b' : '#22c55e';
return (
<section className="rounded-2xl border border-port-border bg-port-card p-5">
+ <h3 className="mb-3 font-semibold">{label}</h3>
+ {label === 'Runtime data disk' && <p className="mb-3 text-xs text-gray-500">Capacity of the filesystem holding PortOS runtime data. PostgreSQL and external model stores may use other filesystems.</p>}
<div className="grid items-center gap-5 md:grid-cols-[160px_1fr]">
<div
className="relative mx-auto grid h-36 w-36 place-items-center rounded-full"
style={{ background: `conic-gradient(${color} ${pct}%, rgba(75,85,99,.25) ${pct}% 100%)` }}
role="meter"
- aria-label={`${pct}% disk used`}
+ aria-label={`${label}: ${pct}% disk used`}
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={pct}
@@ -299,7 +301,8 @@ export default function StoragePanel({ report, loading, onRunReport, onReport, c
{report.sourceErrors.length > 0 && (
<Banner tone="warning" icon={AlertTriangle}>Some sources were unavailable: {report.sourceErrors.join(', ')}. Other totals remain usable.</Banner>
)}
- <DiskGauge filesystem={report.filesystem} />
+ <DiskGauge filesystem={report.filesystem} label="Root disk" />
+ {Object.hasOwn(report, 'dataFilesystem') && <DiskGauge filesystem={report.dataFilesystem} label="Runtime data disk" />}
<div className="grid gap-4 xl:grid-cols-2">
<StorageAreas areas={report.storageAreas} />
<CandidateRows candidates={report.cleanupCandidates} cleanup={cleanup} />
diff --git a/client/src/components/system-resources/StoragePanel.test.jsx b/client/src/components/system-resources/StoragePanel.test.jsx
index 9525c3f295..10e1a8a901 100644
--- a/client/src/components/system-resources/StoragePanel.test.jsx
+++ b/client/src/components/system-resources/StoragePanel.test.jsx
@@ -136,3 +136,15 @@ describe('StoragePanel storage area meters', () => {
expect(unavailable.firstElementChild.className).not.toContain('animate-pulse');
});
});
+
+
+it('labels both filesystem gauges and preserves unavailable data capacity', () => {
+ const report = { ...makeReport('2026-08-16T00:00:00.000Z'), dataFilesystem: { totalBytes: 1000, usedBytes: 990, freeBytes: 10, usagePercent: 99 } };
+ const renderPanel = value => <MemoryRouter><StoragePanel report={value} loading={false} onRunReport={vi.fn()} onReport={vi.fn()} cleanup={cleanup} /></MemoryRouter>;
+ const { rerender } = render(renderPanel(report));
+ expect(screen.getByRole('meter', { name: 'Root disk: 70% disk used' })).toHaveAttribute('aria-valuenow', '70');
+ expect(screen.getByRole('meter', { name: 'Runtime data disk: 99% disk used' })).toHaveAttribute('aria-valuenow', '99');
+ rerender(renderPanel({ ...report, dataFilesystem: null }));
+ expect(screen.getByLabelText('Runtime data disk status unavailable')).toHaveTextContent('Unavailable');
+ expect(screen.queryByRole('meter', { name: /Runtime data disk/ })).not.toBeInTheDocument();
+});
diff --git a/client/src/pages/SystemHealthPage.jsx b/client/src/pages/SystemHealthPage.jsx
index 27e6cd6273..be14414dfa 100644
--- a/client/src/pages/SystemHealthPage.jsx
+++ b/client/src/pages/SystemHealthPage.jsx
@@ -27,6 +27,7 @@ const READINESS_EVENTS = ['system:health:changed'];
// `forge` is intentionally absent — its message already embeds gh's own remedy
// text and there is no in-app page that fixes it.
const REMEDIATION = {
+ 'data-disk': { to: '/system-resources/storage', label: 'Runtime data disk usage breakdown' },
disk: { to: '/system-resources/storage', label: 'Disk usage breakdown' },
memory: { to: '/devtools/processes', label: 'All processes' },
cpu: { to: '/devtools/processes', label: 'All processes' },
@@ -275,21 +276,24 @@ 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 ? (
+ {[{ disk: health.system.disk, label: 'Root disk', unavailable: health.warnings?.some(warning => warning.type === 'probe-unavailable' && warning.source === 'disk') },
+ ...(Object.hasOwn(health.system, 'dataDisk') ? [{ disk: health.system.dataDisk, label: 'Runtime data disk', unavailable: true }] : [])
+ ].map(({ disk, label, unavailable }) => (disk ? (
<ResourceCard
+ key={label}
icon={Database}
- label="Disk"
- pct={health.system.disk.usagePercent}
+ label={label}
+ pct={disk.usagePercent}
warn={t.diskWarn}
critical={t.diskCritical}
- sub={`${health.system.disk.usedFormatted} / ${health.system.disk.totalFormatted}`}
+ sub={`${disk.usedFormatted} / ${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>
+ ) : unavailable ? (
+ <div className="bg-port-card border border-port-border rounded-xl p-4" key={label} aria-label={label === 'Root disk' ? 'Disk status unavailable' : `${label} status unavailable`}>
+ <div className="text-xs uppercase tracking-wide text-gray-500 mb-2">{label}</div>
<div className="text-3xl font-bold text-port-warning">Unavailable</div>
</div>
- ) : null}
+ ) : null))}
</section>
{error && <p role="status" className="text-port-warning">Health refresh failed. Showing the last available reading.</p>}
diff --git a/client/src/pages/SystemHealthPage.test.jsx b/client/src/pages/SystemHealthPage.test.jsx
index 07e549cc7d..8172d1ad8f 100644
--- a/client/src/pages/SystemHealthPage.test.jsx
+++ b/client/src/pages/SystemHealthPage.test.jsx
@@ -328,3 +328,19 @@ describe('SystemHealthPage — no dangling aria-controls/aria-labelledby', () =>
expectNoDanglingAriaRefs(container);
});
});
+
+
+it('shows labelled root and data capacity on the overview', async () => {
+ api.getSystemHealth.mockResolvedValue({ ...HEALTH, system: { ...HEALTH.system, dataDisk: { usagePercent: 99, usedFormatted: '99 GB', totalFormatted: '100 GB' } } });
+ renderPage();
+ expect(await screen.findByText('Runtime data disk')).toBeInTheDocument();
+ expect(screen.getByText('Root disk')).toBeInTheDocument();
+ expect(screen.getByText('99%')).toBeInTheDocument();
+});
+
+it('shows unavailable data without substituting root capacity', async () => {
+ api.getSystemHealth.mockResolvedValue({ ...HEALTH, system: { ...HEALTH.system, dataDisk: null } });
+ renderPage();
+ expect(await screen.findByLabelText('Runtime data disk status unavailable')).toHaveTextContent('Unavailable');
+ expect(screen.getByText('92%')).toBeInTheDocument();
+});
diff --git a/server/lib/validation.js b/server/lib/validation.js
index ee7fad67bc..9f80502c64 100644
--- a/server/lib/validation.js
+++ b/server/lib/validation.js
@@ -1714,7 +1714,7 @@ export const databaseExportSchema = z.object({
// 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 SYSTEM_HEALTH_WARNING_TYPES = ['memory', 'cpu', 'disk', 'data-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 3affe0f26b..b3977c9cda 100644
--- a/server/routes/health.test.js
+++ b/server/routes/health.test.js
@@ -12,7 +12,8 @@ import { isAuthEnabled } from '../services/auth.js';
import { checkGhHealth } from '../services/github.js';
import { getBuildIdentity } from '../lib/buildIdentity.js';
import { getSettingsWithStatus, updateSettingsWith } from '../services/settings.js';
-import { statfs } from 'fs/promises';
+import { stat, statfs } from 'fs/promises';
+import { PATHS } from '../lib/paths.js';
import { getAppStatusSummary } from '../services/appProcessStatus.js';
vi.mock('../services/pm2.js', () => ({
@@ -25,6 +26,7 @@ vi.mock('../services/pm2.js', () => ({
// otherwise-unrelated route case critical, masking the behavior under test.
vi.mock('fs/promises', async (importOriginal) => ({
...(await importOriginal()),
+ stat: vi.fn(async path => ({ dev: path === '/' ? 1 : 2 })),
statfs: vi.fn().mockResolvedValue({ blocks: 100, bavail: 50, bsize: 1 })
}));
@@ -889,4 +891,70 @@ describe('System Health Routes', () => {
expect(recovered.body.warnings.filter((w) => w.source === 'cos-queue' || w.source === 'cos-agents')).toEqual([]);
});
});
+
+
+ describe('runtime data volume health', () => {
+ const stats = used => ({ blocks: 100, bavail: 100 - used, bsize: 1 });
+ it('warns for a critical data volume, independently dismisses it, and prunes on recovery', async () => {
+ vi.mocked(statfs).mockImplementationOnce(async path => stats(path === '/' ? 20 : 99))
+ .mockImplementationOnce(async path => stats(path === '/' ? 20 : 99));
+ const response = await request(app).get('/api/system/health/details');
+ expect(statfs).toHaveBeenCalledWith(PATHS.data);
+ expect(response.body.system.disk.usagePercent).toBe(20);
+ expect(response.body.system.dataDisk.usagePercent).toBe(99);
+ expect(response.body.overallHealth).toBe('critical');
+ expect(response.body.warnings).toContainEqual({ type: 'data-disk', severity: 'critical', message: 'Runtime data disk usage at or above 98%' });
+ expect(Object.keys(response.body.system.dataDisk).sort()).toEqual(['free', 'freeFormatted', 'total', 'totalFormatted', 'usagePercent', 'used', 'usedFormatted']);
+ const dismissed = await request(app).post('/api/system/health/warnings/data-disk/dismiss').send({ message: 'Runtime data disk usage at or above 98%' });
+ expect(dismissed.status).toBe(200);
+ vi.mocked(getSettingsWithStatus).mockResolvedValueOnce({ corrupt: false, settings: { health: { dismissedWarnings: { 'data-disk': dismissed.body } } } });
+ vi.mocked(statfs).mockResolvedValueOnce(stats(20)).mockResolvedValueOnce(stats(99));
+ const hidden = await request(app).get('/api/system/health/details');
+ expect(hidden.body.warnings.some(w => w.type === 'data-disk')).toBe(false);
+ vi.mocked(getSettingsWithStatus).mockResolvedValueOnce({ corrupt: false, settings: { health: { dismissedWarnings: { 'data-disk': dismissed.body } } } });
+ vi.mocked(statfs).mockResolvedValueOnce(stats(20)).mockResolvedValueOnce(stats(20));
+ const recovered = await request(app).get('/api/system/health/details');
+ expect(recovered.body.system.dataDisk.usagePercent).toBe(20);
+ expect(recovered.body.warnings.some(w => w.type === 'data-disk')).toBe(false);
+ const mutation = vi.mocked(updateSettingsWith).mock.calls.at(-1)[0];
+ expect(mutation({ health: { dismissedWarnings: { 'data-disk': dismissed.body } } }).health.dismissedWarnings).toEqual({});
+ });
+
+ it('keeps one legacy root warning when both volumes share a device', async () => {
+ vi.mocked(stat).mockResolvedValueOnce({ dev: 7 }).mockResolvedValueOnce({ dev: 7 });
+ vi.mocked(statfs).mockResolvedValueOnce(stats(99)).mockResolvedValueOnce(stats(99));
+ const response = await request(app).get('/api/system/health/details');
+ expect(response.body.system.sameFilesystem).toBe(true);
+ expect(response.body.warnings.filter(w => ['disk', 'data-disk'].includes(w.type))).toEqual([{ type: 'disk', severity: 'critical', message: 'Disk usage at or above 98%' }]);
+ });
+
+ it('deduplicates shared-volume samples without losing a newer critical reading', async () => {
+ vi.mocked(stat).mockResolvedValueOnce({ dev: 7 }).mockResolvedValueOnce({ dev: 7 });
+ vi.mocked(statfs).mockResolvedValueOnce(stats(95)).mockResolvedValueOnce(stats(99));
+ const response = await request(app).get('/api/system/health/details');
+ expect(response.body.warnings.filter(w => ['disk', 'data-disk'].includes(w.type))).toEqual([{ type: 'disk', severity: 'critical', message: 'Disk usage at or above 98%' }]);
+ });
+
+ it('does not substitute root capacity for an unavailable data probe and recovers', async () => {
+ vi.mocked(statfs).mockResolvedValueOnce(stats(20)).mockRejectedValueOnce(new Error('private mount detail'));
+ const response = await request(app).get('/api/system/health/details');
+ expect(response.body.system.disk.usagePercent).toBe(20);
+ expect(response.body.system.dataDisk).toBeNull();
+ expect(response.body.overallHealth).not.toBe('healthy');
+ expect(response.body.warnings).toContainEqual({ type: 'probe-unavailable', source: 'data-disk', status: 'unavailable', severity: 'warning', message: 'Runtime data disk status unavailable', dismissible: false });
+ expect(JSON.stringify(response.body)).not.toContain('private mount detail');
+ const recovered = await request(app).get('/api/system/health/details');
+ expect(recovered.body.system.dataDisk.usagePercent).toBe(50);
+ expect(recovered.body.warnings.some(w => w.source === 'data-disk')).toBe(false);
+ });
+
+ it('preserves independent data warnings when filesystem identity cannot be read', async () => {
+ vi.mocked(stat).mockRejectedValueOnce(new Error('unavailable')).mockResolvedValueOnce({ dev: 2 });
+ vi.mocked(statfs).mockResolvedValueOnce(stats(20)).mockResolvedValueOnce(stats(99));
+ const response = await request(app).get('/api/system/health/details');
+ expect(response.body.system.sameFilesystem).toBeNull();
+ expect(response.body.warnings.some(w => w.type === 'data-disk' && w.severity === 'critical')).toBe(true);
+ });
+ });
+
});
diff --git a/server/services/eidoverseWorldSources.js b/server/services/eidoverseWorldSources.js
index 7c5e3d646a..c28969ba3a 100644
--- a/server/services/eidoverseWorldSources.js
+++ b/server/services/eidoverseWorldSources.js
@@ -6,6 +6,7 @@
* readings, prompts, journals, and transcripts never leave this module.
*/
+import { PATHS } from '../lib/paths.js';
import { statfs } from 'node:fs/promises';
import { parseFilesystemStats } from '../lib/fileCore.js';
import { getAllApps } from './apps.js';
@@ -59,7 +60,7 @@ function waitWithSignal(promise, signal) {
}
async function getDiskUsagePercent() {
- const stats = await statfs('/').catch(() => null);
+ const stats = await statfs(PATHS.data).catch(() => null);
return parseFilesystemStats(stats)?.usagePercent ?? null;
}
diff --git a/server/services/eidoverseWorldSources.test.js b/server/services/eidoverseWorldSources.test.js
index 2c57479488..78759e7d18 100644
--- a/server/services/eidoverseWorldSources.test.js
+++ b/server/services/eidoverseWorldSources.test.js
@@ -1,5 +1,8 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { statfs } from 'node:fs/promises';
+import { PATHS } from '../lib/paths.js';
+
const sources = vi.hoisted(() => ({}));
vi.mock('node:fs/promises', () => ({
@@ -85,6 +88,16 @@ beforeEach(() => {
});
describe('Eidoverse world source aggregation', () => {
+ it('uses runtime data capacity and preserves unavailable storage signals', async () => {
+ sources.diskPercent = 99;
+ const result = await collectEidoverseWorldSources();
+ expect(statfs).toHaveBeenCalledWith(PATHS.data);
+ expect(result.health.diskPercent).toBe(99);
+ statfs.mockRejectedValueOnce(new Error('private volume'));
+ const failed = await collectEidoverseWorldSources();
+ expect(failed.health.diskPercent).toBeNull();
+ });
+
it.each([
['critical disk usage', { diskPercent: 95 }, 'error'],
['failed backup', { backupState: { status: 'failed' } }, 'error'],
diff --git a/server/services/systemHealthSnapshot.js b/server/services/systemHealthSnapshot.js
index 310c27ec7e..abb6a26961 100644
--- a/server/services/systemHealthSnapshot.js
+++ b/server/services/systemHealthSnapshot.js
@@ -1,5 +1,5 @@
import os from 'os';
-import { statfs } from 'fs/promises';
+import { stat, statfs } from 'fs/promises';
import { listProcessesStrict } from './pm2.js';
import { getAppStatusSummary, annotateExpectedExit } from './appProcessStatus.js';
import * as cos from './cos.js';
@@ -7,7 +7,7 @@ import { getSelf } from './instanceIdentity.js';
import { checkHealth } from '../lib/db.js';
import { getCurrentVersion } from './updateChecker.js';
import { getMemoryStats } from '../lib/memoryStats.js';
-import { formatBytes, formatDuration } from '../lib/fileUtils.js';
+import { formatBytes, formatDuration, PATHS } from '../lib/fileUtils.js';
import { parseFilesystemStats } from '../lib/fileCore.js';
import { getSettingsWithStatus, updateSettingsWith } from './settings.js';
import { checkGhHealth } from './github.js';
@@ -87,7 +87,7 @@ export async function getSystemHealthSnapshot() {
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([
+ const [pm2Processes, appStatusSummary, cosStatus, cosPendingTaskIds, cosAgents, self, dbHealth, version, diskStats, dataDiskStats, filesystemDevices, memStats, healthSettings, forgeHealth, mediaCapacity, reviewerConfigHealth] = await Promise.all([
listProcessesStrict().catch(() => null),
getAppStatusSummary().catch((error) => {
const code = typeof error?.code === 'string' && /^[A-Z][A-Z0-9_]{0,31}$/.test(error.code) ? error.code : 'unknown';
@@ -117,6 +117,8 @@ export async function getSystemHealthSnapshot() {
console.error(`❌ Root filesystem health probe failed: ${error.message}`);
return failedProbe;
}),
+ statfs(PATHS.data).catch(() => null),
+ Promise.all(['/', PATHS.data].map(path => stat(path).then(result => result.dev).catch(() => null))),
getMemoryStats(),
loadHealthSettings(),
checkGhHealth().catch(() => ({ status: 'error', ok: false, detail: 'Health check failed', remedy: null, checkedAt: null })),
@@ -146,6 +148,10 @@ export async function getSystemHealthSnapshot() {
usagePercent: parsedDisk.usagePercent,
};
+ const dataDisk = parseFilesystemStats(dataDiskStats);
+ const sameFilesystem = filesystemDevices.every(device => device != null)
+ ? filesystemDevices[0] === filesystemDevices[1] : null;
+
// Process status summary from PM2. Processes whose exit is expected (a desktop
// app the user closed) are excluded from the FAILURE-bearing counts: a quit game
// window would otherwise force overallHealth to 'critical' below and light up
@@ -209,6 +215,9 @@ export async function getSystemHealthSnapshot() {
if (diskStats === failedProbe) {
rawWarnings.push({ type: 'probe-unavailable', source: 'disk', status: 'unavailable', severity: 'warning', message: 'Disk status unavailable', dismissible: false });
}
+ if (!dataDisk) {
+ rawWarnings.push({ type: 'probe-unavailable', source: 'data-disk', status: 'unavailable', severity: 'warning', message: 'Runtime data 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 });
}
@@ -226,14 +235,27 @@ export async function getSystemHealthSnapshot() {
rawWarnings.push({ type: 'probe-unavailable', source: 'pm2', status: 'unavailable', severity: 'warning', message: 'Process manager (PM2) status unavailable', dismissible: false });
}
- if (disk) {
- if (disk.usagePercent >= thresholds.diskCritical) {
+ // Concurrent probes may sample a shared volume on either side of a threshold.
+ // Keep one legacy warning identity and use the more severe available reading.
+ const warningDisk = sameFilesystem === true && disk && dataDisk
+ ? (disk.usagePercent >= dataDisk.usagePercent ? disk : dataDisk) : disk;
+ if (warningDisk) {
+ if (warningDisk.usagePercent >= thresholds.diskCritical) {
rawWarnings.push({ type: 'disk', severity: 'critical', message: `Disk usage at or above ${thresholds.diskCritical}%` });
- } else if (disk.usagePercent >= thresholds.diskWarn) {
+ } else if (warningDisk.usagePercent >= thresholds.diskWarn) {
rawWarnings.push({ type: 'disk', severity: 'warning', message: `Disk usage at or above ${thresholds.diskWarn}%` });
}
}
+ // Preserve the root warning identity and its saved dismissals on a shared volume.
+ if (dataDisk && !(sameFilesystem === true && disk)) {
+ if (dataDisk.usagePercent >= thresholds.diskCritical) {
+ rawWarnings.push({ type: 'data-disk', severity: 'critical', message: `Runtime data disk usage at or above ${thresholds.diskCritical}%` });
+ } else if (dataDisk.usagePercent >= thresholds.diskWarn) {
+ rawWarnings.push({ type: 'data-disk', severity: 'warning', message: `Runtime data disk usage at or above ${thresholds.diskWarn}%` });
+ }
+ }
+
if (processStats) {
if (processStats.errored > 0) {
rawWarnings.push({ type: 'process', severity: 'critical', message: `${processStats.errored} process(es) errored` });
@@ -411,7 +433,17 @@ export async function getSystemHealthSnapshot() {
totalFormatted: formatBytes(disk.total),
usedFormatted: formatBytes(disk.used),
freeFormatted: formatBytes(disk.free)
- } : null
+ } : null,
+ dataDisk: dataDisk ? {
+ total: dataDisk.total,
+ used: dataDisk.used,
+ free: dataDisk.free,
+ usagePercent: dataDisk.usagePercent,
+ totalFormatted: formatBytes(dataDisk.total),
+ usedFormatted: formatBytes(dataDisk.used),
+ freeFormatted: formatBytes(dataDisk.free)
+ } : null,
+ sameFilesystem
},
processes: processStats,
apps: appStats,
diff --git a/server/services/systemResources.js b/server/services/systemResources.js
index b4f7dcfbfe..f3e3670435 100644
--- a/server/services/systemResources.js
+++ b/server/services/systemResources.js
@@ -353,6 +353,7 @@ export async function buildSystemResourceReport() {
const [
diskStats,
+ dataDiskStats,
dataOverview,
databaseRow,
hf,
@@ -376,6 +377,7 @@ export async function buildSystemResourceReport() {
modelDuplicates,
] = await Promise.all([
statfs('/').catch(() => null),
+ statfs(PATHS.data).catch(() => null),
getDataOverview({ strict: true }).catch(() => null),
query('SELECT pg_database_size(current_database()) AS bytes')
.then((result) => result.rows[0] || null)
@@ -408,6 +410,13 @@ export async function buildSystemResourceReport() {
freeBytes: parsedFilesystem.freeBytes,
usagePercent: parsedFilesystem.usagePercent,
};
+ const parsedDataFilesystem = parseFilesystemStats(dataDiskStats);
+ const dataFilesystem = parsedDataFilesystem && {
+ totalBytes: parsedDataFilesystem.totalBytes,
+ usedBytes: parsedDataFilesystem.usedBytes,
+ freeBytes: parsedDataFilesystem.freeBytes,
+ usagePercent: parsedDataFilesystem.usagePercent,
+ };
const databaseBytes = finiteOrNull(databaseRow?.bytes);
const dependenciesBytes = sumKnownBytes(dependencySizes);
const ollamaResidencyError = ollamaLoaded == null
@@ -513,6 +522,7 @@ export async function buildSystemResourceReport() {
const sourceErrors = [...new Set([
...storageErrors,
...(!filesystem ? ['filesystem'] : []),
+ ...(!dataFilesystem ? ['data-filesystem'] : []),
...(!ollamaStatus?.available ? ['ollama-backend'] : []),
...(ollamaStored == null ? ['ollama-inventory'] : []),
...(ollamaResidencyError ? ['ollama-residency'] : []),
@@ -545,6 +555,7 @@ export async function buildSystemResourceReport() {
inventorySource: 'scan',
manifestReconciledAt: manifest?.reconciledAt || null,
filesystem,
+ dataFilesystem,
summary: {
knownFootprintBytes: sumKnownBytes(storageAreas.map((area) => area.sizeBytes)),
footprintMayOverlap: true,
diff --git a/server/services/systemResources.test.js b/server/services/systemResources.test.js
index 399acf41cb..a14c82b59e 100644
--- a/server/services/systemResources.test.js
+++ b/server/services/systemResources.test.js
@@ -12,6 +12,7 @@ vi.mock('../lib/db.js', () => ({
vi.mock('../lib/fileUtils.js', () => ({
PATHS: {
root: '/example/portos',
+ data: '/example/data',
browserDownloads: '/example/Downloads',
},
dirSize: vi.fn(async (path) => path.includes('Downloads') ? 900 : 100),
@@ -143,6 +144,22 @@ describe('system resource reporting', () => {
settings.getSettings.mockResolvedValue({});
});
+ it('reports data capacity independently and preserves unknown data probes', async () => {
+ fsPromises.statfs.mockResolvedValueOnce({ blocks: 100, bsize: 1, bavail: 80 })
+ .mockResolvedValueOnce({ blocks: 100, bsize: 1, bavail: 1 });
+ const report = await buildSystemResourceReport();
+ expect(report.filesystem.usagePercent).toBe(20);
+ expect(report.dataFilesystem).toEqual({ totalBytes: 100, usedBytes: 99, freeBytes: 1, usagePercent: 99 });
+ expect(fsPromises.statfs).toHaveBeenCalledWith(fileUtils.PATHS.data);
+ fsPromises.statfs.mockResolvedValueOnce({ blocks: 100, bsize: 1, bavail: 80 }).mockRejectedValueOnce(new Error('private mount'));
+ const failed = await buildSystemResourceReport();
+ expect(failed.filesystem.usagePercent).toBe(20);
+ expect(failed.dataFilesystem).toBeNull();
+ expect(failed.sourceErrors).toContain('data-filesystem');
+ expect(JSON.stringify(failed)).not.toContain('private mount');
+ expect((await buildSystemResourceReport()).dataFilesystem.usagePercent).toBe(75);
+ });
+
it('combines storage, model residency, and live queue summaries', async () => {
const report = await buildSystemResourceReport();
expect(dataManager.getDataOverview).toHaveBeenCalledWith({ strict: true });