Skip to content

Commit f17db87

Browse files
shanselmanCopilot
andcommitted
Merge origin/main into PR #1205
Co-authored-by: Copilot App <[email protected]>
2 parents 12addd5 + 309299b commit f17db87

111 files changed

Lines changed: 5519 additions & 420 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/copilot-setup-steps.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ jobs:
2121
- name: Checkout repository
2222
uses: actions/checkout@v7
2323
- name: Install gh-aw extension
24-
uses: github/gh-aw-actions/setup-cli@8914f47b6c1bb8a802c7549f5ac1a81434b66403 # v0.86.1
24+
uses: github/gh-aw-actions/setup-cli@b304200a0ef4b3998673bfc7945acb08ab8c88b7 # v0.87.2
2525
with:
2626
version: v0.72.1

‎docs/ARCHITECTURE.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ leading and trailing pipe. Columns, in order:
160160
| setup-shellescape-closed | closed | src/OpenClaw.SetupEngine/SetupSteps.cs | private ShellEscape helpers with divergent wrap semantics | WslShellQuoting | - | OpenClaw.SetupEngine builds WSL command lines only via WslShellQuoting; no local ShellEscape helper anywhere in the project | SetupStepsShellEscapeClosureTests.SetupEngine_DoesNotReintroduce_PrivateShellEscape | source-shape | when no file under src/OpenClaw.SetupEngine builds any WSL command strings |
161161
| setup-keepalive-process-manager | authoritative | src/OpenClaw.SetupEngine/SetupSteps.cs (StartKeepaliveStep) | setup-time WSL keepalive process discovery, start, marker read/write, command-line identity, and rollback cleanup | KeepaliveProcessManager (raw OS calls delegated to internal IKeepaliveProcessRuntime seam; StartKeepaliveStep is the only caller that reads SetupContext) | StartKeepaliveStep keeps Id/DisplayName and thin ExecuteAsync/RollbackAsync orchestration only | setup-time keepalive never hard-fails the pipeline on start failure (null PID or thrown exception both soft-fail identically); its marker path/JSON are the intentional handoff consumed by the tray keepalive service; rollback kills only wsl/wsl.exe processes whose command line matches this distro via WslCommandLineMatcher, leaves wrong-distro/unmatched command lines untouched, and deletes only its own marker/empty directory | KeepaliveProcessManagerTests.RollbackAsync_KillsOnlyMatchingDistroProcesses_LeavesOthersUntouched | behavioral | when StartKeepaliveStep contains no process/marker logic of its own |
162162
| wsl-distro-install-path | authoritative | OpenClaw.SetupEngine/SetupSteps.cs | inline Path.Combine wsl distro install-path derivation | DistroInstallPathPolicy | - | new installs use the strict supported name grammar; teardown accepts only unambiguous single-segment names whose canonical path is an immediate child of LocalDataDir\wsl with no aliases, case or Unicode collisions, or reparse points at the root or child | SetupStepsTests.DistroInstallPathPolicy_ResolvesImmediateChild | behavioral | - |
163+
| setup-managed-distro-ownership | authoritative | ExistingConfigDetector, CleanupStaleDistroStep, and CreateWslInstanceStep | durable ownership evidence parsing, current-user WSL registration binding, and marker lifecycle | ManagedDistroOwnership plus WindowsWslRegistrationInspector | detector and setup steps request ownership checks or scoped marker operations only | automatic unregister requires durable OpenClaw evidence plus exactly one readable current-user WSL registration whose canonical BasePath is the expected managed install path; automatic orphan-directory deletion requires a path-bound marker; missing, duplicate, malformed, unreadable, or mismatched registration metadata fails closed; exact UI or CLI destructive consent may override | SetupStepsTests.CleanupStaleDistro_PreservesUnownedRegisteredDistro | behavioral | - |
163164
| managed-local-provenance | authoritative | scattered connection, setup, browser, and reconnect call sites | implicit loopback trust and duplicated strong-credential listener checks | ManagedLocalGatewayPortProvenanceService | callers request inspection, authorization, or conflict repair only | unknown, incomplete, conflicting, or changed Windows listener ownership never receives strong credentials or destructive remediation; relayless ownership requires a complete empty Windows snapshot, expected-distro systemd MainPID proof, and immediate complete empty revalidation | ManagedLocalGatewayPortProvenanceServiceTests.InteractiveCredentialGate_ExpectedCacheThenOwnerChanges_FailsClosed | behavioral | - |
164165
| local-ai-gateway-distro-binding | authoritative | src/OpenClaw.Tray.WinUI/App.xaml.cs | hardcoded Local AI WSL distro selection | LocalAiGatewayDistroResolver | App loads the gateway registry and composes the resolver, provider coordinator, and runtime | the singleton Local AI installation binds to exactly one explicit setup-managed local no-SSH gateway record; its record ID and SetupManagedDistroName are pinned and revalidated before every WSL command, while missing, ambiguous, unavailable, or drifted ownership fails closed | LocalAiGatewayProviderCoordinatorTests.Quiesce_OwnerDriftsAfterInspection_BlocksFirstMutation | behavioral | - |
165166
| gateway-wizard-restart-recovery | authoritative | WizardPage + SetupWizardRunner reconnect call sites | duplicated exact-version terminal-restart classification and bounded provenance retry orchestration | GatewayWizardRestartRecoveryPolicy | WizardPage and SetupWizardRunner apply hosted and headless lifecycle and consume provenance inspection results | only managed-local restart-like disconnects may retry NoListener or the typed snapshot-changed race; other unknown or conflicting ownership fails immediately, retryable startup close 1013 stays inside the existing reconnect bound, and exact Gateway 2026.7.1 final model-check close 1012 completes only after a fresh hello-ok, and a terminal hosted-wizard payload completes on the exact TUI SIGTERM termination only when the request just sent answered the authoritative final done acknowledgement step | GatewayWizardRestartRecoveryPolicyTests.Exact2026_7_1TerminalModelCheckServiceRestart_IsExpected | behavioral | when the 2026.7.1 terminal-restart compatibility path is removed |

