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: transition-log CoS status probe in system health snapshot
[._.]/ Adam Eivy5a041d43d2c9
diff --git a/server/routes/health.test.js b/server/routes/health.test.jsindex b3977c9cda..4853e12883 100644--- a/server/routes/health.test.js+++ b/server/routes/health.test.js@@ -271,6 +271,43 @@ describe('System Health Routes', () => {}});+ it('transition-logs CoS status probe failure once on entry and once on recovery without poll noise', async () => {+ // Ensure healthy initial state+ getStatus.mockResolvedValueOnce({ running: true, paused: false, activeAgents: 0 });+ await request(app).get('/api/system/health/details');++ const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});+ const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});++ try {+ // First failure logs unavailable once+ getStatus.mockRejectedValueOnce(Object.assign(new Error('connection refused'), { code: 'ECONNREFUSED' }));+ const first = await request(app).get('/api/system/health/details');+ expect(first.status).toBe(200);+ expect(first.body.cos).toBeNull();+ expect(errorSpy).toHaveBeenCalledWith('❌ CoS health probe unavailable (source=cos-status, code=ECONNREFUSED)');++ errorSpy.mockClear();++ // Second consecutive failure does NOT emit an error (deduplicated / throttled)+ getStatus.mockRejectedValueOnce(Object.assign(new Error('connection refused'), { code: 'ECONNREFUSED' }));+ const second = await request(app).get('/api/system/health/details');+ expect(second.status).toBe(200);+ expect(second.body.cos).toBeNull();+ expect(errorSpy).not.toHaveBeenCalled();++ // Recovery logs once+ getStatus.mockResolvedValueOnce({ running: true, paused: false, activeAgents: 1 });+ const third = await request(app).get('/api/system/health/details');+ expect(third.status).toBe(200);+ expect(third.body.cos).toMatchObject({ running: true });+ expect(logSpy).toHaveBeenCalledWith('✅ CoS health probe recovered (source=cos-status)');+ } finally {+ errorSpy.mockRestore();+ logSpy.mockRestore();+ }+ });+it('reports an unreadable PM2 as unavailable rather than zero processes (#8431)', async () => {listProcessesStrict.mockResolvedValueOnce(null);checkHealth.mockResolvedValueOnce({ connected: true, hasSchema: true });diff --git a/server/services/systemHealthSnapshot.js b/server/services/systemHealthSnapshot.jsindex 39ee04821a..9c2b73f238 100644--- a/server/services/systemHealthSnapshot.js+++ b/server/services/systemHealthSnapshot.js@@ -67,7 +67,7 @@ async function loadHealthSettings() {};}-// Last observed availability per CoS read ('cos-queue' / 'cos-agents'), so a+// Last observed availability per CoS read ('cos-status' / 'cos-queue' / 'cos-agents'), so a// persistent failure logs once on entry and once on recovery, not on every read.const cosProbeAvailability = new Map();@@ -94,10 +94,10 @@ export async function getSystemHealthSnapshot() {console.error(`❌ App health probe failed (operation=getAppStatusSummary, code=${code})`);return failedProbe;}),- cos.getStatus().catch((error) => {- console.error(`❌ Chief of Staff health probe failed: ${error.message}`);- return failedProbe;- }),+ cos.getStatus().then(+ (status) => { noteCosProbe('cos-status', true); return status; },+ (error) => { noteCosProbe('cos-status', false, 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