Skip to content

Commit 58599fa

Browse files
fix(setup): cancel wizard session before disconnect to prevent stale-session retry errors
When wizard.next timed out (e.g. Teams channel selection hanging), EnterWizardErrorAsync called DisconnectAsync which nulled _client, then showed "Start wizard again" / "Skip wizard" buttons. CancelCurrentSessionAsync checked _client != null and skipped the wizard.cancel call — leaving the server-side session active. Subsequent "Start wizard again" clicks then hit a gateway "wizard already running" error. Fix: replace await DisconnectAsync() with await CancelCurrentSessionAsync() in both EnterWizardErrorAsync and StartWizardAsync. CancelCurrentSessionAsync sends wizard.cancel (best-effort, catch ignored) then calls DisconnectAsync, so the disconnect still happens. The session cancel is a no-op when _client is already null or _sessionId is empty, so the first-start path is unaffected. Closes #709 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d1b1363 commit 58599fa

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/OpenClaw.SetupEngine.UI/Pages/WizardPage.xaml.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ private async Task StartWizardAsync()
5656
{
5757
_errorState = false;
5858
HideRecoveryActions();
59-
await DisconnectAsync();
59+
// Cancel any in-progress server-side wizard session before starting a
60+
// fresh one, so the gateway doesn't reject wizard.start with "wizard
61+
// already running" when recovering from a previous error.
62+
await CancelCurrentSessionAsync();
6063
ClearConsoleBanner();
6164
_sessionId = "";
6265
_wizardStepCount = 0;
@@ -757,7 +760,10 @@ private async Task EnterWizardErrorAsync(string detail)
757760
return;
758761

759762
_errorState = true;
760-
await DisconnectAsync();
763+
// Cancel the server-side wizard session before disconnecting so that
764+
// subsequent retries (Start wizard again / Skip wizard) don't hit a
765+
// "wizard already running" error from a lingering gateway session.
766+
await CancelCurrentSessionAsync();
761767
ShowError(detail);
762768
}
763769

0 commit comments

Comments
 (0)