Skip to content

Commit 6223da0

Browse files
committed
fix(mxc): align build and UBR checks with mxc-sdk platform detection
The MxcAvailability probe used stale build constants (26300 / UBR 8289) instead of matching the @microsoft/mxc-sdk getPlatformSupport() values (build >= 26100, UBR >= 7965 for builds 26100-26500, no UBR minimum for builds >= 26500). This caused false-negative sandbox unavailability on newer Windows builds that the SDK considers supported. Changes: - Replace exact-equality build check with minimum-build (>= 26100) check - Align UBR minimum from 8289 to 7965 - Relax UBR requirement for builds >= 26500 (SDK policy) - Update tests to cover the expanded build range
1 parent 9fc64e6 commit 6223da0

2 files changed

Lines changed: 32 additions & 22 deletions

File tree

src/OpenClaw.Shared/Mxc/MxcAvailability.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace OpenClaw.Shared.Mxc;
88
/// <remarks>
99
/// Backends checked:
1010
/// <list type="bullet">
11-
/// <item><see cref="IsAppContainerAvailable"/> — Windows 11 build 26300 with UBR &gt;= 8289, x64 / arm64.</item>
11+
/// <item><see cref="IsAppContainerAvailable"/> — Windows build &gt;= 26100 with UBR &gt;= 7965 (builds 26100–26500), x64 / arm64.</item>
1212
/// <item><see cref="IsWxcExecResolvable"/> — wxc-exec.exe found in the shipped tray output layout or via override.</item>
1313
/// <item><see cref="IsIsolationSessionAvailable"/> — requires AppContainer plus IsolationProxy.exe in System32.</item>
1414
/// </list>
@@ -22,14 +22,13 @@ public sealed class MxcAvailability
2222
/// </summary>
2323
public const string WxcExecOverrideEnvVar = "OPENCLAW_WXC_EXEC";
2424

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

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

115114
internal static string? GetWindowsBuildUnsupportedReason(int build, int ubr)
116115
{
117-
if (build != SupportedBuild)
118-
return $"Windows build {build} is not MXC supported build {SupportedBuild}.";
116+
if (build < MinBuild)
117+
return $"Windows build {build} is below MXC minimum {MinBuild}.";
119118

120-
if (ubr < MinSupportedUbr)
119+
if (build < UbrRelaxedBuild && ubr < MinSupportedUbr)
121120
{
122121
return
123122
$"Windows UBR {ubr} below MXC minimum {MinSupportedUbr} " +
124-
$"(for build {SupportedBuild}). " +
123+
$"(for build {build}). " +
125124
"Install latest cumulative update.";
126125
}
127126

tests/OpenClaw.Shared.Tests/Mxc/MxcAvailabilityTests.cs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,36 @@ public void Constructor_StoresAllFields()
6565
}
6666

6767
[Theory]
68-
[InlineData(26299, 9999, "is not MXC supported build 26300")]
69-
[InlineData(26300, 8288, "Windows UBR 8288 below MXC minimum 8289")]
70-
[InlineData(26301, 9999, "is not MXC supported build 26300")]
71-
[InlineData(27999, 9999, "is not MXC supported build 26300")]
72-
[InlineData(28000, 9999, "is not MXC supported build 26300")]
68+
[InlineData(26099, 9999, "is below MXC minimum 26100")]
69+
[InlineData(26100, 7964, "Windows UBR 7964 below MXC minimum 7965")]
70+
[InlineData(26300, 7964, "Windows UBR 7964 below MXC minimum 7965")]
71+
[InlineData(26499, 7964, "Windows UBR 7964 below MXC minimum 7965")]
72+
[InlineData(26500, 1, null)]
73+
[InlineData(27000, 0, null)]
7374
public void GetWindowsBuildUnsupportedReason_RejectsUnsupportedBuilds(
7475
int build,
7576
int ubr,
76-
string expectedReason)
77+
string? expectedReason)
7778
{
7879
var reason = MxcAvailability.GetWindowsBuildUnsupportedReason(build, ubr);
7980

80-
Assert.NotNull(reason);
81-
Assert.Contains(expectedReason, reason);
81+
if (expectedReason is null)
82+
{
83+
Assert.Null(reason);
84+
}
85+
else
86+
{
87+
Assert.NotNull(reason);
88+
Assert.Contains(expectedReason, reason);
89+
}
8290
}
8391

8492
[Theory]
93+
[InlineData(26100, 7965)]
94+
[InlineData(26100, 9999)]
8595
[InlineData(26300, 8289)]
86-
[InlineData(26300, 9999)]
96+
[InlineData(26500, 0)]
97+
[InlineData(27000, 0)]
8798
public void GetWindowsBuildUnsupportedReason_AllowsSupportedBuilds(int build, int ubr)
8899
{
89100
var reason = MxcAvailability.GetWindowsBuildUnsupportedReason(build, ubr);

0 commit comments

Comments
 (0)