Skip to content

Commit 6a3cb68

Browse files
committed
feat(setup): guide channel readiness handoff
1 parent bc518f7 commit 6a3cb68

8 files changed

Lines changed: 90 additions & 10 deletions

File tree

‎docs/ONBOARDING_WIZARD.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ When the gateway config wizard surfaces an error and the active gateway is an ap
5656
### All set
5757
Displays a completion summary, a Launch at startup toggle, and a Finish button that saves the startup preference before restarting the tray. Launch at startup defaults on so OpenClaw is ready after reboot.
5858

59+
Completion reports the local gateway and Windows device as ready independently from mobile and chat channels. **Set up or verify channels** restarts the tray directly into Channels, where each channel exposes its current gateway-reported state. Configuration supported by the Gateway API stays in-app. If a gateway-host plugin is missing, the page provides the exact copyable install command, explains why it must run on the gateway host, states the expected result, and asks the user to return and refresh until the channel reports connected or running. The setup UI does not infer channel readiness from a successful Gateway connection and does not automate unknown Gateway commands.
60+
5961
## Security
6062

6163
The onboarding wizard follows these security practices:

‎docs/SETUP_ENGINE_REDESIGN.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ The Setup Engine is a **config-driven system** for provisioning an OpenClaw WSL
1010

1111
The bundled `default-config.json` ships with the tray executable and provides secure defaults (loopback bind, WSL isolation, systemd enabled). Defaults can be overridden via config file or environment variables.
1212

13+
The completion page treats Gateway/device readiness and channel readiness as separate states. Its channel handoff carries a typed `SetupCompletionDestination.Channels` result back to the tray composition root. The tray performs its normal restart, opens the existing Channels surface, and lets that surface verify live Gateway channel state. Setup does not own channel lifecycle or construct a parallel Gateway client.
14+
1315
> **Status note (2026-07-06):** Current default setup includes `WindowsNodeBootstrapContextStep`, which injects Windows-node context into the WSL workspace `AGENTS.md` after onboarding.
1416
1517
---

‎src/OpenClaw.SetupEngine.UI/Pages/CompletePage.xaml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@
8383
<FontIcon Grid.Column="2" Glyph="&#xE73E;" FontSize="16" Foreground="{ThemeResource SystemFillColorSuccessBrush}" VerticalAlignment="Center" />
8484
</Grid>
8585
</Border>
86+
<Border Background="{ThemeResource CardBackgroundFillColorDefaultBrush}" BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" BorderThickness="1" CornerRadius="4" Padding="14,12">
87+
<Grid ColumnDefinitions="Auto,*" ColumnSpacing="14">
88+
<FontIcon Grid.Column="0" Glyph="&#xE8BD;" FontSize="18" VerticalAlignment="Center" />
89+
<StackPanel Grid.Column="1" Spacing="6">
90+
<TextBlock Text="Mobile and chat channels" Style="{StaticResource BodyStrongTextBlockStyle}" />
91+
<TextBlock Text="Gateway connected does not mean a channel is ready. Review each channel separately, complete any gateway-host step, then refresh until it shows connected or running."
92+
TextWrapping="Wrap"
93+
Style="{StaticResource CaptionTextBlockStyle}"
94+
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
95+
<Button x:Name="ChannelSetupButton"
96+
Content="Set up or verify channels"
97+
HorizontalAlignment="Left"
98+
Click="ChannelSetupButton_Click" />
99+
</StackPanel>
100+
</Grid>
101+
</Border>
86102
</StackPanel>
87103

88104
<Border x:Name="ErrorCard" CornerRadius="4" Padding="16,12,16,12"

‎src/OpenClaw.SetupEngine.UI/Pages/CompletePage.xaml.cs‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,24 @@ private void LaunchButton_Click(object sender, RoutedEventArgs e)
105105
{
106106
if (LaunchButton.Content?.ToString() != "Close")
107107
{
108-
var enableAutoStart = StartupRow.Visibility == Visibility.Visible && StartupToggle.IsOn;
109-
if (SetupWindow.Active?.RequestSetupCompleted(enableAutoStart) == true)
108+
if (CompleteSetup(SetupCompletionDestination.Chat))
110109
return;
111110
}
112111

113112
SetupWindow.Active?.Close();
114113
}
115114