‎docs/ONBOARDING_WIZARD.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The setup flow no longer configures remote/manual gateways inline. The Welcome p
2424
Displays the OpenClaw icon, app title, and a brief description. If an app-owned local WSL gateway already exists, the primary CTA reads **Install new WSL Gateway** and confirmation warns that the current OpenClaw WSL gateway and distro will be deleted. If only an external gateway exists, the CTA remains **Set up locally** and confirmation explains that the external connection remains available in Connections.
2525

2626
### Local setup progress
27-
Installs and connects a new app-owned `OpenClawGateway` WSL instance from a clean WSL baseline. Setup does not export from or mutate an existing user Ubuntu distro; if WSL cannot create the named app-owned distro directly, setup fails with an actionable update message. When replacing an app-owned local gateway, the removal step is shown as part of progress and can be retried on failure.
27+
Installs and connects a new app-owned `OpenClawGateway` WSL instance from a clean WSL baseline. If the WSL platform is missing or its optional component is not initialized, setup requests administrator approval to install it, re-inspects readiness, and reports when a Windows restart is required. Setup does not export from or mutate an existing user Ubuntu distro; if WSL cannot create the named app-owned distro directly, setup fails with an actionable update message. Cleanup automatically unregisters a distro only when durable OpenClaw evidence is paired with exactly one readable current-user WSL registration whose canonical base path matches the expected managed install path. Automatic orphan-directory cleanup requires a marker bound to that exact path. An unproven same-named distro or leftover data directory is preserved unless the user explicitly confirms its permanent replacement in the setup UI or passes `--confirm-destructive`. When replacing an app-owned local gateway, the removal step is shown as part of progress and can be retried on failure.
2828

2929
The managed distro is locked down and is not intended to be a normal interactive Ubuntu profile. For editing `openclaw.json` as the `openclaw` user and using root for protected-file administration, see [Managing the locked-down WSL gateway](WSL_GATEWAY_ADMIN.md).
3030

