From d78009f0e73bb330623760d9dc21bdb44b33dae9 Mon Sep 17 00:00:00 2001 From: Ilya Shcherbak Date: Tue, 17 Nov 2026 18:46:44 +0300 Subject: [PATCH 1/2] Keep agent selection during background update checks --- .../wizard-ui/src/agents/DesktopInstall.tsx | 6 +++++- .../src/onboarding/AgentSelection.tsx | 4 +--- .../wizard-ui/src/onboarding/InstallCard.tsx | 19 ++++++++++--------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/crates/wizard-gui/wizard-ui/src/agents/DesktopInstall.tsx b/crates/wizard-gui/wizard-ui/src/agents/DesktopInstall.tsx index c0fcfcc..57329c8 100644 --- a/crates/wizard-gui/wizard-ui/src/agents/DesktopInstall.tsx +++ b/crates/wizard-gui/wizard-ui/src/agents/DesktopInstall.tsx @@ -88,9 +88,13 @@ export function useDesktopInstall(desktop: DesktopApp) { }, [desktop]); const busy = state?.status === "checking" || state?.status === "downloading" || state?.status === "installing"; + // Checks also run in the background and do not mean the user chose this app. + const resumable = state?.status === "downloading" || state?.status === "installing" + || (state?.status === "failed" && state.operation !== "check") + || (state?.status === "available" && state.saved !== null); // Hidden until the state loads, so that an unsupported application never flashes. const hidden = state === undefined ? error === undefined : state.status === "unsupported"; - return { desktop, state, error, busy, hidden }; + return { desktop, state, error, busy, resumable, hidden }; } export function DesktopInstall({ observation, signedIn, disabled, installed }: { diff --git a/crates/wizard-gui/wizard-ui/src/onboarding/AgentSelection.tsx b/crates/wizard-gui/wizard-ui/src/onboarding/AgentSelection.tsx index 320fd42..b517561 100644 --- a/crates/wizard-gui/wizard-ui/src/onboarding/AgentSelection.tsx +++ b/crates/wizard-gui/wizard-ui/src/onboarding/AgentSelection.tsx @@ -25,9 +25,7 @@ export function AgentSelection({ mode, agents, signedIn, selected, onSelect, onC const claude = useDesktopInstall("claude"); const chatgpt = useDesktopInstall("chatgpt"); const [focusedDesktop, setFocusedDesktop] = useState(); - const resumedDesktop = [claude, chatgpt].find(({ state, busy }) => busy - || state?.status === "failed" - || (state?.status === "available" && state.saved))?.desktop; + const resumedDesktop = [claude, chatgpt].find(({ resumable }) => resumable)?.desktop; const activeDesktop = focusedDesktop ?? resumedDesktop; const activeInstaller = activeDesktop === "claude" ? claude : activeDesktop === "chatgpt" ? chatgpt : undefined; const confirming = activeInstaller?.state?.status === "ready_to_install"; diff --git a/crates/wizard-gui/wizard-ui/src/onboarding/InstallCard.tsx b/crates/wizard-gui/wizard-ui/src/onboarding/InstallCard.tsx index 9d27508..3d9578f 100644 --- a/crates/wizard-gui/wizard-ui/src/onboarding/InstallCard.tsx +++ b/crates/wizard-gui/wizard-ui/src/onboarding/InstallCard.tsx @@ -30,19 +30,18 @@ export function InstallCard({ choice, observation, signedIn, found, version, hid const [confirmed, setConfirmed] = useState(false); const [requesting, setRequesting] = useState(false); const attempted = useRef(undefined); - const restored = useRef(false); const inFlight = useRef(false); const lastProgress = useRef(0); const mounted = useRef(true); useEffect(() => { mounted.current = true; return () => { mounted.current = false; }; }, []); - // Reopening restores the operation without resuming an explicit pause. + // Restore real downloads, including partial files found by a background check. + // A check alone must never select an app or grant permission to download it. useEffect(() => { - if (!state || restored.current) return; - restored.current = true; - if (observation.busy || state.status === "failed") setStarted(true); - if (state.status === "available" && state.saved) { setStarted(true); setPaused(true); } - }, [state, observation.busy]); + if (started || !observation.resumable) return; + setStarted(true); + if (state?.status === "available" && state.saved) setPaused(true); + }, [state, started, observation.resumable]); async function request(command: string, args: Record = {}) { if (inFlight.current) return; @@ -60,7 +59,7 @@ export function InstallCard({ choice, observation, signedIn, found, version, hid } useEffect(() => { - if (!started || !state || paused || requesting || inFlight.current || error || observation.error) return; + if (hidden || !started || !state || paused || requesting || inFlight.current || error || observation.error) return; if ((state.status === "idle" || state.status === "available") && !signedIn) return; if (attempted.current === state.revision) return; attempted.current = state.revision; @@ -99,7 +98,7 @@ export function InstallCard({ choice, observation, signedIn, found, version, hid const saved = state?.status === "available" ? state.saved : null; const displayProgress = progress ?? (saved && saved.total > 0 ? Math.min(100, Math.floor(saved.received / saved.total * 100)) : undefined); useEffect(() => { if (displayProgress !== undefined) lastProgress.current = displayProgress; }, [displayProgress]); - const active = started || observation.busy; + const active = started || observation.resumable; const fill = !active ? 0 : completed || installing || state?.status === "ready_to_install" ? 100 : displayProgress ?? lastProgress.current; const unsupported = state?.status === "unsupported"; const networkBlocked = !signedIn || Boolean(observation.error); @@ -123,6 +122,8 @@ export function InstallCard({ choice, observation, signedIn, found, version, hid attempted.current = downloaded ? undefined : state?.revision; lastProgress.current = 0; if (downloaded) return; + // Adopt an in-flight background check instead of starting a duplicate operation. + if (state?.status === "checking") return; // An installed app follows the same entry point; the backend compares versions. void request("check_desktop_release"); } From 4bc5ea0f22900e1c00f52522447dcfb6f76bb2d5 Mon Sep 17 00:00:00 2001 From: Ilya Shcherbak Date: Tue, 17 Nov 2026 19:06:42 +0300 Subject: [PATCH 2/2] Bind onboarding downloads to explicit user actions --- .../wizard-ui/src/agents/DesktopInstall.tsx | 8 +- .../src/onboarding/AgentSelection.tsx | 5 +- .../wizard-ui/src/onboarding/InstallCard.tsx | 113 ++++++++++-------- 3 files changed, 71 insertions(+), 55 deletions(-) diff --git a/crates/wizard-gui/wizard-ui/src/agents/DesktopInstall.tsx b/crates/wizard-gui/wizard-ui/src/agents/DesktopInstall.tsx index 57329c8..84161ca 100644 --- a/crates/wizard-gui/wizard-ui/src/agents/DesktopInstall.tsx +++ b/crates/wizard-gui/wizard-ui/src/agents/DesktopInstall.tsx @@ -87,14 +87,12 @@ export function useDesktopInstall(desktop: DesktopApp) { return () => { stopped = true; }; }, [desktop]); - const busy = state?.status === "checking" || state?.status === "downloading" || state?.status === "installing"; // Checks also run in the background and do not mean the user chose this app. - const resumable = state?.status === "downloading" || state?.status === "installing" - || (state?.status === "failed" && state.operation !== "check") - || (state?.status === "available" && state.saved !== null); + const inProgress = state?.status === "downloading" || state?.status === "installing"; + const busy = state?.status === "checking" || inProgress; // Hidden until the state loads, so that an unsupported application never flashes. const hidden = state === undefined ? error === undefined : state.status === "unsupported"; - return { desktop, state, error, busy, resumable, hidden }; + return { desktop, state, error, busy, inProgress, hidden }; } export function DesktopInstall({ observation, signedIn, disabled, installed }: { diff --git a/crates/wizard-gui/wizard-ui/src/onboarding/AgentSelection.tsx b/crates/wizard-gui/wizard-ui/src/onboarding/AgentSelection.tsx index b517561..f317596 100644 --- a/crates/wizard-gui/wizard-ui/src/onboarding/AgentSelection.tsx +++ b/crates/wizard-gui/wizard-ui/src/onboarding/AgentSelection.tsx @@ -25,7 +25,8 @@ export function AgentSelection({ mode, agents, signedIn, selected, onSelect, onC const claude = useDesktopInstall("claude"); const chatgpt = useDesktopInstall("chatgpt"); const [focusedDesktop, setFocusedDesktop] = useState(); - const resumedDesktop = [claude, chatgpt].find(({ resumable }) => resumable)?.desktop; + // Cached downloads and old failures leave both choices visible on reopening. + const resumedDesktop = [claude, chatgpt].find(({ inProgress }) => inProgress)?.desktop; const activeDesktop = focusedDesktop ?? resumedDesktop; const activeInstaller = activeDesktop === "claude" ? claude : activeDesktop === "chatgpt" ? chatgpt : undefined; const confirming = activeInstaller?.state?.status === "ready_to_install"; @@ -66,7 +67,7 @@ export function AgentSelection({ mode, agents, signedIn, selected, onSelect, onC ? claudeState?.status === "found" ? claudeState.data.version : null : codexState?.status === "found" && codexState.data.desktop.status === "found" ? codexState.data.desktop.data.version : null; return