Skip to content

Commit 976aac8

Browse files
shanselmanCopilot
andcommitted
Fix sandbox fallback notifications
Align sandbox unavailable app notifications and Sandbox page copy with strict fallback blocking versus host fallback, and localize the conflict-resolution resource keys. Co-authored-by: Copilot <[email protected]>
1 parent 153dab4 commit 976aac8

8 files changed

Lines changed: 301 additions & 74 deletions

File tree

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3032,11 +3032,19 @@ private void PublishSandboxRiskNotification(MxcAvailability availability)
30323032
var reasonText = availability.UnsupportedReasons.Count > 0
30333033
? string.Join(" · ", availability.UnsupportedReasons)
30343034
: LocalizationHelper.GetString("AppNotification_SandboxUnavailable_DefaultReason");
3035+
var blockHostFallback = _settings?.SystemRunBlockHostFallbackWhenMxcUnavailable == true;
3036+
var mode = blockHostFallback ? "blocked" : "host-fallback";
3037+
var title = blockHostFallback
3038+
? LocalizationHelper.GetString("AppNotification_SandboxUnavailableBlocked_Title")
3039+
: LocalizationHelper.GetString("AppNotification_SandboxUnavailable_Title");
3040+
var message = blockHostFallback
3041+
? LocalizationHelper.Format("AppNotification_SandboxUnavailableBlocked_MessageFormat", reasonText)
3042+
: LocalizationHelper.Format("AppNotification_SandboxUnavailable_MessageFormat", reasonText);
30353043

30363044
PublishSandboxRiskNotification(
3037-
$"unavailable:{reasonText}",
3038-
LocalizationHelper.GetString("AppNotification_SandboxUnavailable_Title"),
3039-
reasonText);
3045+
$"unavailable:{mode}:{reasonText}",
3046+
title,
3047+
message);
30403048
}
30413049

