From 792eb288c35a7284ba1d27203e13bf63a46de250 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Sat, 27 Jun 2026 01:47:10 -0700 Subject: [PATCH] Only open terminal when pre-install checks succeed Prevent the terminal from opening and setting the terminal command if onBeforeOpenTerminal or refreshPreInstallNotice throws an error. --- .../src/components/settings/AgentSkillSetupPanel.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/components/settings/AgentSkillSetupPanel.tsx b/src/renderer/src/components/settings/AgentSkillSetupPanel.tsx index 768cac8b672..d7f4da5b619 100644 --- a/src/renderer/src/components/settings/AgentSkillSetupPanel.tsx +++ b/src/renderer/src/components/settings/AgentSkillSetupPanel.tsx @@ -173,14 +173,20 @@ export function AgentSkillSetupPanel({ const nextCommand = activeCommand setTerminalOpening(true) void (async () => { + let shouldOpenTerminal = false try { await onBeforeOpenTerminal?.() await refreshPreInstallNotice() + shouldOpenTerminal = true + } catch { + shouldOpenTerminal = false } finally { if (mountedRef.current) { setTerminalOpening(false) - setTerminalCommand(nextCommand) - setTerminalOpen(true) + if (shouldOpenTerminal) { + setTerminalCommand(nextCommand) + setTerminalOpen(true) + } } } })()