‎docs/SETUP_ENGINE_REDESIGN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Executed sequentially. Each step is a small class (30–120 lines) in its own fi
179179
| 2 | `PreflightOsStep` | Validate Windows 64-bit, version ≥ 22H2 |
180180
| 3 | `PreflightWslStep` | Verify WSL is installed and supports direct named clean installs |
181181
| 4 | `PreflightWindowsTailscaleStep` | Validate optional Windows Tailscale prerequisites |
182-
| 5 | `CleanupStaleDistroStep` | Unregister leftover app-owned WSL distro and remove its VHD directory if `CleanBeforeRun` |
182+
| 5 | `CleanupStaleDistroStep` | Unregister a leftover WSL distro only when durable app ownership and the live current-user registration base path agree, and remove an orphaned VHD directory automatically only with a path-bound marker; explicit destructive confirmation may override |
183183
| 6 | `CleanupStaleGatewayStep` | Stop orphaned gateway service, remove config |
184184
| 7 | `PreflightPortStep` | Check gateway port is available |
185185
| 8 | `CreateWslInstanceStep` | Directly install a fresh app-owned WSL distro; never export a user's Ubuntu distro |

‎docs/WSL_EXE_ARGV_PITFALL.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ All of these failed workarounds were verified empirically:
128128
- `src/OpenClaw.SetupEngine/CommandRunner.cs` - `RunInWslAsync` exposes the opt-in `inputViaStdin` parameter.
129129
- `src/OpenClaw.SetupEngine/ValidateWslLockdownStep.cs` - `ValidateWslLockdownStep` uses workaround #2, C# interpolation.
130130
- `src/OpenClaw.SetupEngine/WindowsNodeBootstrapContextStep.cs` - `WindowsNodeBootstrapContextStep` uses workaround #1, stdin.
131+
- `src/OpenClaw.Connection/WslGatewayController.cs` - gateway start, stop, and restart scripts use `bash -s` stdin so the Linux `$PATH` is not replaced by the Windows process environment.
131132

132133
## Related
133134

‎package-lock.json‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"private": true,
55
"description": "MXC sandbox dependency used by the OpenClaw tray build to copy wxc-exec.exe into the app output.",
66
"dependencies": {
7-
"@microsoft/mxc-sdk": "^0.7.0"
7+
"@microsoft/mxc-sdk": "^0.8.0"
88
}
99
}

‎src/OpenClaw.Chat/ChatModels.cs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,12 @@ Task SendMessageAsync(string threadId, string message, CancellationToken cancell
362362
/// </summary>
363363
Task ClearModelAsync(string threadId, CancellationToken cancellationToken = default) => Task.CompletedTask;
364364
Task SetThinkingLevelAsync(string threadId, string thinkingLevel, CancellationToken cancellationToken = default);
365+
/// <summary>
366+
/// Clears the session's explicit thinking-level override so the gateway can
367+
/// restore its provider default. Distinct from <see cref="SetThinkingLevelAsync"/>
368+
/// because the gateway models this as an explicit null.
369+
/// </summary>
370+
Task ClearThinkingLevelAsync(string threadId, CancellationToken cancellationToken = default) => Task.CompletedTask;
365371
Task SetPermissionModeAsync(string threadId, bool allowAll, CancellationToken cancellationToken = default);
366372
Task RespondToPermissionAsync(string threadId, string requestId, string action, CancellationToken cancellationToken = default);
367373
Task RespondToPermissionAsync(string threadId, string requestId, bool allow, CancellationToken cancellationToken = default) =>

‎src/OpenClaw.Connection/LocalAi/LlamaServerClient.cs‎

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ public sealed record LlamaServerRouterProbeResult(
66
bool IsHealthy,
77
LocalAiModelAvailabilityState ModelState,
88
string? ReportedModelPath,
9-
string? Detail);
9+
string? Detail)
10+
{
11+
internal bool IsReadyForManagedModel(string expectedModelPath) =>
12+
IsHealthy &&
13+
ModelState is LocalAiModelAvailabilityState.Verified or LocalAiModelAvailabilityState.Loaded &&
14+
!string.IsNullOrWhiteSpace(ReportedModelPath) &&
15+
LlamaServerModelStatusParser.PathsEqual(ReportedModelPath, expectedModelPath);
16+
}
1017

1118
public sealed record LlamaServerModelStatusEvidence(
1219
LocalAiModelAvailabilityState State,
@@ -119,7 +126,7 @@ public static class LlamaServerModelStatusParser
119126
return modelPath;
120127
}
121128