30423050
private void PublishSandboxRiskNotification(string riskKey, string title, string message)

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

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private async System.Threading.Tasks.Task RefreshAvailabilityAsync()
5656
// "Checking…": synthesize an errored result so the UI shows Retry.
5757
_cachedAvailability = new OpenClaw.Shared.Mxc.MxcAvailability(
5858
false, false, false, null,
59-
new[] { "Couldn't check sandbox availability." }, probeErrored: true);
59+
new[] { L("SandboxPage_ProbeErrorReason") }, probeErrored: true);
6060
}
6161
finally
6262
{
@@ -226,18 +226,18 @@ private void UpdateSandboxStatusCard()
226226

227227
if (enabled && blockHostFallback)
228228
{
229-
SandboxStatusTitle.Text = "Node Sandbox unavailable — commands blocked";
230-
SandboxStatusSubtext.Text = "Containment isn't available on this PC, and strict fallback blocking is on, so agent-started commands are blocked.";
229+
SandboxStatusTitle.Text = L("SandboxPage_StatusUnavailableBlockedTitle");
230+
SandboxStatusSubtext.Text = L("SandboxPage_StatusUnavailableBlockedSubtext");
231231
}
232232
else if (enabled)
233233
{
234-
SandboxStatusTitle.Text = "Node Sandbox unavailable — host fallback";
235-
SandboxStatusSubtext.Text = "Containment isn't available on this PC, so agent-started commands run on the host without sandbox protection.";
234+
SandboxStatusTitle.Text = L("SandboxPage_StatusUnavailableTitle");
235+
SandboxStatusSubtext.Text = L("SandboxPage_StatusUnavailableSubtext");
236236
}
237237
else
238238
{
239-
SandboxStatusTitle.Text = "Node Sandbox is off — host execution";
240-
SandboxStatusSubtext.Text = "Containment isn't available and Node Sandbox is off, so agent-started commands run on the host without sandbox protection.";
239+
SandboxStatusTitle.Text = L("SandboxPage_StatusUnavailableOffTitle");
240+
SandboxStatusSubtext.Text = L("SandboxPage_StatusUnavailableOffSubtext");
241241
}
242242
return;
243243
}
@@ -307,64 +307,40 @@ private void UpdateUnavailableActionBar(OpenClaw.Shared.Mxc.MxcAvailability? ava
307307
var isSetupIssue = !availability.IsWxcExecResolvable;
308308
var blockHostFallback = sandboxEnabled
309309
&& (CurrentApp.Settings?.SystemRunBlockHostFallbackWhenMxcUnavailable ?? false);
310-
var unavailableBehavior = blockHostFallback
311-
? "Commands are blocked while sandboxing is unavailable because strict fallback blocking is enabled. "
312-
: "Commands will run on the host without sandbox protection while sandboxing is unavailable. ";
310+
var unavailableBehavior = L(blockHostFallback
311+
? "SandboxPage_UnavailableBehaviorBlocked"
312+
: "SandboxPage_UnavailableBehaviorHostFallback");
313313

314314
if (isProbeError)
315315
{
316-
UnavailableActionBar.Title = "Couldn't verify sandbox availability";
317-
UnavailableActionMessage.Text =
318-
$"{reasonText}\n\nThe sandbox capability check didn't complete, so commands run uncontained for now. " +
319-
"This is usually transient (a slow or blocked check) — retry, and if it persists check whether security software is blocking wxc-exec.";
320-
UnavailablePrimaryButton.Content = "Retry";
316+
UnavailableActionBar.Title = L("SandboxPage_ProbeErrorTitle");
317+
UnavailableActionMessage.Text = Lf("SandboxPage_ProbeErrorMessageFormat", reasonText, unavailableBehavior);
318+
UnavailablePrimaryButton.Content = L("SandboxPage_Retry");
321319
UnavailablePrimaryButton.Tag = "retry";
322320
UnavailablePrimaryButton.Visibility = Visibility.Visible;
323321
}
324322
else if (isWindowsIssue)
325323
{
326-
<<<<<<< HEAD
327-
UnavailableActionBar.Title = "Your Windows version doesn't support sandboxing yet";
328-
UnavailableActionMessage.Text =
329-
$"{reasonText}\n\n{unavailableBehavior}Sandboxing requires a recent Windows build with the AppContainer primitives shipped. " +
330-
"Install the latest Windows updates (or join the Windows Insider Program for the newest builds) to enable containment.";
331-
UnavailablePrimaryButton.Content = "Open Windows Update";
332-
=======
333324
UnavailableActionBar.Title = L("SandboxPage_WindowsUnsupportedTitle");
334-
UnavailableActionMessage.Text = Lf("SandboxPage_WindowsUnsupportedMessageFormat", reasonText);
325+
UnavailableActionMessage.Text = Lf("SandboxPage_WindowsUnsupportedMessageFormat", reasonText, unavailableBehavior);
335326
UnavailablePrimaryButton.Content = L("SandboxPage_OpenWindowsUpdate");
336-
>>>>>>> 0d964cd4 (Use app notifications for background issues)
337327
UnavailablePrimaryButton.Tag = "windowsupdate";
338328
UnavailablePrimaryButton.Visibility = Visibility.Visible;
339329
}
340330
else if (isSetupIssue)
341331
{
342-
<<<<<<< HEAD
343-
UnavailableActionBar.Title = "Sandboxing components are missing";
344-
UnavailableActionMessage.Text =
345-
$"{reasonText}\n\nThe wxc-exec binary couldn't be located. {unavailableBehavior}" +
346-
"If this is a developer build, build the tray app so wxc-exec.exe is copied into the output folder. " +
347-
"Otherwise reinstall the companion app to restore sandboxing.";
348-
UnavailablePrimaryButton.Content = "Show install instructions";
349-
=======
350332
UnavailableActionBar.Title = L("SandboxPage_ComponentsMissingTitle");
351-
UnavailableActionMessage.Text = Lf("SandboxPage_ComponentsMissingMessageFormat", reasonText);
333+
UnavailableActionMessage.Text = Lf("SandboxPage_ComponentsMissingMessageFormat", reasonText, unavailableBehavior);
352334
UnavailablePrimaryButton.Content = L("SandboxPage_ShowInstallInstructions");
353-
>>>>>>> 0d964cd4 (Use app notifications for background issues)
354335
UnavailablePrimaryButton.Tag = "install";
355336
UnavailablePrimaryButton.Visibility = Visibility.Visible;
356337
}
357338
else
358339
{
359-
<<<<<<< HEAD
360340
UnavailableActionBar.Title = blockHostFallback
361-
? "Sandbox unavailable — commands blocked"
362-
: "Sandbox unavailable — host fallback";
341+
? L("SandboxPage_UnavailableBlockedTitle")
342+
: L("SandboxPage_UnavailableTitle");
363343
UnavailableActionMessage.Text = $"{reasonText}\n\n{unavailableBehavior}";
364-
=======
365-
UnavailableActionBar.Title = L("SandboxPage_UnavailableTitle");
366-
UnavailableActionMessage.Text = reasonText;
367-
>>>>>>> 0d964cd4 (Use app notifications for background issues)
368344
UnavailablePrimaryButton.Visibility = Visibility.Collapsed;
369345
}
370346

‎src/OpenClaw.Tray.WinUI/Strings/en-us/Resources.resw‎

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3220,7 +3220,20 @@ On your gateway host (Mac/Linux), run:
32203220
<value>Agent-started Windows commands will run without sandbox containment until Node Sandbox is turned back on.</value>
32213221
</data>
32223222
<data name="AppNotification_SandboxUnavailable_Title" xml:space="preserve">
3223-
<value>Sandbox unavailable — commands run uncontained</value>
3223+
<value>Sandbox unavailable — host fallback</value>
3224+
</data>
3225+
<data name="AppNotification_SandboxUnavailable_MessageFormat" xml:space="preserve">
3226+
<value>{0}
3227+
3228+
Commands will run on the host without sandbox protection while sandboxing is unavailable.</value>
3229+
</data>
3230+
<data name="AppNotification_SandboxUnavailableBlocked_Title" xml:space="preserve">
3231+
<value>Sandbox unavailable — commands blocked</value>
3232+
</data>
3233+
<data name="AppNotification_SandboxUnavailableBlocked_MessageFormat" xml:space="preserve">
3234+
<value>{0}
3235+
3236+
Commands are blocked while sandboxing is unavailable because strict fallback blocking is enabled.</value>
32243237
</data>
32253238
<data name="AppNotification_SandboxUnavailable_DefaultReason" xml:space="preserve">
32263239
<value>MXC sandboxing primitives are not available on this machine.</value>
@@ -6293,10 +6306,22 @@ Check your connection settings and try again.</value>
62936306
<value>{0} copied to clipboard.</value>
62946307
</data>
62956308
<data name="SandboxPage_StatusUnavailableTitle" xml:space="preserve">
6296-
<value>Node Sandbox unavailable — commands run uncontained</value>
6309+
<value>Node Sandbox unavailable — host fallback</value>
62976310
</data>
62986311
<data name="SandboxPage_StatusUnavailableSubtext" xml:space="preserve">
6299-
<value>Containment isn't available on this PC, so commands run without sandbox protection.</value>
6312+
<value>Containment isn't available on this PC, so agent-started commands run on the host without sandbox protection.</value>
6313+
</data>
6314+
<data name="SandboxPage_StatusUnavailableBlockedTitle" xml:space="preserve">
6315+
<value>Node Sandbox unavailable — commands blocked</value>
6316+
</data>
6317+
<data name="SandboxPage_StatusUnavailableBlockedSubtext" xml:space="preserve">
6318+
<value>Containment isn't available on this PC, and strict fallback blocking is on, so agent-started commands are blocked.</value>
6319+
</data>
6320+
<data name="SandboxPage_StatusUnavailableOffTitle" xml:space="preserve">
6321+
<value>Node Sandbox is off — host execution</value>
6322+
</data>
6323+
<data name="SandboxPage_StatusUnavailableOffSubtext" xml:space="preserve">
6324+
<value>Containment isn't available and Node Sandbox is off, so agent-started commands run on the host without sandbox protection.</value>
63006325
</data>
63016326
<data name="SandboxPage_StatusOnTitle" xml:space="preserve">
63026327
<value>Node Sandbox is on</value>
@@ -6313,11 +6338,29 @@ Check your connection settings and try again.</value>
63136338
<data name="SandboxPage_UnavailableDefaultReason" xml:space="preserve">
63146339
<value>MXC sandboxing primitives are not available on this machine.</value>
63156340
</data>
6341+
<data name="SandboxPage_ProbeErrorReason" xml:space="preserve">
6342+
<value>Couldn't check sandbox availability.</value>
6343+
</data>
6344+
<data name="SandboxPage_UnavailableBehaviorHostFallback" xml:space="preserve">
6345+
<value>Commands will run on the host without sandbox protection while sandboxing is unavailable.</value>
6346+
</data>
6347+
<data name="SandboxPage_UnavailableBehaviorBlocked" xml:space="preserve">
6348+
<value>Commands are blocked while sandboxing is unavailable because strict fallback blocking is enabled.</value>
6349+
</data>
6350+
<data name="SandboxPage_ProbeErrorTitle" xml:space="preserve">
6351+
<value>Couldn't verify sandbox availability</value>
6352+
</data>
6353+
<data name="SandboxPage_ProbeErrorMessageFormat" xml:space="preserve">
6354+
<value>{0}&#x0A;&#x0A;{1} The sandbox capability check didn't complete. This is usually transient (a slow or blocked check) — retry, and if it persists check whether security software is blocking wxc-exec.</value>
6355+
</data>
6356+
<data name="SandboxPage_Retry" xml:space="preserve">
6357+
<value>Retry</value>
6358+
</data>
63166359
<data name="SandboxPage_WindowsUnsupportedTitle" xml:space="preserve">
63176360
<value>Your Windows version doesn't support sandboxing yet</value>
63186361
</data>
63196362
<data name="SandboxPage_WindowsUnsupportedMessageFormat" xml:space="preserve">
6320-
<value>{0}&#x0A;&#x0A;Commands run uncontained on this machine — sandboxing requires a recent Windows build with the AppContainer primitives shipped. Install the latest Windows updates (or join the Windows Insider Program for the newest builds) to enable containment.</value>
6363+
<value>{0}&#x0A;&#x0A;{1} Sandboxing requires a recent Windows build with the AppContainer primitives shipped. Install the latest Windows updates (or join the Windows Insider Program for the newest builds) to enable containment.</value>
63216364
</data>
63226365
<data name="SandboxPage_OpenWindowsUpdate" xml:space="preserve">
63236366
<value>Open Windows Update</value>
@@ -6326,13 +6369,16 @@ Check your connection settings and try again.</value>
63266369
<value>Sandboxing components are missing</value>
63276370
</data>
63286371
<data name="SandboxPage_ComponentsMissingMessageFormat" xml:space="preserve">
6329-
<value>{0}&#x0A;&#x0A;The wxc-exec binary couldn't be located, so commands run uncontained. If this is a developer build, build the tray app so wxc-exec.exe is copied into the output folder. Otherwise reinstall the companion app to restore sandboxing.</value>
6372+
<value>{0}&#x0A;&#x0A;The wxc-exec binary couldn't be located. {1} If this is a developer build, build the tray app so wxc-exec.exe is copied into the output folder. Otherwise reinstall the companion app to restore sandboxing.</value>
63306373
</data>
63316374
<data name="SandboxPage_ShowInstallInstructions" xml:space="preserve">
63326375
<value>Show install instructions</value>
63336376
</data>
63346377
<data name="SandboxPage_UnavailableTitle" xml:space="preserve">
6335-
<value>Sandbox unavailable — commands run uncontained</value>
6378+
<value>Sandbox unavailable — host fallback</value>
6379+
</data>
6380+
<data name="SandboxPage_UnavailableBlockedTitle" xml:space="preserve">
6381+
<value>Sandbox unavailable — commands blocked</value>
63366382
</data>
63376383
<data name="SettingsPage_LocalGatewayRemovedTitle" xml:space="preserve">
63386384
<value>Local gateway removed</value>

0 commit comments

Comments
 (0)