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: give Insights overview empty cards a real action instead of naming an absent Refresh button (#3787)

[._.]/ Adam Eivy89c55f408583
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 357713bd8f..219b663eec 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -60,3 +60,5 @@
- **Stopping an autonomous run no longer reports it as a crash and files a bug for it.** Cancelling a Series Autopilot run — or stopping the LLM call it is sitting on from the Runs page, or restarting PortOS mid-run — kills the provider process, which the run then met as `TUI canceled (signal 15)` on its way out. The two lower layers already knew that signal was a deliberate stop rather than a provider fault (they neither bench the provider nor scan the story text for a bogus quota marker), but the autopilot itself only recognized a cancellation that arrived between steps. One that interrupted a step landed in the run's failure handler instead: the series was left in `error` rather than the resumable `paused`, a self-improvement post-mortem spent a long call diagnosing an automation defect that did not exist, and a CoS task was filed reading "The autonomous run failed and stopped" — a bug report about you pressing Stop. An interrupted step now ends the run the same way the between-steps cancel does, with the reason recorded on the series so Resume picks it back up. The foundation gate's two repair paths get the same treatment: they used to pause on "switch the repair provider/model first" for a repair the user themselves stopped, and the optional teaser step used to file a "retry this deliverable" task. Genuine step failures are unchanged — still `error`, still diagnosed, still filed. While fixing this, the pause and error terminals also moved their task filing to before the terminal status frame: the filing emits its own progress frame, and a client that opened the series after the run ended replayed that one and never learned the run had stopped.
- **A CoS runner that is briefly unreachable no longer blocks the task for a human.** When an agent's TUI session spawns through the durable cos-runner and the spawn HTTP call fails — a bare `fetch failed` while PM2 restarts the runner, or the runner answering with a refusal — the failure finalized as the actionable `spawn-error`: the task was blocked immediately awaiting human approval, an "[Auto] Investigate agent failure" task was filed, and the escalation advice said to confirm the provider CLI is installed — none of which is true of a runner that was down for a moment. It was the most frequent failure class in the week's digest, five times over, each one parking work a plain retry fixes. The direct-CLI runner path drew this exact distinction long ago (`spawn-rejected` — non-actionable, retry, block only after the retry budget with the runner's own message attached); the TUI runner path now mirrors it. A local PTY that genuinely cannot open keeps the actionable `spawn-error`, because that is a real host problem a retry cannot repair.
+
+- **Insights overview cards now carry the step they describe instead of naming a control that isn't on the screen.** The Overview tab's three cards were all prose: the Cross-Domain card said "Click Refresh to analyze patterns across all your data" on a screen whose only controls were the tabs themselves, and the Genome and Taste cards described a prerequisite ("Complete taste profile") without offering it anywhere. Each empty card now ends in a button that does the thing — Upload genome (to the genome screen), Complete taste profile (deep-linked to the Digital Twin taste tab) or Generate themes when the profile is already done, and Analyze now, which generates the cross-domain narrative in place and swaps the card over to its first line. The empty copy states what the user gets rather than which button to hunt for, and the tab's own empty state dropped its "Click Refresh" phrasing for the same reason.
diff --git a/client/src/components/insights/CrossDomainTab.jsx b/client/src/components/insights/CrossDomainTab.jsx
index b1dc45a786..63075e7c98 100644
--- a/client/src/components/insights/CrossDomainTab.jsx
+++ b/client/src/components/insights/CrossDomainTab.jsx
@@ -46,7 +46,7 @@ export default function CrossDomainTab() {
No cross-domain narrative generated yet.
</p>
<p className="text-gray-500 text-xs max-w-sm mb-6">
- Click Refresh to analyze patterns across all your data — genome health correlations, taste identity themes, and biometric trends — and synthesize a unified personal narrative.
+ Generating one reads across all your data — genome health correlations, taste identity themes, and biometric trends — and synthesizes a unified personal narrative.
</p>
<button
onClick={handleRefresh}
diff --git a/client/src/pages/Insights.jsx b/client/src/pages/Insights.jsx
index 66dc8e5753..be594d023e 100644
--- a/client/src/pages/Insights.jsx
+++ b/client/src/pages/Insights.jsx
@@ -5,8 +5,11 @@ import { Dna, Palette, Link2, Lightbulb, ArrowRight, Target } from 'lucide-react
import {
getGenomeHealthCorrelations,
getInsightThemes,
- getInsightNarrative
+ getInsightNarrative,
+ refreshInsightThemes,
+ refreshInsightNarrative
} from '../services/api';
+import { useAsyncAction } from '../hooks/useAsyncAction';
import GenomeHealthTab from '../components/insights/GenomeHealthTab';
import TasteIdentityTab from '../components/insights/TasteIdentityTab';
import CrossDomainTab from '../components/insights/CrossDomainTab';
@@ -36,13 +39,24 @@ function SummaryCardSkeleton() {
);
}
-function OverviewTab() {
+export function OverviewTab() {
const navigate = useNavigate();
const [loading, setLoading] = useState(true);
const [genomeData, setGenomeData] = useState(null);
const [themesData, setThemesData] = useState(null);
const [narrativeData, setNarrativeData] = useState(null);
+ // Empty cards carry the action that produces their content, so the user never
+ // has to go hunting for a control the copy names (#3787).
+ const [generateThemes, generatingThemes] = useAsyncAction(
+ () => refreshInsightThemes(undefined, undefined, { silent: true }).then(setThemesData),
+ { errorMessage: 'Failed to generate identity themes' }
+ );
+ const [analyzePatterns, analyzing] = useAsyncAction(
+ () => refreshInsightNarrative(undefined, undefined, { silent: true }).then(setNarrativeData),
+ { errorMessage: 'Failed to analyze cross-domain patterns' }
+ );
+
useEffect(() => {
Promise.allSettled([
getGenomeHealthCorrelations(),
@@ -77,6 +91,9 @@ function OverviewTab() {
// Taste-Identity card data
const themesAvailable = themesData?.available;
const firstTheme = themesAvailable ? themesData.themes?.[0] : null;
+ // A missing taste profile is a prerequisite the user fills elsewhere; anything
+ // else just means themes haven't been generated from it yet.
+ const needsTasteProfile = !themesAvailable && themesData?.reason === 'no_taste_data';
// Cross-Domain card data
const narrativeAvailable = narrativeData?.available;
@@ -97,11 +114,14 @@ function OverviewTab() {
? topMarker.name ?? topMarker.rsid
: genomeAvailable
? 'All markers reviewed'
- : 'No genome data uploaded',
+ : 'Upload a raw genome file to see which of your markers line up with your blood work.',
badge: topMarker
? <ConfidenceBadge level={topMarker.confidence?.level ?? 'unknown'} label={topMarker.confidence?.label} />
: null,
- sources: genomeData?.sources ?? []
+ sources: genomeData?.sources ?? [],
+ action: genomeAvailable
+ ? null
+ : { label: 'Upload genome', onClick: () => navigate('/meatspace/genome') }
},
{
tabId: 'taste-identity',
@@ -115,11 +135,22 @@ function OverviewTab() {
? firstTheme.title
: themesAvailable
? 'Themes loaded'
- : 'Complete taste profile to begin',
+ : needsTasteProfile
+ ? 'Answer the taste questionnaire to surface the patterns connecting your aesthetics, media, food, and values.'
+ : 'Turn your taste profile into named identity themes you can read across domains.',
badge: firstTheme
? <ConfidenceBadge level={firstTheme.strength === 'tentative' ? 'weak' : firstTheme.strength ?? 'unknown'} label={firstTheme.strength} />
: null,
- sources: []
+ sources: [],
+ action: themesAvailable
+ ? null
+ : needsTasteProfile
+ ? { label: 'Complete taste profile', onClick: () => navigate('/digital-twin/taste') }
+ : {
+ label: generatingThemes ? 'Generating…' : 'Generate themes',
+ onClick: generateThemes,
+ disabled: generatingThemes
+ }
},
{
tabId: 'cross-domain',
@@ -131,9 +162,16 @@ function OverviewTab() {
: 'Not yet generated',
topInsight: firstSentence
? `${firstSentence}.`
- : 'Click Refresh to analyze patterns across all your data',
+ : 'Synthesize your genome, health, and taste data into one connected narrative.',
badge: null,
- sources: []
+ sources: [],
+ action: narrativeAvailable
+ ? null
+ : {
+ label: analyzing ? 'Analyzing…' : 'Analyze now',
+ onClick: analyzePatterns,
+ disabled: analyzing
+ }
}
];
@@ -144,25 +182,32 @@ function OverviewTab() {
</p>
<div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
- {cards.map(({ tabId, label, icon: Icon, iconColor, stat, topInsight, badge, sources }) => (
- <button
+ {cards.map(({ tabId, label, icon: Icon, iconColor, stat, topInsight, badge, sources, action }) => (
+ <div
key={tabId}
- onClick={() => navigate(`/insights/${tabId}`)}
- className="text-left bg-port-card border border-port-border rounded-lg p-6 hover:border-port-accent/50 hover:bg-port-card/80 transition-all group"
+ className="flex flex-col bg-port-card border border-port-border rounded-lg p-6 hover:border-port-accent/50 transition-all group"
>
- <div className="flex items-center justify-between mb-4">
- <div className="flex items-center gap-2">
- <Icon size={20} className={iconColor} />
- <span className="text-sm font-semibold text-white">{label}</span>
+ {/* The summary is the drill-in target; the action below it is a
+ separate control, so neither is nested inside the other. */}
+ <button
+ type="button"
+ onClick={() => navigate(`/insights/${tabId}`)}
+ className="text-left flex-1"
+ >
+ <div className="flex items-center justify-between mb-4">
+ <div className="flex items-center gap-2">
+ <Icon size={20} className={iconColor} />
+ <span className="text-sm font-semibold text-white">{label}</span>
+ </div>
+ <ArrowRight size={16} className="text-gray-600 group-hover:text-port-accent transition-colors" />
</div>
- <ArrowRight size={16} className="text-gray-600 group-hover:text-port-accent transition-colors" />
- </div>
- <div className="text-xl font-bold text-white mb-1">{stat}</div>
+ <div className="text-xl font-bold text-white mb-1">{stat}</div>
- <p className="text-xs text-gray-400 leading-relaxed mb-3 line-clamp-2">{topInsight}</p>
+ <p className="text-xs text-gray-400 leading-relaxed line-clamp-2">{topInsight}</p>
+ </button>
- <div className="flex items-center justify-between">
+ <div className="flex items-center justify-between mt-3">
{badge ?? <span />}
{sources.length > 0 && (
<div className="flex gap-1">
@@ -172,7 +217,18 @@ function OverviewTab() {
</div>
)}
</div>
- </button>
+
+ {action && (
+ <button
+ type="button"
+ onClick={action.onClick}
+ disabled={action.disabled}
+ className="mt-3 w-full px-3 py-2 rounded-lg text-sm font-medium bg-port-accent/10 text-port-accent hover:bg-port-accent/20 disabled:opacity-50 transition-colors"
+ >
+ {action.label}
+ </button>
+ )}
+ </div>
))}
</div>
</div>
diff --git a/client/src/pages/Insights.test.jsx b/client/src/pages/Insights.test.jsx
new file mode 100644
index 0000000000..13a51f4529
--- /dev/null
+++ b/client/src/pages/Insights.test.jsx
@@ -0,0 +1,107 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, fireEvent, waitFor } from '@testing-library/react';
+import { MemoryRouter } from 'react-router';
+
+const navigateMock = vi.hoisted(() => vi.fn());
+vi.mock('react-router', async (importOriginal) => {
+ const actual = await importOriginal();
+ return { ...actual, useNavigate: () => navigateMock };
+});
+
+vi.mock('../services/api', () => ({
+ getGenomeHealthCorrelations: vi.fn(),
+ getInsightThemes: vi.fn(),
+ getInsightNarrative: vi.fn(),
+ refreshInsightThemes: vi.fn(),
+ refreshInsightNarrative: vi.fn(),
+}));
+
+vi.mock('../components/ui/Toast', () => ({
+ default: { success: vi.fn(), error: vi.fn(), info: vi.fn() },
+}));
+
+import {
+ getGenomeHealthCorrelations,
+ getInsightThemes,
+ getInsightNarrative,
+ refreshInsightThemes,
+ refreshInsightNarrative,
+} from '../services/api';
+import { OverviewTab } from './Insights';
+
+const renderOverview = () => render(
+ <MemoryRouter>
+ <OverviewTab />
+ </MemoryRouter>,
+);
+
+describe('Insights OverviewTab empty cards', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ getGenomeHealthCorrelations.mockResolvedValue({ available: false });
+ getInsightThemes.mockResolvedValue({ available: false, reason: 'no_taste_data' });
+ getInsightNarrative.mockResolvedValue({ available: false });
+ });
+
+ it('never tells the user to click a Refresh control that is not on this screen', async () => {
+ renderOverview();
+ await screen.findByText('Analyze now');
+ expect(screen.queryByText(/click refresh/i)).toBeNull();
+ });
+
+ it('routes the empty genome card to the genome upload screen', async () => {
+ renderOverview();
+ fireEvent.click(await screen.findByText('Upload genome'));
+ expect(navigateMock).toHaveBeenCalledWith('/meatspace/genome');
+ });
+
+ it('deep-links the taste card to the taste profile when the prerequisite is missing', async () => {
+ renderOverview();
+ fireEvent.click(await screen.findByText('Complete taste profile'));
+ expect(navigateMock).toHaveBeenCalledWith('/digital-twin/taste');
+ });
+
+ it('generates themes in place once a taste profile exists', async () => {
+ getInsightThemes.mockResolvedValue({ available: false, reason: 'not_generated' });
+ refreshInsightThemes.mockResolvedValue({
+ available: true,
+ themes: [{ title: 'Structured minimalism', strength: 'strong' }],
+ });
+
+ renderOverview();
+ fireEvent.click(await screen.findByText('Generate themes'));
+
+ await waitFor(() => expect(refreshInsightThemes).toHaveBeenCalled());
+ expect(await screen.findByText('Structured minimalism')).toBeTruthy();
+ expect(screen.queryByText('Generate themes')).toBeNull();
+ expect(navigateMock).not.toHaveBeenCalled();
+ });
+
+ it('analyzes cross-domain patterns from the card and shows the result', async () => {
+ refreshInsightNarrative.mockResolvedValue({
+ available: true,
+ text: 'Your sleep debt tracks your training load. It compounds weekly.',
+ generatedAt: new Date().toISOString(),
+ });
+
+ renderOverview();
+ fireEvent.click(await screen.findByText('Analyze now'));
+
+ await waitFor(() => expect(refreshInsightNarrative).toHaveBeenCalled());
+ expect(await screen.findByText('Your sleep debt tracks your training load.')).toBeTruthy();
+ expect(screen.queryByText('Analyze now')).toBeNull();
+ });
+
+ it('drops the action button once a card has content', async () => {
+ getGenomeHealthCorrelations.mockResolvedValue({
+ available: true,
+ totalMarkers: 12,
+ categories: [],
+ sources: [],
+ });
+
+ renderOverview();
+ expect(await screen.findByText('12 markers analyzed')).toBeTruthy();
+ expect(screen.queryByText('Upload genome')).toBeNull();
+ });
+});
diff --git a/client/src/services/apiSystem.js b/client/src/services/apiSystem.js
index 06638926ba..ad2a8470a1 100644
--- a/client/src/services/apiSystem.js
+++ b/client/src/services/apiSystem.js
@@ -341,14 +341,16 @@ export const createGitBackup = (repoPath) => request('/standardize/backup', {
// Insights
export const getInsightThemes = () => request('/insights/themes');
-export const refreshInsightThemes = (providerId, model) => request('/insights/themes/refresh', {
+export const refreshInsightThemes = (providerId, model, options = {}) => request('/insights/themes/refresh', {
method: 'POST',
- body: JSON.stringify({ providerId, model })
+ body: JSON.stringify({ providerId, model }),
+ ...options
});
export const getInsightNarrative = () => request('/insights/narrative');
-export const refreshInsightNarrative = (providerId, model) => request('/insights/narrative/refresh', {
+export const refreshInsightNarrative = (providerId, model, options = {}) => request('/insights/narrative/refresh', {
method: 'POST',
- body: JSON.stringify({ providerId, model })
+ body: JSON.stringify({ providerId, model }),
+ ...options
});
// Goal effectiveness scorecard (#2157)