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([issue-1969]): keep Local tab mounted so a tab switch can't cancel a pip install

[._.]/ Adam Eivy95f320c4a617
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 3c0d98a358..d4b633556c 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -10,7 +10,7 @@
## Media Generation
-- **[issue-1969] Media Generation Settings is now grouped into tabs.** The image/video backend settings surface — one long flat scroll rendered by the Image Gen, Video Gen, and Storyboard settings drawers — now groups its fields into a pills sub-navigation (Backend / External / Local / Codex CLI / Tokens / Expose / Test) that collapses to a `<select>` on mobile, so no single section is page-length. The grouping is internal to `ImageGenTab` (built on the shared `TabPills`), so it renders identically in every host drawer with no tabs-within-tabs; the active sub-tab deep-links via a `?mediaTab=` search param (`useDrawerTab`) so an open section is shareable and reload-safe. The Save + Test Connection bar stays pinned below the tabs on every section. All existing controls, save/test behavior, and label wiring are unchanged. (`client/src/components/settings/ImageGenTab.jsx`, Closes #1969)
+- **[issue-1969] Media Generation Settings is now grouped into tabs.** The image/video backend settings surface — one long flat scroll rendered by the Image Gen, Video Gen, and Storyboard settings drawers — now groups its fields into a pills sub-navigation (Backend / External / Local / Codex CLI / Tokens / Expose / Test) that collapses to a `<select>` on mobile, so no single section is page-length. The grouping is internal to `ImageGenTab` (built on the shared `TabPills`), so it renders identically in every host drawer with no tabs-within-tabs; the active sub-tab deep-links via a `?mediaTab=` search param (`useDrawerTab`) so an open section is shareable and reload-safe. The Save + Test Connection bar stays pinned below the tabs on every section. All existing controls, save/test behavior, and label wiring are unchanged. The Local tab is kept mounted (hidden) once visited so switching tabs during a long-running pip install (e.g. a 10-minute torch upgrade) no longer tears down its stream and cancels the install. (`client/src/components/settings/ImageGenTab.jsx`, Closes #1969)
## Music Video
diff --git a/client/src/components/settings/ImageGenTab.jsx b/client/src/components/settings/ImageGenTab.jsx
index e262f32e01..090fd1a926 100644
--- a/client/src/components/settings/ImageGenTab.jsx
+++ b/client/src/components/settings/ImageGenTab.jsx
@@ -63,6 +63,18 @@ export function ImageGenTab() {
// stale/hand-edited value degrades to 'backend'.
const [mediaTab, setMediaTab] = useDrawerTab('mediaTab', 'backend', MEDIA_TAB_IDS);
+ // The Local tab hosts LocalSetupPanel, which owns a long-running pip-install
+ // EventSource (`useInstallStream`) — a torch upgrade can run 10+ minutes.
+ // The other tabs unmount when inactive, but unmounting the installer mid-run
+ // closes its stream and the server treats `req.close` as cancellation,
+ // killing pip. So the Local tab is lazily mounted on first visit (to avoid a
+ // cold python-env probe before the user ever opens it) and then kept mounted,
+ // hidden via CSS when inactive, so a tab switch never aborts an install.
+ const [localMounted, setLocalMounted] = useState(false);
+ useEffect(() => {
+ if (mediaTab === 'local') setLocalMounted(true);
+ }, [mediaTab]);
+
// Mode + per-mode config
const [mode, setMode] = useState(IMAGE_GEN_MODE.EXTERNAL);
const [sdapiUrl, setSdapiUrl] = useState('');
@@ -479,8 +491,8 @@ export function ImageGenTab() {
</div>
)}
- {mediaTab === 'local' && (
- <div className="bg-port-card border border-port-border rounded-xl p-6 space-y-4">
+ {localMounted && (
+ <div className={`bg-port-card border border-port-border rounded-xl p-6 space-y-4 ${mediaTab === 'local' ? '' : 'hidden'}`}>
<h3 className="text-sm font-medium text-gray-300">Local Python (mflux + mlx_video)</h3>
<p className="text-xs text-gray-500">
Pick a Python 3.10+ interpreter — PortOS auto-detects venvs and conda installs and can install
diff --git a/client/src/components/settings/ImageGenTab.test.jsx b/client/src/components/settings/ImageGenTab.test.jsx
index 0e805de979..5163f62324 100644
--- a/client/src/components/settings/ImageGenTab.test.jsx
+++ b/client/src/components/settings/ImageGenTab.test.jsx
@@ -92,6 +92,19 @@ describe('ImageGenTab grouped tabs', () => {
expect(screen.getByTestId('local-setup-panel')).toBeTruthy();
});
+ it('keeps LocalSetupPanel mounted (hidden) after leaving the Local tab so an in-flight install stream is not torn down', async () => {
+ await renderTab();
+ // Not mounted until first visited (avoids a cold python-env probe).
+ expect(screen.queryByTestId('local-setup-panel')).toBeNull();
+ fireEvent.click(screen.getByRole('tab', { name: /^Local/i }));
+ const panel = screen.getByTestId('local-setup-panel');
+ // Switch away — the panel must stay in the DOM (its install EventSource
+ // survives), just visually hidden, rather than unmounting.
+ fireEvent.click(screen.getByRole('tab', { name: /Backend/i }));
+ expect(screen.getByTestId('local-setup-panel')).toBe(panel);
+ expect(panel.closest('div.hidden')).not.toBeNull();
+ });
+
it('deep-links the active sub-tab from the mediaTab search param', async () => {
await renderTab(['/media/image?mediaTab=tokens']);
// The Tokens group renders immediately without a click.