115+
private void ChannelSetupButton_Click(object sender, RoutedEventArgs e)
116+
{
117+
CompleteSetup(SetupCompletionDestination.Channels);
118+
}
119+
120+
private bool CompleteSetup(SetupCompletionDestination destination)
121+
{
122+
var enableAutoStart = StartupRow.Visibility == Visibility.Visible && StartupToggle.IsOn;
123+
return SetupWindow.Active?.RequestSetupCompleted(enableAutoStart, destination) == true;
124+
}
125+
116126
private void ViewLog_Click(object sender, RoutedEventArgs e)
117127
{
118128
LogFileLauncher.RevealInExplorer(_logPath);

‎src/OpenClaw.SetupEngine.UI/SetupWindow.xaml.cs‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,9 @@ public void RequestAdvancedSetup()
352352
AdvancedSetupRequested?.Invoke(this, EventArgs.Empty);
353353
}
354354

355-
public bool RequestSetupCompleted(bool enableAutoStart)
355+
public bool RequestSetupCompleted(
356+
bool enableAutoStart,
357+
SetupCompletionDestination destination = SetupCompletionDestination.Chat)
356358
{
357359
var handler = SetupCompleted;
358360
if (handler == null)
@@ -374,7 +376,7 @@ public bool RequestSetupCompleted(bool enableAutoStart)
374376
return true;
375377
}
376378

377-
handler.Invoke(this, new SetupCompletedEventArgs(enableAutoStart));
379+
handler.Invoke(this, new SetupCompletedEventArgs(enableAutoStart, destination));
378380
return true;
379381
}
380382

@@ -460,4 +462,12 @@ public sealed record CompletePageArgs(
460462
SetupReviewSummary? ReviewSummary = null,
461463
bool CanRetryGatewayFallback = false,
462464
string? GatewayFallbackVersion = null);
463-
public sealed record SetupCompletedEventArgs(bool EnableAutoStart);
465+
public enum SetupCompletionDestination
466+
{
467+
Chat,
468+
Channels,
469+
}
470+
471+
public sealed record SetupCompletedEventArgs(
472+
bool EnableAutoStart,
473+
SetupCompletionDestination Destination = SetupCompletionDestination.Chat);

‎src/OpenClaw.Tray.WinUI/App.xaml.cs‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
using System.Threading.Tasks;
3737
using Updatum;
3838
using WinUIEx;
39+
using SetupCompletionDestination = OpenClaw.SetupEngine.UI.SetupCompletionDestination;
3940
using SetupCompletedEventArgs = OpenClaw.SetupEngine.UI.SetupCompletedEventArgs;
4041
using SetupWindow = OpenClaw.SetupEngine.UI.SetupWindow;
4142

@@ -604,7 +605,10 @@ private async Task OnLaunchedAsync(LaunchActivatedEventArgs args)
604605
?? (_startupArgs.Length > 1 && IsDeepLinkArg(_startupArgs[1])
605606
? _startupArgs[1] : null)
606607
?? (string.Equals(_postSetupLaunch, "chat", StringComparison.OrdinalIgnoreCase)
607-
? $"{AppIdentity.ProtocolScheme}://chat" : null);
608+
? $"{AppIdentity.ProtocolScheme}://chat"
609+
: string.Equals(_postSetupLaunch, "channels", StringComparison.OrdinalIgnoreCase)
610+
? $"{AppIdentity.ProtocolScheme}://notifications"
611+
: null);
608612
if (deepLink != null)
609613
{
610614
SendDeepLinkToRunningInstance(deepLink);
@@ -959,6 +963,10 @@ _dispatcherQueue is null
959963
{
960964
await HandleDeepLinkAsync($"{AppIdentity.ProtocolScheme}://chat");
961965
}
966+
else if (!setupShownDuringStartup && string.Equals(_postSetupLaunch, "channels", StringComparison.OrdinalIgnoreCase))
967+
{
968+
ShowHub("channels");
969+
}
962970

963971
Logger.Info("Application started (WinUI 3)");
964972
}
@@ -4153,11 +4161,13 @@ private void OnSetupAdvancedSetupRequested(object? sender, EventArgs e)
41534161

41544162
private void OnSetupCompleted(object? sender, SetupCompletedEventArgs e) =>
41554163
AsyncEventHandlerGuard.Run(
4156-
() => RestartAfterSetupAsync(e.EnableAutoStart),
4164+
() => RestartAfterSetupAsync(e.EnableAutoStart, e.Destination),
41574165
new AppLogger(),
41584166
nameof(OnSetupCompleted));
41594167