122-
private static bool PathsEqual(string left, string right)
129+
internal static bool PathsEqual(string left, string right)
123130
{
124131
try
125132
{
@@ -134,7 +141,7 @@ private static bool PathsEqual(string left, string right)
134141

135142
internal interface ILlamaServerClient : IDisposable
136143
{
137-
Task<LlamaServerRouterProbeResult> ProbeRouterAsync(
144+
Task<LlamaServerRouterProbeResult> ProbeManagedModelAsync(
138145
Uri endpoint,
139146
string modelAlias,
140147
string expectedModelPath,
@@ -164,7 +171,7 @@ internal LlamaServerClient(HttpMessageHandler handler)
164171
};
165172
}
166173

167-
public async Task<LlamaServerRouterProbeResult> ProbeRouterAsync(
174+
public async Task<LlamaServerRouterProbeResult> ProbeManagedModelAsync(
168175
Uri endpoint,
169176
string modelAlias,
170177
string expectedModelPath,
@@ -191,14 +198,22 @@ public async Task<LlamaServerRouterProbeResult> ProbeRouterAsync(
191198
}
192199
catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested)
193200
{
194-
return new(true, LocalAiModelAvailabilityState.Unknown, null, "The model status check timed out.");
201+
return new(false, LocalAiModelAvailabilityState.Unknown, null, "The model status check timed out.");
195202
}
196203
catch (Exception ex) when (ex is HttpRequestException or IOException or JsonException or InvalidDataException)
197204
{
198-
return new(true, LocalAiModelAvailabilityState.Unknown, null, "The model status response was invalid.");
205+
return new(false, LocalAiModelAvailabilityState.Unknown, null, "The model status response was invalid.");
199206
}
200207
}
201208

209+
[Obsolete("Use ProbeManagedModelAsync instead.")]
210+
public Task<LlamaServerRouterProbeResult> ProbeRouterAsync(
211+
Uri endpoint,
212+
string modelAlias,
213+
string expectedModelPath,
214+
CancellationToken cancellationToken = default) =>
215+
ProbeManagedModelAsync(endpoint, modelAlias, expectedModelPath, cancellationToken);
216+
202217
private async Task<bool> ProbeHealthAsync(Uri endpoint, CancellationToken cancellationToken)
203218
{
204219
try
@@ -249,9 +264,9 @@ private async Task<LlamaServerRouterProbeResult> ProbeModelAsync(
249264
modelAlias,
250265
expectedModelPath);
251266
if (evidence is null)
252-
return new(true, LocalAiModelAvailabilityState.NotInstalled, null, "The configured model is not registered.");
267+
return new(false, LocalAiModelAvailabilityState.NotInstalled, null, "The configured model is not registered.");
253268
return new(
254-
true,
269+
evidence.State is LocalAiModelAvailabilityState.Verified or LocalAiModelAvailabilityState.Loaded,
255270
evidence.State,
256271
evidence.ModelPath,
257272
$"llama-server reports the model as {evidence.ServerStatus}.");

‎src/OpenClaw.Connection/LocalAi/LlamaServerInferenceClient.cs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ public sealed record LlamaServerInferenceVerification(
1212

1313
public interface ILlamaServerInferenceClient : IDisposable
1414
{
15+
/// <summary>
16+
/// Sends one bounded OpenAI-compatible request to the managed endpoint, intentionally triggering
17+
/// lazy model loading during setup. Verifies the response plus token and timing evidence without
18+
/// returning or logging prompt or response content.
19+
/// </summary>
1520
Task<LlamaServerInferenceVerification> VerifyAsync(
1621
Uri endpoint,
1722
string modelAlias,
@@ -45,6 +50,11 @@ internal LlamaServerInferenceClient(HttpMessageHandler handler)
4550
};
4651
}
4752

53+
/// <summary>
54+
/// Sends one bounded OpenAI-compatible request to the managed endpoint, intentionally triggering
55+
/// lazy model loading during setup. Verifies the response plus token and timing evidence without
56+
/// returning or logging prompt or response content.
57+
/// </summary>
4858
public async Task<LlamaServerInferenceVerification> VerifyAsync(
4959
Uri endpoint,
5060
string modelAlias,

0 commit comments

Comments
 (0)