Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions src/OpenClaw.Shared/Mxc/MxcAvailability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace OpenClaw.Shared.Mxc;
/// <remarks>
/// Backends checked:
/// <list type="bullet">
/// <item><see cref="IsAppContainerAvailable"/> — Windows 11 build 26300 with UBR &gt;= 8289, x64 / arm64.</item>
/// <item><see cref="IsAppContainerAvailable"/> — Windows build &gt;= 26100 with UBR &gt;= 7965 (builds 26100–26500), x64 / arm64.</item>
/// <item><see cref="IsWxcExecResolvable"/> — wxc-exec.exe found in the shipped tray output layout or via override.</item>
/// <item><see cref="IsIsolationSessionAvailable"/> — requires AppContainer plus IsolationProxy.exe in System32.</item>
/// </list>
Expand All @@ -22,14 +22,13 @@ public sealed class MxcAvailability
/// </summary>
public const string WxcExecOverrideEnvVar = "OPENCLAW_WXC_EXEC";

private const int SupportedBuild = 26300;

// TODO: This is all temporary and a moment in time; feature gate this correctly ASAP.
/// <summary>
/// Temporary MXC support table: only build 26300 with UBR 8289+ is enabled.
/// All other builds are blocked until validated and the table is updated.
/// </summary>
private const int MinSupportedUbr = 8289;
// Matches @microsoft/mxc-sdk platform.checkWindowsBuildVersion():
// - Build >= 26100 required.
// - Builds 26100–26500 require UBR >= 7965.
// - Builds >= 26500 have no UBR minimum.
private const int MinBuild = 26100;
private const int MinSupportedUbr = 7965;
private const int UbrRelaxedBuild = 26500;

public bool IsAppContainerAvailable { get; }
public bool IsIsolationSessionAvailable { get; }
Expand Down Expand Up @@ -114,14 +113,14 @@ public static MxcAvailability Probe(IOpenClawLogger? logger = null)

internal static string? GetWindowsBuildUnsupportedReason(int build, int ubr)
{
if (build != SupportedBuild)
return $"Windows build {build} is not MXC supported build {SupportedBuild}.";
if (build < MinBuild)
return $"Windows build {build} is below MXC minimum {MinBuild}.";

if (ubr < MinSupportedUbr)
if (build < UbrRelaxedBuild && ubr < MinSupportedUbr)
{
return
$"Windows UBR {ubr} below MXC minimum {MinSupportedUbr} " +
$"(for build {SupportedBuild}). " +
$"(for build {build}). " +
"Install latest cumulative update.";
}

Expand Down
3 changes: 2 additions & 1 deletion src/OpenClaw.Tray.WinUI/Pages/ChatPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ private async Task InitializeWebViewAsync(SettingsManager settings)
return;
}

if (!GatewayChatHelper.TryBuildChatUrl(credential.GatewayUrl, credential.Token, out var chatUrl, out var errorMessage))
if (!GatewayChatHelper.TryBuildChatUrl(credential.GatewayUrl, credential.Token, out var chatUrl, out var errorMessage, _pendingWebViewSessionKey))
{
PlaceholderPanel.Visibility = Visibility.Collapsed;
ErrorPanel.Visibility = Visibility.Visible;
Expand All @@ -432,6 +432,7 @@ private async Task InitializeWebViewAsync(SettingsManager settings)
}
_chatUrl = chatUrl;
_chatUrl = chatUrl;
_pendingWebViewSessionKey = null;

PlaceholderPanel.Visibility = Visibility.Collapsed;
ErrorPanel.Visibility = Visibility.Collapsed;
Expand Down
29 changes: 20 additions & 9 deletions tests/OpenClaw.Shared.Tests/Mxc/MxcAvailabilityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,36 @@ public void Constructor_StoresAllFields()
}

[Theory]
[InlineData(26299, 9999, "is not MXC supported build 26300")]
[InlineData(26300, 8288, "Windows UBR 8288 below MXC minimum 8289")]
[InlineData(26301, 9999, "is not MXC supported build 26300")]
[InlineData(27999, 9999, "is not MXC supported build 26300")]
[InlineData(28000, 9999, "is not MXC supported build 26300")]
[InlineData(26099, 9999, "is below MXC minimum 26100")]
[InlineData(26100, 7964, "Windows UBR 7964 below MXC minimum 7965")]
[InlineData(26300, 7964, "Windows UBR 7964 below MXC minimum 7965")]
[InlineData(26499, 7964, "Windows UBR 7964 below MXC minimum 7965")]
[InlineData(26500, 1, null)]
[InlineData(27000, 0, null)]
public void GetWindowsBuildUnsupportedReason_RejectsUnsupportedBuilds(
int build,
int ubr,
string expectedReason)
string? expectedReason)
{
var reason = MxcAvailability.GetWindowsBuildUnsupportedReason(build, ubr);

Assert.NotNull(reason);
Assert.Contains(expectedReason, reason);
if (expectedReason is null)
{
Assert.Null(reason);
}
else
{
Assert.NotNull(reason);
Assert.Contains(expectedReason, reason);
}
}

[Theory]
[InlineData(26100, 7965)]
[InlineData(26100, 9999)]
[InlineData(26300, 8289)]
[InlineData(26300, 9999)]
[InlineData(26500, 0)]
[InlineData(27000, 0)]
public void GetWindowsBuildUnsupportedReason_AllowsSupportedBuilds(int build, int ubr)
{
var reason = MxcAvailability.GetWindowsBuildUnsupportedReason(build, ubr);
Expand Down
Loading