4160-
private async Task RestartAfterSetupAsync(bool enableAutoStart)
4168+
private async Task RestartAfterSetupAsync(
4169+
bool enableAutoStart,
4170+
SetupCompletionDestination destination)
41614171
{
41624172
var exePath = ResolveCurrentExecutablePath();
41634173
if (string.IsNullOrWhiteSpace(exePath) || !File.Exists(exePath))
@@ -4188,7 +4198,7 @@ private async Task RestartAfterSetupAsync(bool enableAutoStart)
41884198
psi.ArgumentList.Add("--wait-for-pid");
41894199
psi.ArgumentList.Add(Environment.ProcessId.ToString(CultureInfo.InvariantCulture));
41904200
psi.ArgumentList.Add("--post-setup-launch");
4191-
psi.ArgumentList.Add("chat");
4201+
psi.ArgumentList.Add(destination == SetupCompletionDestination.Channels ? "channels" : "chat");
41924202

41934203
var restarted = Process.Start(psi);
41944204
if (restarted == null)

‎src/OpenClaw.Tray.WinUI/Pages/ChannelsPage.xaml.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2153,7 +2153,7 @@ private FrameworkElement BuildInstallPluginPanel(ChannelRecord record)
21532153

21542154
body.Children.Add(new TextBlock
21552155
{
2156-
Text = "Run this command on the machine that hosts your gateway. After it finishes, come back and click Refresh.",
2156+
Text = "Run this command on the machine that hosts your gateway. Expected result: the plugin installs without an error. Return here, click Refresh, then start or save the channel until its status shows connected or running.",
21572157
Style = (Style)Application.Current.Resources["CaptionTextBlockStyle"],
21582158
Foreground = (Brush)Application.Current.Resources["TextFillColorTertiaryBrush"],
21592159
TextWrapping = TextWrapping.Wrap,

‎tests/OpenClaw.Tray.Tests/AppRefactorContractTests.cs‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,36 @@ public void CompletePage_UsesCompletionArgsForStartupPreference()
11361136
Assert.DoesNotContain("StartupToggle.IsOn = true", complete);
11371137
}
11381138

1139+
[Fact]
1140+
public void CompletePage_SeparatesGatewayReadinessFromChannelVerification()
1141+
{
1142+
var root = TestRepositoryPaths.GetRepositoryRoot();
1143+
var setupWindow = File.ReadAllText(Path.Combine(root, "src", "OpenClaw.SetupEngine.UI", "SetupWindow.xaml.cs"));
1144+
var completeXaml = File.ReadAllText(Path.Combine(root, "src", "OpenClaw.SetupEngine.UI", "Pages", "CompletePage.xaml"));
1145+
var completeCode = File.ReadAllText(Path.Combine(root, "src", "OpenClaw.SetupEngine.UI", "Pages", "CompletePage.xaml.cs"));
1146+
var app = File.ReadAllText(Path.Combine(root, "src", "OpenClaw.Tray.WinUI", "App.xaml.cs"));
1147+
1148+
Assert.Contains("Gateway connected does not mean a channel is ready", completeXaml);
1149+
Assert.Contains("Set up or verify channels", completeXaml);
1150+
Assert.Contains("CompleteSetup(SetupCompletionDestination.Channels)", completeCode);
1151+
Assert.Contains("SetupCompletionDestination Destination", setupWindow);
1152+
Assert.Contains("ShowHub(\"channels\")", app);
1153+
Assert.Contains("destination == SetupCompletionDestination.Channels ? \"channels\" : \"chat\"", app);
1154+
}
1155+
1156+
[Fact]
1157+
public void ChannelsPage_GatewayHostHandoff_IsCopyableAndVerifiable()
1158+
{
1159+
var root = TestRepositoryPaths.GetRepositoryRoot();
1160+
var channels = File.ReadAllText(Path.Combine(root, "src", "OpenClaw.Tray.WinUI", "Pages", "ChannelsPage.xaml.cs"));
1161+
1162+
Assert.Contains("openclaw plugins install {pkg}", channels);
1163+
Assert.Contains("pkgData.SetText(cmd)", channels);
1164+
Assert.Contains("Expected result: the plugin installs without an error", channels);
1165+
Assert.Contains("click Refresh", channels);
1166+
Assert.Contains("status shows connected or running", channels);
1167+
}
1168+
11391169
[Fact]
11401170
public void CompletePage_OffersExactFallbackOnlyThroughTypedCompatibilityPath()
11411171
{

0 commit comments

Comments
 (0)