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([issue-709]): match real backup + health-alert shapes; show degraded-source notice when empty
[._.]/ Adam Eivy166fbfc88c58
diff --git a/client/src/pages/Review.jsx b/client/src/pages/Review.jsxindex 911454402d..eec47d4494 100644--- a/client/src/pages/Review.jsx+++ b/client/src/pages/Review.jsx@@ -253,23 +253,29 @@ export default function Review() {</section>{/* Cross-domain "Needs Attention" queue (M42 P5) — live-pulled from- Brain, Ask, CoS, Messages, Health, and Backups. */}- {queueItems.length > 0 && (+ Brain, Ask, CoS, Messages, Health, and Backups. Shown whenever there+ are items OR a source failed to load (so the degraded-source notice+ isn't hidden behind an otherwise-empty queue). */}+ {(queueItems.length > 0 || queueSourceErrors.length > 0) && (<section className="bg-port-card border border-port-border rounded-xl p-4 space-y-3"><div className="flex items-center justify-between gap-3"><h3 className="text-sm font-semibold text-white flex items-center gap-2"><Inbox size={16} className="text-port-accent" />Needs Attention</h3>- <span className="text-xs rounded-full px-2 py-0.5 bg-port-accent/10 text-port-accent border border-port-accent/20">- {queueItems.length} across domains- </span>- </div>- <div className="space-y-2">- {queueItems.map(item => (- <QueueRow key={item.id} item={item} onDrill={handleQueueDrill} onDismiss={handleQueueDismiss} />- ))}+ {queueItems.length > 0 && (+ <span className="text-xs rounded-full px-2 py-0.5 bg-port-accent/10 text-port-accent border border-port-accent/20">+ {queueItems.length} across domains+ </span>+ )}</div>+ {queueItems.length > 0 && (+ <div className="space-y-2">+ {queueItems.map(item => (+ <QueueRow key={item.id} item={item} onDrill={handleQueueDrill} onDismiss={handleQueueDismiss} />+ ))}+ </div>+ )}{queueSourceErrors.length > 0 && (<p className="text-xs text-gray-600">Couldn't load: {queueSourceErrors.map(([, s]) => s.label).join(', ')}.diff --git a/server/services/reviewQueue.js b/server/services/reviewQueue.jsindex 82a3397efa..5e6c514b63 100644--- a/server/services/reviewQueue.js+++ b/server/services/reviewQueue.js@@ -121,8 +121,10 @@ const PRODUCERS = [label: 'Message drafts',drillTo: '/messages/drafts',async gather() {- // Drafts the user (or an AI) prepared that haven't been sent yet —- // both freeform drafts and ones explicitly awaiting review.+ // Drafts the user (or an AI) prepared that haven't been sent yet. Today+ // messageDrafts only emits 'draft' (vs 'approved'); 'pending_review' is+ // matched ahead of the producer adding it (see #832) so this needs no+ // change when it lands.const drafts = await messageDrafts.listDrafts();return drafts.filter(d => d.status === 'draft' || d.status === 'pending_review');},@@ -146,14 +148,16 @@ const PRODUCERS = [const { alerts = [] } = await getAlertsCached();return alerts.filter(a => a.severity === 'critical' || a.severity === 'high');},- map(alert) {+ // proactiveAlerts emits { type, severity, title, detail, link } with no+ // stable id and possibly-repeating types, so key on the array index too.+ map(alert, index) {return {- id: `health:${alert.id || alert.type}`,+ id: `health:${alert.type || 'alert'}:${index}`,title: alert.title || `${alert.type || 'System'} alert`,- summary: (alert.message || '').slice(0, 200),+ summary: (alert.detail || alert.message || '').slice(0, 200),timestamp: alert.timestamp || null,severity: alert.severity === 'critical' ? 'critical' : 'high',- drillTo: alert.actionUrl || '/system-health'+ drillTo: alert.link || '/system-health'};}},@@ -162,16 +166,17 @@ const PRODUCERS = [label: 'Failed backups',drillTo: '/settings/backup',async gather() {- // A backup that failed or errored on its last run needs acknowledgement.+ // A backup that errored on its last run needs acknowledgement. The+ // backup service records failure as status 'error' with an `error` field.const state = await backup.getState();- const failed = state && (state.status === 'failed' || state.lastError);+ const failed = state && (state.status === 'error' || state.error);return failed ? [state] : [];},map(state) {return {id: 'backup:last-run',title: 'Backup failed',- summary: (state.lastError || 'The most recent backup did not complete.').slice(0, 200),+ summary: (state.error || 'The most recent backup did not complete.').slice(0, 200),timestamp: state.lastRun || null,severity: 'high',drillTo: '/settings/backup'@@ -190,10 +195,10 @@ const SEVERITY_ORDER = { critical: 0, high: 1, normal: 2 };async function gatherProducer(producer) {const raw = await producer.gather();const list = Array.isArray(raw) ? raw : [];- const items = list.slice(0, PER_SOURCE_LIMIT).map(item => ({+ const items = list.slice(0, PER_SOURCE_LIMIT).map((item, index) => ({source: producer.source,sourceLabel: producer.label,- ...producer.map(item)+ ...producer.map(item, index)}));return { items, total: list.length };}diff --git a/server/services/reviewQueue.test.js b/server/services/reviewQueue.test.jsindex 654cd8dca0..b49c80e8a0 100644--- a/server/services/reviewQueue.test.js+++ b/server/services/reviewQueue.test.js@@ -25,7 +25,7 @@ function resetEmpty() {cosTaskStore.getCosTasks.mockResolvedValue({ awaitingApproval: [] });messageDrafts.listDrafts.mockResolvedValue([]);proactiveAlerts.generateAlerts.mockResolvedValue({ alerts: [] });- backup.getState.mockResolvedValue({ status: 'success', lastError: null });+ backup.getState.mockResolvedValue({ status: 'ok', error: null });}describe('reviewQueue.buildQueue', () => {@@ -85,21 +85,33 @@ describe('reviewQueue.buildQueue', () => {});it('only surfaces critical/high health alerts and a failed backup', async () => {+ // Real proactiveAlerts shape: { type, severity, title, detail, link }.proactiveAlerts.generateAlerts.mockResolvedValue({ alerts: [- { id: 'al1', type: 'memory', severity: 'critical', message: 'OOM' },- { id: 'al2', type: 'cpu', severity: 'low', message: 'meh' }+ { type: 'system_resource', severity: 'critical', title: 'High memory usage', detail: '95% used', link: '/apps' },+ { type: 'goal_stall', severity: 'medium', title: 'meh', detail: 'low' }] });- backup.getState.mockResolvedValue({ status: 'failed', lastError: 'disk full', lastRun: '2026-06-03T07:00:00.000Z' });+ // Real backup failure shape: status 'error' with an `error` field.+ backup.getState.mockResolvedValue({ status: 'error', error: 'disk full', lastRun: '2026-06-03T07:00:00.000Z' });const queue = await buildQueue();const healthRows = queue.items.filter(i => i.source === 'health');expect(healthRows).toHaveLength(1);- expect(healthRows[0]).toMatchObject({ severity: 'critical' });+ expect(healthRows[0]).toMatchObject({ severity: 'critical', summary: '95% used', drillTo: '/apps' });expect(queue.items.find(i => i.source === 'backup')).toMatchObject({ title: 'Backup failed', summary: 'disk full' });});+ it('gives same-type health alerts unique ids', async () => {+ proactiveAlerts.generateAlerts.mockResolvedValue({ alerts: [+ { type: 'system_resource', severity: 'high', title: 'High memory', detail: 'mem', link: '/apps' },+ { type: 'system_resource', severity: 'high', title: 'High CPU', detail: 'cpu', link: '/apps' }+ ] });+ const queue = await buildQueue();+ const ids = queue.items.filter(i => i.source === 'health').map(i => i.id);+ expect(new Set(ids).size).toBe(2);+ });+it('sorts by severity then recency', async () => {brain.getInboxLog.mockResolvedValue([{ id: 'b1', capturedText: 'normal', capturedAt: '2026-06-03T12:00:00.000Z' }]);- proactiveAlerts.generateAlerts.mockResolvedValue({ alerts: [{ id: 'al1', type: 'disk', severity: 'critical', message: 'crit', timestamp: '2026-06-03T01:00:00.000Z' }] });+ proactiveAlerts.generateAlerts.mockResolvedValue({ alerts: [{ type: 'disk', severity: 'critical', title: 'crit', detail: 'full', link: '/apps', timestamp: '2026-06-03T01:00:00.000Z' }] });const queue = await buildQueue();// critical alert sorts ahead of the (newer) normal brain itemexpect(queue.items[0].severity).toBe('critical');