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
address review (codex): don't let a timestamp-less health read clobber a fresher timestamped one
[._.]/ Adam Eivy3671ee5efbbf
diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsxindex 4b99f0b33c..ff953d36e0 100644--- a/client/src/pages/ChiefOfStaff.jsx+++ b/client/src/pages/ChiefOfStaff.jsx@@ -153,7 +153,11 @@ export default function ChiefOfStaff() {if (!healthData) return prev ?? null;const prevT = Date.parse(prev?.lastCheck ?? '');const newT = Date.parse(healthData.lastCheck ?? '');- return (!Number.isNaN(prevT) && !Number.isNaN(newT) && newT < prevT) ? prev : healthData;+ // Keep prev when it is strictly newer, OR when this read has no comparable+ // timestamp but prev does — a timestamped health check is fresher than an+ // untimed read, so an absent/unparseable lastCheck must not clobber it.+ if (!Number.isNaN(prevT) && (Number.isNaN(newT) || newT < prevT)) return prev;+ return healthData;});setProviders(providersData.providers || []);// Filter out PortOS Autofixer (it's part of PortOS project)diff --git a/client/src/pages/ChiefOfStaff.test.jsx b/client/src/pages/ChiefOfStaff.test.jsxindex c4c122f388..4b3a06eb5d 100644--- a/client/src/pages/ChiefOfStaff.test.jsx+++ b/client/src/pages/ChiefOfStaff.test.jsx@@ -199,6 +199,28 @@ describe('ChiefOfStaff insight freshness (#2654)', () => {expect(screen.queryByText('All Systems Healthy')).not.toBeInTheDocument();});+ it('does not let a timestamp-less health read clobber a fresher timestamped one', async () => {+ api.getCosHealth.mockResolvedValue({+ lastCheck: '2026-01-01T00:00:02Z',+ issues: [{ type: 'error', category: 'memory', message: 'FRESH_ISSUE' }],+ });+ renderAt('health');+ expect(await screen.findByText('FRESH_ISSUE')).toBeInTheDocument();++ // A read with no (parseable) lastCheck must not overwrite the timestamped,+ // fresher health — Date.parse('') is NaN, which must NOT win the guard.+ api.getCosHealth.mockResolvedValue({ issues: [] });+ const handleAppsChanged = getSocketHandler('apps:changed');+ await act(async () => {+ handleAppsChanged();+ await Promise.resolve();+ });++ await waitFor(() => expect(api.getApps.mock.calls.length).toBeGreaterThan(1));+ expect(screen.getByText('FRESH_ISSUE')).toBeInTheDocument();+ expect(screen.queryByText('All Systems Healthy')).not.toBeInTheDocument();+ });+it('preserves last-good health when a fetchData health read fails (null)', async () => {api.getCosHealth.mockResolvedValue({lastCheck: '2026-01-01T00:00:02Z',