From 670c38ab8cca39dad4bddb0e46fba2f495043f8b Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Wed, 26 Nov 2025 18:53:53 +0100 Subject: [PATCH] Remove legacy host auto-connect state --- packages/app/src/app/settings.tsx | 1 - .../components/multi-daemon-session-host.tsx | 39 ++----------------- .../src/contexts/daemon-registry-context.tsx | 4 -- packages/app/src/hooks/use-daemon-session.ts | 2 +- plan.md | 4 +- 5 files changed, 7 insertions(+), 43 deletions(-) diff --git a/packages/app/src/app/settings.tsx b/packages/app/src/app/settings.tsx index b7ca17f2b..d66c6a514 100644 --- a/packages/app/src/app/settings.tsx +++ b/packages/app/src/app/settings.tsx @@ -648,7 +648,6 @@ export default function SettingsScreen() { const created = await addDaemon({ label: deriveDaemonLabel(trimmedUrl), wsUrl: trimmedUrl, - autoConnect: true, }); setSelectedDaemonId(created.id); } diff --git a/packages/app/src/components/multi-daemon-session-host.tsx b/packages/app/src/components/multi-daemon-session-host.tsx index 61c8047ab..7f07a5f33 100644 --- a/packages/app/src/components/multi-daemon-session-host.tsx +++ b/packages/app/src/components/multi-daemon-session-host.tsx @@ -1,48 +1,15 @@ -import { useEffect, useMemo, useRef } from "react"; import { SessionProvider } from "@/contexts/session-context"; -import { useDaemonRegistry, type DaemonProfile } from "@/contexts/daemon-registry-context"; +import { useDaemonRegistry } from "@/contexts/daemon-registry-context"; export function MultiDaemonSessionHost() { const { daemons } = useDaemonRegistry(); - const autoConnectStatesRef = useRef>(new Map()); - - useEffect(() => { - const trackedStates = autoConnectStatesRef.current; - const activeIds = new Set(); - - for (const daemon of daemons) { - activeIds.add(daemon.id); - const previousAutoConnect = trackedStates.get(daemon.id); - if (daemon.autoConnect === false && previousAutoConnect !== false) { - console.info("[DaemonConnection]", { - event: "auto_connect_skip", - daemonId: daemon.id, - label: daemon.label, - reason: "autoConnect disabled", - timestamp: new Date().toISOString(), - }); - } - trackedStates.set(daemon.id, daemon.autoConnect); - } - - for (const daemonId of Array.from(trackedStates.keys())) { - if (!activeIds.has(daemonId)) { - trackedStates.delete(daemonId); - } - } - }, [daemons]); - - const connectedDaemons = useMemo(() => { - return daemons.filter((daemon) => daemon.autoConnect !== false); - }, [daemons]); - - if (connectedDaemons.length === 0) { + if (daemons.length === 0) { return null; } return ( <> - {connectedDaemons.map((daemon) => ( + {daemons.map((daemon) => ( {null} diff --git a/packages/app/src/contexts/daemon-registry-context.tsx b/packages/app/src/contexts/daemon-registry-context.tsx index db1e156b0..b7ef60d38 100644 --- a/packages/app/src/contexts/daemon-registry-context.tsx +++ b/packages/app/src/contexts/daemon-registry-context.tsx @@ -13,7 +13,6 @@ export type DaemonProfile = { label: string; wsUrl: string; restUrl?: string | null; - autoConnect: boolean; createdAt: string; updatedAt: string; metadata?: Record | null; @@ -23,7 +22,6 @@ type CreateDaemonInput = { label: string; wsUrl: string; restUrl?: string | null; - autoConnect?: boolean; }; type UpdateDaemonInput = Partial>; @@ -76,7 +74,6 @@ export function DaemonRegistryProvider({ children }: { children: ReactNode }) { label: input.label.trim() || deriveLabelFromUrl(input.wsUrl), wsUrl: input.wsUrl, restUrl: input.restUrl ?? null, - autoConnect: input.autoConnect ?? true, createdAt: timestamp, updatedAt: timestamp, metadata: null, @@ -143,7 +140,6 @@ function createProfile(label: string, wsUrl: string): DaemonProfile { label, wsUrl, restUrl: null, - autoConnect: true, createdAt: timestamp, updatedAt: timestamp, metadata: null, diff --git a/packages/app/src/hooks/use-daemon-session.ts b/packages/app/src/hooks/use-daemon-session.ts index 7522989a3..314f28555 100644 --- a/packages/app/src/hooks/use-daemon-session.ts +++ b/packages/app/src/hooks/use-daemon-session.ts @@ -57,7 +57,7 @@ export function useDaemonSession(serverId?: string | null, options?: UseDaemonSe const label = connection?.daemon.label ?? serverId; const status = connection?.status ?? "unknown"; const lastError = connection?.lastError ? `\n${connection.lastError}` : ""; - const message = `${label} isn't connected yet (${status}). Switch to it or enable auto-connect so Paseo can reach it.${lastError}`; + const message = `${label} isn't connected yet (${status}). Switch to it and wait for Paseo to reconnect automatically.${lastError}`; if (!suppressUnavailableAlert && !alertedDaemonsRef.current.has(serverId)) { alertedDaemonsRef.current.add(serverId); diff --git a/plan.md b/plan.md index 144089a83..8ae3dee8d 100644 --- a/plan.md +++ b/plan.md @@ -21,6 +21,7 @@ The multi-daemon infrastructure is in place: session directory with daemon-scope - Context: Remaining "daemon" labels in git diff, file explorer, and agent detail screens now say "host" (updated `packages/app/src/app/git-diff.tsx`, `file-explorer.tsx`, `agent/[id].tsx`, and `agent/[serverId]/[agentId].tsx`). - Review: Confirmed the agent redirect, file explorer, and git diff screens reflect the updated host wording with no lingering user-facing "daemon" strings. - Review follow-up: Git Diff screen still showed the selected host as "Server"; updated the meta labels to "Host" to keep UI text consistent (`packages/app/src/app/git-diff.tsx`). + - Review follow-up (current): Found that the Git Diff header still surfaced the internal host ID instead of the friendly label; updated `GitDiffContent` to accept the computed `serverLabel` and verified via `npm run typecheck --workspace=@paseo/app`. ### 2. Remove Active/Primary/Auto-Connect Concepts - [x] Remove the concept of "active daemon" from the UI and simplify to just "hosts". @@ -30,7 +31,8 @@ The multi-daemon infrastructure is in place: session directory with daemon-scope - Eliminated the persisted `activeDaemonId`, flattened the session directory, and refactored `_layout`, realtime, settings, and agent UI to always resolve hosts explicitly so every host gets its own `SessionProvider`; verified via `npm run typecheck --workspace=@paseo/app`. - [x] Remove the "auto-connect" toggle from host settings—hosts always auto-connect when added. - Removed the toggle from the host form so entries always auto-connect and verified with `npm run typecheck --workspace=@paseo/app`. -- [ ] Clean up any related state/UI that exposes these concepts to users. +- [x] Clean up any related state/UI that exposes these concepts to users. + - Removed the legacy autoConnect state from daemon profiles and session hosts so every host hydrates automatically, refreshed the host-unavailable messaging/docs, and verified via `npm run typecheck --workspace=@paseo/app`. ### Review: No Silent Defaults - [ ] Review the changes to ensure we didn't just replace "active daemon" with "first host" (e.g., `hosts[0]}`. The goal is explicit user choice, not a hidden default.