Repository navigation
feat: run Local AI with native isolated Gateways - #1565
Conversation
Wire authenticated Windows llama.cpp acquisition, native setup selection, guarded Gateway configuration, and durable endpoint ownership and recovery. Preserve the existing WSL lifecycle. Co-authored-by: Copilot App <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed October 1, 2026, 3:49 AM ET / 07:49 UTC (Revision 9). ClawSweeper reviewWhat this changesThe branch connects Companion-managed Windows Local AI to isolated native Gateways, adding authenticated inference, installation continuation, progress reporting, and persistent recovery ownership. Merge readiness⛔ Blocked before merge - 10 items remain The two addressed findings are resolved, but six previously raised lifecycle defects remain source-reproducible. The stated scope deferral does not resolve those merge blockers. Priority: P2 Review scores
Verification
How this fits togetherCompanion manages a Windows inference process while the isolated Gateway receives an authenticated loopback provider configuration. Setup and connection recovery coordinate that process, its saved ownership receipt, and exact-model verification. flowchart TD
A[User chooses Local AI] --> B[Review Gateway and model]
B --> C[Acquire Windows artifacts]
C --> D[Owned inference runtime]
E[Saved ownership receipt] --> D
D --> F[Authorized Gateway configuration]
F --> G[Exact model verification]
H[Reconnect or shutdown] --> E
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one exclusive runtime owner, with visible guarded reconciliation, verified ownership release, and provider withdrawal while the authorized connection remains available, preserving existing WSL behavior. Do we have a high-confidence way to reproduce the issue? Yes, source inspection establishes concrete triggers on the pinned PR head for the six retained findings. No live Windows reproduction or tests were executed during this read-only review. Is this the best way to solve the issue? The shared runtime and guarded configuration approach is appropriate, but the current patch is incomplete: stopped and pending recovery, shutdown ordering, WSL admission, and ownership release need repair. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ab5c0ca6fe43. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
Report hardware, artifact, runtime, provider and inference stages. Join admitted native recovery before exact handoff verification, bound startup to the remaining receipt lifetime, and suppress repeated automatic retry dialogs. Co-authored-by: Copilot App <[email protected]>
Preserve native Local AI progress alongside inline provider loading and Workspace handoff. Present PC-wide Local AI availability below Gateway choices as a transparent, borderless status row. Co-authored-by: Copilot App <[email protected]>
Hanselman dual-model review: changes requestedReviewed 35385cf against ab5c0ca, covering all 60 changed files and relevant callers/tests. Independent reviewers: Claude Opus 5.5 ( Verdict: not ready to merge. Three HIGH correctness defects and five MEDIUM integration defects are retained below. These are source-traced findings, not live UI/Gateway reproductions. No CRITICAL issue is claimed. The successful CI gate does not cover the missing lifecycle compositions. Both models agree: HIGH consensus
Only one model flagged: LOW consensusLOW consensus means independent agreement is absent, not that severity is low. These findings were checked against the implementation; fixes still need focused regressions and runtime proof.
Findings and required correctionsR1: Preserve explicit Stop across connection events. R2: Bind the existing-native route before entering setup from Settings. R3: Provide safe reconciliation when the listener is no longer running. R4: Withdraw while the authorized connection is still alive. R5: Skip WSL admission checks for native-only acquisition. R6: Apply singleton ownership checks to the WSL admission path too. R7: Expose reconciliation separately from artifact repair. R8: Add an explicit safe release/transfer flow. Reconciliation notesThe whole-hash fence and pending journal are intentionally conservative. R3 is the missing stopped-listener recovery path, not a request to weaken configuration authority. Generic concerns about registration races, lease contention, no-op/rejected RPC responses, discovery latency, and mixed-Gateway startup policy were not promoted to additional blockers without stronger reachability/deployed-contract evidence. The reviewers' upstream-source observations do not establish the installed Gateway version's behavior. Validation and remaining proofThe coordinator ran these focused suites at the reviewed head, using this worktree as
Total: 516 passed, 1 skipped. No source changes were made and no full local build was rerun for this review. GitHub's CI Gate is successful at the same head; skipped jobs are not counted as executed proof. Retain the declared proof pools and existing gaps: final-effect authority rejection after device/Gateway replacement or revoked admin authority; real acknowledged/lost-reply restart and withdrawal; current-head visible styling, detailed progress, and post-restart destination handoff; native rollback, x64 inference, and full WSL/Blackwell lifecycle coverage. Historical ARM64 authenticated inference and HTTP 401 evidence remain useful, but do not establish these lifecycle behaviors. Fix-confidence percentages estimate implementation certainty, not runtime proof or a model vote. |
Continue reviewed native installation directly into startup and verification. Preserve explicit Stop across reconnects and bind existing-native Settings setup to its exact Gateway without WSL finalization or unrelated settings writes. Co-authored-by: Copilot App <[email protected]>
Keep the guarded Resume restart budget consistent with prior reconnect behavior and reject incomplete native records before opening Settings setup. Co-authored-by: Copilot App <[email protected]>
Hanselman re-review: R1/R2 fixed, changes still requestedReviewed latest remote head: This is a delta review of Independent reviewers were Claude Opus 5.5 ( Both reviewers confirm R1 and R2 are fixed in source. The remaining verdict is changes requested: R3 is still HIGH, and R4–R8 remain MEDIUM. The re-review also retains one MEDIUM, single-model residual first-use failure case, N1. No new CRITICAL or HIGH regression was established in the follow-up commits. Addressed findings
The final Relevant implementations: Both models agree: HIGH consensusThese are current-pass assessments. The earlier report's single-model findings have not been retroactively relabeled.
R3 remains the principal blocker. Stop the listener, make an unrelated Gateway config edit, then Start/Use. The whole-config hash fence rejects the operation, while inference-based reconciliation still requires an already-running Companion-owned listener. Add guarded stopped-listener or already-withdrawn recovery, preserving identity, owned-field checks, and CAS. See The other retained triggers and corrections remain:
Only one model flagged: LOW consensus
N1 is a residual first-use recovery edge, not a reversal of the explicit-Stop fix or a new defect introduced by N2 is not counted as an additional blocker: offline Stop can fail withdrawal, then app exit kills the listener while persisted stopped intent prevents recovery. The stale route needs withdraw-only reconciliation, not automatic startup. This overlaps R4's failed-withdrawal persistence and was not independently reported by Astra. Validation and proof limitsFocused tests were rerun with the checkout pinned to
One earlier No source changes or live Gateway/UI mutations were made for this review; no full local build was rerun. At publication checking, multiple latest-head CI suites were still in progress. Prior-head CI success is not latest-head completion. Source fixes do not close the runtime proof gates. Still needed: real native Stop across restart/reconnect; existing-native Settings through destination completion with zero WSL commands; visible install-and-use progress/failure/handoff; authority replacement/revocation rejection; acknowledged/lost-reply restart and withdrawal; native rollback, x64 authenticated inference, and full WSL/Blackwell lifecycle proof. Fix-confidence percentages describe proposed implementation certainty, not runtime verification. |
|
Will address review findings in separate PR in the interest of time. Prioritizing getting an alpha release out to get it for internal testers. |
|
Final local closeout passed on PR head The run used the worktree's
Total: 11,719 passed, 41 skipped. Test commands also emitted TRX files under the isolated session artifact directory. The bounded R1/R2 review completed with no blocking findings. Accepted follow-ups preserve the reconnect restart budget and reject incomplete native records before opening Settings setup; both are in Scope remains R1/R2 plus the duplicate-screen continuation. R3-R8 were explicitly deferred. Current-head visible native Stop/reconnect and Settings-completion proof remains unverified; fixture tests and MXC containment proof do not replace that evidence. The earlier manual Release app has exited cleanly. No post-merge CI result is claimed here. |


What Problem This Solves
Native Gateway users need Companion-managed Local AI without installing a WSL Gateway or repeating AI selection after installing a model.
User Impact
User impact: Install and use Local AI continues from Windows artifact acquisition through startup, authenticated provider publication and exact-model verification without returning to the provider chooser. Progress shows real stages; confirmed startup failures retain diagnostics and restore repair/provider choices. Uncertain writes remain verification-only, and failure before admission requires a new explicit Use action.
R1: explicit Stop remains stopped across Gateway reconnections, including node-only state changes. R2: Local AI opened from Settings binds the existing native Gateway before entering AI setup, skips WSL workspace finalization and preserves existing permissions, sharing and startup settings.
The Local AI availability row sits below all three Gateway choices, with transparent, borderless styling. Destination handoff waits for already-admitted runtime recovery and avoids repeated automatic error dialogs.
Scope: the user requested only R1 and R2 from the eight-finding review. R3-R8 remain unresolved and are not claimed fixed: stopped/pending configuration recovery, shutdown ordering, native WSL-networking review, WSL/native runtime ownership reuse, and verified ownership release/transfer. The PR remains draft.
Why This Change Was Made
Keep llama-server under the human user and let the isolated Gateway infer over authenticated loopback. Artifact acquisition itself does not start inference or configure the Gateway. Single-use, window-scoped consent binds the reviewed Gateway, endpoint, model and port; existing mutation and verification owners perform the continuation.
Provider/fallback policy remains in the coordinator, while transport adapters and
LocalAiGatewayLifecycleown native execution and exact Gateway/device binding. Mutations use atomicconfig.patchwithbaseHash; uncertainty never authorizes blind replay or cleanup.Connection recovery no longer calls explicit Start.
LocalAiNativeBindingStorepersists running intent separately from ownership, and the runtime operation gate prevents an automatic resume queued behind Stop from undoing it.SetupAccessDraftowns the existing-native Settings route;WindowManagerinitializes only newly created setup windows.Appremains the composition root.Evidence
Pushed
c0fa1ebfat the user's request while the full closeout run is still in progress. Focused R1/R2 checks passed: 69 SetupEngine tests and 85 runtime lifecycle tests (1 skipped). A subsequently added legacy-receipt compatibility assertion is included in the pending full run. The runtime test explicitly queues Resume behind Stop, proves no second process start, then proves explicit Start works.Before R1/R2, the duplicate-flow changes passed the full Release build, Shared/Tray/SetupEngine suites, three focused WinUI failure/no-replay tests and strict MXC: 10,246 passed, 36 skipped in total. That is prior-delta evidence, not final R1/R2 closeout.
The duplicate-flow review findings were fixed. The user cancelled further dual-model review. A bounded single-model R1/R2 correctness check is pending. No current-head visible completion or real native Stop/reconnect proof is claimed.
Historical managed inference on
98522a49returnedMANAGED_NATIVE_LOCAL_AI_OKfrom the isolated account; unauthenticated discovery returned HTTP 401. Historical chooser diagnostics proved placement before the final subtle styling. These do not substitute for current-head proof.Change Type
Scope
winnodeRequired proof pools
windows-11-arm64: ARM64 Windows llama.cpp acquisition, launch and inference.windows-winui-interactive: native setup and existing-native Settings flow.windows-wsl-mxc: real Gateway-to-Windows-node containment regression proof.windows-wsl-gateway-e2e: shared setup and Gateway configuration behavior.windows-wsl-dgx-blackwell: shared runtime and existing WSL/Blackwell lifecycle regression coverage.Validation
Commands use
OPENCLAW_REPO_ROOTfor this worktree and isolated tray test data. Final-head results are pending unless explicitly marked otherwise.dotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj --no-restore --filter 'FullyQualifiedName~NativeLocalAiLifecycleTests|FullyQualifiedName~SetupAccessDraftTests' --verbosity quiet: 69 passed before adding the legacy-receipt assertion.dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore --filter 'FullyQualifiedName~LocalAiPortLifecycleTests' --verbosity quiet: 85 passed, 1 skipped, including the new Stop/queued-Resume regression.powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\build.ps1 -Configuration Debug: pending in closeout run.dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restore --verbosity quiet: pending final rerun; prior duplicate-flow delta: 4,222 passed, 35 skipped.dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restore --verbosity quiet: pending final rerun; prior duplicate-flow delta: 3,856 passed.dotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj --no-restore --verbosity quiet: pending final rerun; prior duplicate-flow delta: 2,147 passed, 1 skipped.dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restore --verbosity quiet: pending final full rerun.$env:OPENCLAW_E2E_GATEWAY_VERSION='2026.9.4'; powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\scripts\validate-mxc-e2e.ps1 -NoBuild -Configuration Debug -RuntimeIdentifier win-arm64 -ResultsDirectory <session-files>\r1-r2-mxc-results: pending final rerun, with no skip override. Prior duplicate-flow delta: 18 passed, all three required proofs.dotnet test .\tests\OpenClaw.Tray.UITests\OpenClaw.Tray.UITests.csproj -c Release -r win-arm64 --no-restore -p:BuildProjectReferences=false --filter 'FullyQualifiedName~LocalAi_InstalledContinuationRefreshNeverRepeatsTheMutation|FullyQualifiedName~LocalAi_AdmissionFailureRequiresExplicitUseAfterAuthorizationRecovers' --verbosity quiet: 3 passed on the duplicate-flow delta, before R1/R2.git diff --check: passed before commit.Real Behavior Proof
c0fa1ebf; full closeout pending. The currently running manual Release app contains the duplicate-flow fixes, but predates R1/R2.Stop_QueuedAutomaticResumeCannotOverrideStopButExplicitStartCanblocks withdrawal, queues Resume, completes Stop, then explicitly starts again.Yes/No/N/A): N/A; no newly uploaded artifacts.Security Impact
Yes/No): No.Yes/No): Yes.Yes/No): Yes.Yes/No): No new node or MCP command.Yes/No): Yes.Yes, explain the risk and mitigation: the isolated Gateway receives a Local AI API key through authenticated configuration RPC. The human-side key is current-user DPAPI protected, excluded from the portable receipt, supplied through child environment, and redacted from logs. HTTP clients require loopback. Mutations require the exact target/device/generation, admin scope and coherent CAS revision. Uncertain writes preserve ownership and external edits.Compatibility and Migration
Yes/No): Yes; WSL transport remains available, and old ownership receipts default to their prior automatic recovery behavior.Yes/No): Yes; native selection persists its ownership receipt and running intent, and configures only the owned provider, primary model and optional allowlist entry.Yes/No): No.Review Conversations