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): preserve progressive loading states
[._.]/ Adam Eivy13f340129177
diff --git a/client/src/components/cos/tabs/HealthTab.jsx b/client/src/components/cos/tabs/HealthTab.jsxindex 70b7225687..5e2f6c9042 100644--- a/client/src/components/cos/tabs/HealthTab.jsx+++ b/client/src/components/cos/tabs/HealthTab.jsx@@ -4,7 +4,7 @@ import * as api from '../../../services/api';import { formatDateTime } from '../../../utils/formatters';import ProviderStatusCard from './ProviderStatusCard';-export default function HealthTab({ health, onCheck }) {+export default function HealthTab({ health, healthLoading = false, onCheck }) {const [learning, setLearning] = useState(null);const [loadingLearning, setLoadingLearning] = useState(true);const [backfilling, setBackfilling] = useState(false);@@ -145,7 +145,12 @@ export default function HealthTab({ health, onCheck }) {</button></div>- {!health?.issues || health.issues.length === 0 ? (+ {healthLoading ? (+ <div className="text-center py-4 text-gray-500">+ <RefreshCw size={16} className="animate-spin mx-auto mb-2" />+ Loading health...+ </div>+ ) : !health?.issues || health.issues.length === 0 ? (<div className="bg-port-success/10 border border-port-success/30 rounded-lg p-4 text-center"><CheckCircle className="w-8 h-8 text-port-success mx-auto mb-2" /><p className="text-port-success font-medium text-sm">All Systems Healthy</p>diff --git a/client/src/components/dashboard/WidgetSuggestions.test.jsx b/client/src/components/dashboard/WidgetSuggestions.test.jsxindex fb7131477f..a0549d4ecd 100644--- a/client/src/components/dashboard/WidgetSuggestions.test.jsx+++ b/client/src/components/dashboard/WidgetSuggestions.test.jsx@@ -22,6 +22,13 @@ describe('WidgetSuggestions', () => {expect(gate({})).toBe(false);});+ it('keeps the Apps Grid hidden until its first read completes', () => {+ const gate = WIDGETS_BY_ID.apps.gate;++ expect(gate({ apps: [], appsLoading: true })).toBe(false);+ expect(gate({ apps: [], appsLoading: false })).toBe(true);+ });+it('renders nothing when every gated widget is already present', () => {const { container } = render(<WidgetSuggestionsdiff --git a/client/src/components/dashboard/widgetRegistry.jsx b/client/src/components/dashboard/widgetRegistry.jsxindex e41c04e40f..430d55f709 100644--- a/client/src/components/dashboard/widgetRegistry.jsx+++ b/client/src/components/dashboard/widgetRegistry.jsx@@ -37,8 +37,9 @@ const postFeatureEnabled = (state) => state?.instanceFeatures?.features?.some(// Each entry: { id, label, Component, width, defaultH?, gate? }.// `gate(state) => bool` skips the widget when it has nothing useful to show.-// The Apps tile is intentionally un-gated — it renders its own empty-state-// CTA so the "add your first app" path is always visible on a blank install.+// The Apps tile waits for its first read before rendering so a slow response+// cannot flash the empty-state CTA over an existing installation. It still+// renders its own empty-state CTA after a successful empty response.//// `defaultH` is the row count (each row ≈ 80px) used when a widget is first// auto-placed into a grid. It is a STARTING size, not the rendered height:@@ -53,7 +54,7 @@ export const WIDGETS = [{ id: 'quick-idea', label: 'Quick Idea (Catalog)', Component: QuickIdeaCapture, width: 'half', defaultH: 4 },{ id: 'quick-image', label: 'Quick Image Prompt', Component: QuickImagePrompt, width: 'half', defaultH: 6 },{ id: 'quick-task', label: 'Quick Task', Component: QuickTaskWidget, width: 'half', defaultH: 5 },- { id: 'apps', label: 'Apps Grid', Component: AppsGridWidget, width: 'full', defaultH: 5 },+ { id: 'apps', label: 'Apps Grid', Component: AppsGridWidget, width: 'full', defaultH: 5, gate: (s) => s.appsLoading === false },{ id: 'cos', label: 'Chief of Staff', Component: CosDashboardWidget, width: 'third', defaultH: 6 },{ id: 'goal-progress', label: 'Goal Progress', Component: GoalProgressWidget, width: 'third', defaultH: 5 },{ id: 'upcoming-tasks', label: 'Upcoming Tasks', Component: UpcomingTasksWidget, width: 'third', defaultH: 5 },diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsxindex 81aaa84fb4..3b3612da28 100644--- a/client/src/pages/ChiefOfStaff.jsx+++ b/client/src/pages/ChiefOfStaff.jsx@@ -90,6 +90,7 @@ export default function ChiefOfStaff() {const [tasks, setTasks] = useState({ user: null, cos: null });const [agents, setAgents] = useState([]);const [health, setHealth] = useState(null);+ const [healthLoaded, setHealthLoaded] = useState(false);const [providers, setProviders] = useState([]);// Which provider an unpinned task actually runs on — the Schedule tab names it// on the "Default" option and resolves model/effort choices against it.@@ -152,6 +153,7 @@ export default function ChiefOfStaff() {const resolved = merge ? fresherHealth(healthRef.current, next) : next;healthRef.current = resolved;setHealth(resolved);+ setHealthLoaded(true);return resolved;}, []);@@ -181,8 +183,15 @@ export default function ChiefOfStaff() {api.getCosTasks().catch(() => ({ user: null, cos: null })),api.getCosAgents().catch(() => []),]);+ const healthRead = api.getCosHealth().catch(() => null).then((data) => {+ // Health is independently useful to the Health tab. Commit it as soon+ // as its own read settles instead of making that tab wait for the slower+ // actionable-insights request in the same batch.+ applyHealth(data, { merge: true });+ return data;+ });const secondaryRead = Promise.all([- api.getCosHealth().catch(() => null),+ healthRead,api.getProviders().catch(() => ({ providers: [] })),api.getApps().catch(() => []),api.getCosLearningSummary().catch(() => null),@@ -215,7 +224,7 @@ export default function ChiefOfStaff() {const runningAgent = agentsData.find(a => a.status === 'running');setActiveAgentMeta(runningAgent?.metadata || null);- const [healthData, providersData, appsData, learningSummaryData, insightsData] = await secondaryRead;+ const [, providersData, appsData, learningSummaryData, insightsData] = await secondaryRead;// `getCosHealth` above reads the *pre-check* persisted health, while the// getCosActionableInsights call in this same batch triggers a fresh server// health check (cos.runHealthCheck) that emits `cos:health:check` — the@@ -223,7 +232,7 @@ export default function ChiefOfStaff() {// keeps whichever check is newer (and keeps the last-good one when this read// failed); everything below derives from what it returned, never from the// raw read, so the bubble can't name an older issue than the tile shows.- const mergedHealth = applyHealth(healthData, { merge: true });+ const mergedHealth = healthRef.current;setProviders(providersData.providers || []);setActiveProviderId(providersData.activeProvider || null);// Filter out PortOS Autofixer (it's part of PortOS project)@@ -1150,7 +1159,7 @@ export default function ChiefOfStaff() {{activeTab === 'health' && (<div role="tabpanel" id="tabpanel-health" aria-labelledby="tab-health"><Suspense fallback={<TabLoadFallback label="health" />}>- <HealthTab health={health} onCheck={handleHealthCheck} />+ <HealthTab health={health} healthLoading={!healthLoaded} onCheck={handleHealthCheck} /></Suspense></div>)}diff --git a/client/src/pages/ChiefOfStaff.test.jsx b/client/src/pages/ChiefOfStaff.test.jsxindex 42cd77a2c6..01e47e4f38 100644--- a/client/src/pages/ChiefOfStaff.test.jsx+++ b/client/src/pages/ChiefOfStaff.test.jsx@@ -410,6 +410,20 @@ describe('ChiefOfStaff insight freshness (#2654)', () => {expect(api.getCosActionableInsights.mock.calls.length).toBe(before);});+ it('keeps the Health tab pending until its own read settles', async () => {+ let releaseHealth;+ api.getCosHealth.mockReturnValue(new Promise((resolve) => { releaseHealth = resolve; }));+ renderAt('health');++ expect(await screen.findByText('Loading health...')).toBeInTheDocument();+ expect(screen.queryByText('All Systems Healthy')).not.toBeInTheDocument();++ await act(async () => {+ releaseHealth({ lastCheck: '2026-01-01T00:00:01Z', issues: [] });+ });+ expect(await screen.findByText('All Systems Healthy')).toBeInTheDocument();+ });+it('does not let a stale fetchData health read clobber a fresher one', async () => {// The insights call inside fetchData triggers a fresh server health check// whose socket emit can update `health` before fetchData's own getCosHealthdiff --git a/client/src/pages/Dashboard.jsx b/client/src/pages/Dashboard.jsxindex 6d0f721130..d30e17e914 100644--- a/client/src/pages/Dashboard.jsx+++ b/client/src/pages/Dashboard.jsx@@ -16,7 +16,10 @@ import toast from '../components/ui/Toast';import { pickActiveLayoutId, recordManualLayoutPick } from '../utils/timeWindow.js';export default function Dashboard() {- const [apps, setApps] = useState([]);+ // null means the first apps read has not completed. Keep that distinct from+ // a successful empty response so the Apps tile cannot flash its empty-state+ // CTA while an existing installation is still being read.+ const [apps, setApps] = useState(null);const [health, setHealth] = useState(null);const [usage, setUsage] = useState(null);const [tribeCare, setTribeCare] = useState(null);@@ -106,29 +109,22 @@ export default function Dashboard() {// Apps and the remaining widgets are independent hydration streams. Health// and daily-actions in particular can involve slow subsystem/database work// that should not hold every widget behind one Promise.all barrier.- const appsRead = api.getApps().catch((err) => { setDataError(err.message); return []; });+ const appsRead = api.getApps().catch((err) => { setDataError(err.message); return null; });const secondaryRead = Promise.all([refreshHealth(),- api.getUsage().catch(() => null),- api.getTribeCareSummary({ silent: true }).catch(() => null),- api.getFeedStats({ silent: true }).catch(() => null),- api.getMeatspaceLoggingStats({ silent: true }).catch(() => null),+ api.getUsage().catch(() => null).then(setUsage),+ api.getTribeCareSummary({ silent: true }).catch(() => null).then(setTribeCare),+ api.getFeedStats({ silent: true }).catch(() => null).then(setFeeds),+ api.getMeatspaceLoggingStats({ silent: true }).catch(() => null).then(setMeatspaceLogging),// GET records the first-visit-of-day signal (issue #2666); a failure just// hides the Daily Driver card via its gate. No LLM calls here.- api.getDailyDriverState().catch(() => null),- api.getDailyActions({ silent: true }).catch(() => null),+ api.getDailyDriverState().catch(() => null).then(setDailyDriver),+ api.getDailyActions({ silent: true }).catch(() => null).then(setDailyActions),refreshInstanceFeatures(),]);const appsData = await appsRead;- setApps(appsData);-- const [, usageData, tribeCareData, feedsData, meatspaceLoggingData, dailyDriverData, dailyActionsData] = await secondaryRead;- setUsage(usageData);- setTribeCare(tribeCareData);- setFeeds(feedsData);- setMeatspaceLogging(meatspaceLoggingData);- setDailyDriver(dailyDriverData);- setDailyActions(dailyActionsData);+ if (Array.isArray(appsData)) setApps(appsData);+ await secondaryRead;}, [refreshHealth, refreshInstanceFeatures]);useEffect(() => {@@ -221,16 +217,18 @@ export default function Dashboard() {};}, []);+ const appList = useMemo(() => (Array.isArray(apps) ? apps : []), [apps]);+ const appsLoading = !Array.isArray(apps);const sortedApps = useMemo(() =>- [...apps].sort((a, b) => {+ [...appList].sort((a, b) => {const archiveDiff = (a.archived ? 1 : 0) - (b.archived ? 1 : 0);if (archiveDiff !== 0) return archiveDiff;return a.name.localeCompare(b.name);}),- [apps]+ [appList]);- const activeApps = useMemo(() => apps.filter((a) => !a.archived), [apps]);+ const activeApps = useMemo(() => appList.filter((a) => !a.archived), [appList]);const appStats = useMemo(() => ({total: activeApps.length,online: activeApps.filter((a) => a.overallStatus === 'online').length,@@ -242,8 +240,8 @@ export default function Dashboard() {}), [activeApps]);const dashboardState = useMemo(- () => ({ apps, sortedApps, activeApps, appStats, health, usage, tribeCare, feeds, meatspaceLogging, dailyDriver, dailyActions, instanceFeatures, refetch: fetchData, refetchHealth: refreshHealth }),- [apps, sortedApps, activeApps, appStats, health, usage, tribeCare, feeds, meatspaceLogging, dailyDriver, dailyActions, instanceFeatures, fetchData, refreshHealth]+ () => ({ apps: appList, appsLoading, sortedApps, activeApps, appStats, health, usage, tribeCare, feeds, meatspaceLogging, dailyDriver, dailyActions, instanceFeatures, refetch: fetchData, refetchHealth: refreshHealth }),+ [appList, appsLoading, sortedApps, activeApps, appStats, health, usage, tribeCare, feeds, meatspaceLogging, dailyDriver, dailyActions, instanceFeatures, fetchData, refreshHealth]);// Falls back to a local minimal layout only AFTER the initial fetch has