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: preserve ingest progress announcements (#5131)
[._.]/ Adam Eivy5b4d8bec37be
diff --git a/client/src/components/QuickBrainCapture.jsx b/client/src/components/QuickBrainCapture.jsxindex 8220b5d7ca..a70397fbe6 100644--- a/client/src/components/QuickBrainCapture.jsx+++ b/client/src/components/QuickBrainCapture.jsx@@ -8,6 +8,7 @@ import { parseBareUrl } from '../lib/bareUrl';import { readClipboard } from '../lib/clipboard';import { INGEST_OPTIONS, defaultIngestOptions, ingestOptionsFromSettings, isYoutubeVideoUrl } from '../lib/youtubeUrl';import RepoIntakeOptions from './brain/RepoIntakeOptions';+import ProgressBar from './ui/ProgressBar';import ToggleChip from './ui/ToggleChip';export default function QuickBrainCapture() {@@ -267,16 +268,11 @@ export default function QuickBrainCapture() {<div className="mt-3 flex items-center gap-2 text-xs text-gray-400"><Film size={14} className="text-red-400 shrink-0" /><span aria-live="polite" className="capitalize">{ingest.stage || 'starting'}…</span>- <div- role="progressbar"- aria-label="YouTube video ingest progress"- aria-valuenow={Math.round(ingest.percent)}- aria-valuemin={0}- aria-valuemax={100}- className="flex-1 h-1.5 bg-port-bg rounded-full overflow-hidden"- >- <div className="h-full bg-port-accent transition-all" style={{ width: `${ingest.percent}%` }} />- </div>+ <ProgressBar+ percent={ingest.percent}+ label="YouTube video ingest progress"+ className="flex-1"+ /><buttontype="button"onClick={ingest.cancel}diff --git a/client/src/components/QuickBrainCapture.test.jsx b/client/src/components/QuickBrainCapture.test.jsxindex d53170bcff..7da5760698 100644--- a/client/src/components/QuickBrainCapture.test.jsx+++ b/client/src/components/QuickBrainCapture.test.jsx@@ -1,5 +1,5 @@import { describe, it, expect, vi, beforeEach } from 'vitest';-import { render, screen, fireEvent, waitFor } from '@testing-library/react';+import { render, screen, fireEvent, waitFor, act } from '@testing-library/react';import { MemoryRouter } from 'react-router';vi.mock('../services/api', () => ({@@ -27,7 +27,13 @@ vi.mock('./ui/Toast', () => ({// under test without inventing a fake transport — no test here drives frames.class StubEventSource {static CLOSED = 2;- constructor(url) { this.url = url; this.readyState = 0; }+ static instances = [];+ constructor(url) {+ this.url = url;+ this.readyState = 0;+ StubEventSource.instances.push(this);+ }+ emit(frame) { this.onmessage?.({ data: JSON.stringify(frame) }); }close() { this.readyState = StubEventSource.CLOSED; }}globalThis.EventSource = StubEventSource;@@ -59,6 +65,7 @@ const openAdvanced = async () => {describe('QuickBrainCapture', () => {beforeEach(() => {vi.clearAllMocks();+ StubEventSource.instances = [];localStorage.clear();captureBrainThought.mockResolvedValue({ message: 'Saved to Links!' });getYoutubeIngestSettings.mockResolvedValue({@@ -356,6 +363,15 @@ describe('QuickBrainCapture', () => {expect(progress).toHaveAttribute('aria-valuemin', '0');expect(progress).toHaveAttribute('aria-valuemax', '100');expect(screen.getByText('starting…')).toHaveAttribute('aria-live', 'polite');++ await waitFor(() => expect(StubEventSource.instances).toHaveLength(1));+ act(() => StubEventSource.instances[0].emit({ type: 'progress', stage: 'video', percent: 47.6 }));+ await waitFor(() => expect(progress).toHaveAttribute('aria-valuenow', '48'));+ expect(screen.getByText('video…')).toHaveAttribute('aria-live', 'polite');++ act(() => StubEventSource.instances[0].emit({ type: 'metadata', title: 'Example Video' }));+ await waitFor(() => expect(progress).toHaveAttribute('aria-valuenow', '48'));+ expect(screen.getByText('video…')).toBeInTheDocument();});it('does not fetch ingest settings until a YouTube URL is typed', () => {diff --git a/client/src/hooks/useSseJobSlot.js b/client/src/hooks/useSseJobSlot.jsindex 4e66f9781e..241072e5e1 100644--- a/client/src/hooks/useSseJobSlot.js+++ b/client/src/hooks/useSseJobSlot.js@@ -56,10 +56,20 @@ export default function useSseJobSlot({} = {}) {const [job, setJob] = useState(null); // { jobId, context }const [pending, setPending] = useState(false);+ const [progress, setProgress] = useState({ percent: 0, stage: null });const sse = useSseProgress(job ? eventsUrl(job.jobId) : null);const latest = sse.latest;- const percent = Math.round(latest?.percent ?? 0);- const stage = latest?.stage ?? null;++ // Metadata and warning frames intentionally omit progress fields. Preserve the+ // last announced values across those sparse frames instead of flashing 0% /+ // "starting" between real progress updates.+ useEffect(() => {+ if (!job || !latest) return;+ setProgress((prev) => ({+ percent: Number.isFinite(latest.percent) ? Math.round(latest.percent) : prev.percent,+ stage: typeof latest.stage === 'string' && latest.stage ? latest.stage : prev.stage,+ }));+ }, [latest, job]);useEffect(() => {if (!job || !latest) return;@@ -91,6 +101,7 @@ export default function useSseJobSlot({const arg = trimStartArg ? (startArg ?? '').trim() : startArg;if (trimStartArg && !arg) return;if (job || pending) return;+ setProgress({ percent: 0, stage: null });setPending(true);startRequest(arg).then(({ jobId }) => {@@ -111,8 +122,8 @@ export default function useSseJobSlot({return {active: pending || !!job,- percent,- stage,+ percent: progress.percent,+ stage: progress.stage,context: job?.context ?? null,start,cancel,