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: open selected runs from while-away activity (#9762)

Adam Eivyd10c21fe1f68
diff --git a/client/src/components/WhileAwayWidget.jsx b/client/src/components/WhileAwayWidget.jsx
index c2d407a655..a7e49cdb66 100644
--- a/client/src/components/WhileAwayWidget.jsx
+++ b/client/src/components/WhileAwayWidget.jsx
@@ -45,7 +45,7 @@ function ActivityRow({ item, kind }) {
const tone = kind === 'incident' ? 'text-port-error' : 'text-port-success';
return (
<Link
- to="/cos/agents"
+ to={`/cos/agents/${encodeURIComponent(item.id)}`}
className="flex items-start gap-2.5 p-2 rounded-lg border border-port-border bg-port-bg/40 hover:border-port-accent/40 transition-colors group"
>
<Icon size={14} className={`mt-0.5 shrink-0 ${tone}`} />
diff --git a/client/src/components/WhileAwayWidget.test.jsx b/client/src/components/WhileAwayWidget.test.jsx
new file mode 100644
index 0000000000..18b619414c
--- /dev/null
+++ b/client/src/components/WhileAwayWidget.test.jsx
@@ -0,0 +1,61 @@
+import { MemoryRouter, Route, Routes, useLocation } from 'react-router';
+import { fireEvent, render, screen } from '@testing-library/react';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+const { mockGetCosWhileAwayActivity, mockSocket } = vi.hoisted(() => ({
+ mockGetCosWhileAwayActivity: vi.fn(),
+ mockSocket: { on: vi.fn(), off: vi.fn() },
+}));
+
+vi.mock('../services/api', () => ({
+ getCosWhileAwayActivity: (...args) => mockGetCosWhileAwayActivity(...args),
+}));
+
+vi.mock('../services/socket', () => ({ default: mockSocket }));
+
+import WhileAwayWidget from './WhileAwayWidget.jsx';
+
+function CurrentPath() {
+ const { pathname } = useLocation();
+ return <output data-testid="current-path">{pathname}</output>;
+}
+
+const activity = {
+ stats: { completed: 3, succeeded: 2, failed: 1, successRate: 67 },
+ accomplishments: [
+ { id: 'run/one', description: 'First run', taskType: 'task', completedRelative: '1m ago' },
+ { id: 'run-two', description: 'Second run', taskType: 'task', completedRelative: '2m ago' },
+ ],
+ incidents: [
+ { id: 'incident-three', description: 'Third run', taskType: 'task', completedRelative: '3m ago' },
+ ],
+};
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ mockGetCosWhileAwayActivity.mockResolvedValue(activity);
+});
+
+describe('WhileAwayWidget run links', () => {
+ it('opens the exact run selected from either activity section', async () => {
+ render(
+ <MemoryRouter initialEntries={['/dashboard']}>
+ <Routes>
+ <Route path="/dashboard" element={<WhileAwayWidget />} />
+ <Route path="/cos/agents/:agentId" element={<CurrentPath />} />
+ </Routes>
+ </MemoryRouter>,
+ );
+
+ const firstRun = await screen.findByRole('link', { name: /First run/ });
+ const secondRun = screen.getByRole('link', { name: /Second run/ });
+ const incidentRun = screen.getByRole('link', { name: /Third run/ });
+
+ expect(firstRun).toHaveAttribute('href', '/cos/agents/run%2Fone');
+ expect(secondRun).toHaveAttribute('href', '/cos/agents/run-two');
+ expect(incidentRun).toHaveAttribute('href', '/cos/agents/incident-three');
+
+ fireEvent.click(firstRun);
+ expect(await screen.findByTestId('current-path')).toHaveTextContent('/cos/agents/run%2Fone');
+ });
+});