Repository navigation
fix(local-ai): clarify unavailable Local AI setup states (clean replacement for #1204) - #1263
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 28, 2026, 9:35 AM ET / 13:35 UTC. ClawSweeper reviewWhat this changesThe PR adds localized Local AI availability and retry states to onboarding and the Tray Local AI Hub, with guarded setup controls and accessibility updates. Merge readinessKeep this collaborator PR open. The current head has one concrete P2 localization defect: an introduced Local AI model selector suffix remains English outside en-US. Priority: P2 Review scores
Verification
How this fits togetherA host hardware probe determines whether Local AI can run and feeds that result into onboarding and the Tray Hub. Those UI surfaces then enable setup actions or show recovery guidance. flowchart LR
A[Host hardware probe] --> B[Eligibility evaluation]
B --> C[Availability state]
C --> D[Setup wizard]
C --> E[Tray Local AI Hub]
D --> F[Setup actions]
E --> G[Runtime management]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Format the recommended-model marker through a dedicated onboarding resource in every supported locale, then retain the existing locale-neutral eligibility boundary. Do we have a high-confidence way to reproduce the issue? Yes. Select any non-English supported locale and reach the eligible-hardware model selector: the introduced code unconditionally appends the English word "Recommended". Is this the best way to solve the issue? No. The availability UI is otherwise localized, but this direct display suffix bypasses the same resource boundary; a localized format/key and regression coverage are the narrow repair. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 56a169f5b71e. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What 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
History |
Salvage the reviewable diff from PR #1204 (karkarl-refine-local-ai-setup-ux) onto current main. PR #1204's branch carries unrelated already-landed history from a stale base; this replaces it with the true contribution computed from the merge-base (911f368) to the PR head (568db5c). - share Local AI eligibility diagnostics between setup and the Hub via LocalInferenceEligibilityDiagnostics and LocalAiSetupAvailabilityCoordinator - place unavailable Local AI guidance above dependent setup content, using the native InfoBar action slot so "See why" stays independently usable - gray and disable unavailable setup choices while preserving controls for an already installed managed runtime - hide Local AI-only progress groups when Local AI is unavailable while keeping the WSL installation stage active - keep incomplete/failed Local AI probes retryable - localize new setup/Hub copy (en-us, fr-fr, nl-nl, zh-cn, zh-tw) - add focused coordinator, view-model, and UX contract tests Co-authored-by: Copilot App <[email protected]>
RefreshAvailabilityAsync queued its UI-thread state application via ApplyOnUiThread, then unconditionally cleared _availabilityCancellation in its own finally block. When the dispatcher genuinely defers the callback (a real DispatcherQueue.TryEnqueue does not run inline), the finally block raced ahead and nulled the field before the queued callback ran, so the callback's own IsCurrentAvailabilityProbe guard failed against itself and silently dropped a completed probe result (success or failure). Apply the result and clear the cancellation together, inside the single dispatched callback, gated by one currency check, so a delayed dispatch can no longer race the clear. Add delayed-dispatcher tests that hold the dispatcher's queued callback back (RecordingUiDispatcher with HasThreadAccess=false, RunEnqueuedImmediately=false) and prove both a successful and a failed probe are still applied once the callback finally runs. Update the existing publishes-change test: the failed-probe result and the recheck-availability unlock now land in one notification instead of two, so the prior "error but not yet rechecked" transient state is no longer produced. Co-authored-by: Copilot App <[email protected]>
ShowLocalAiAvailabilityChecking unconditionally set _config.LocalAi.Enabled to false and reset SkipWizard as soon as an availability check started, before the probe had a result. A preconfigured or restored setup session with Local AI already opted in silently lost that selection the moment a recheck began, even when the machine turned out to be eligible. Keep the toggle in sync with the current config value instead of forcing it off, and stop mutating LocalAi.Enabled/SkipWizard during the transient "checking" state; only a completed probe should change the selection. Also keep the hardware and WSL networking probe results in local variables until CanApplyLocalAiAvailability confirms the check is still current, so a stale/superseded generation cannot write over page state (matches the same currency-check-before-assignment pattern used elsewhere in this method). Extend LocalAiSetupUxContractTests with source-shape assertions for both fixes. Co-authored-by: Copilot App <[email protected]>
Two follow-up fixes from structured review: - ShowLocalAiUnavailable never called UpdatePrimaryButtonState after turning LocalAi.Enabled off, unlike its sibling ShowLocalAiProbeUnknown and ShowLocalAiAvailabilityChecking. This was latent on main because the checking state always forced the toggle off first; now that checking preserves the configured toggle value, a definitive-unsupported result reached from an enabled toggle could leave the primary setup button disabled with no way to continue without Local AI. Call UpdatePrimaryButtonState() to match the sibling methods. - LocalAiPageViewModel.RefreshAvailabilityAsync evaluated device eligibility against the currently selected/installed model ID. A selection-specific failure (a model removed from the catalog, or one that no longer fits) was reported as the *device* being unavailable, which also disabled CanRetrySetup, the action needed to switch to a different compatible catalog model. Evaluate eligibility for the best catalog model this hardware can run instead of pinning to the current selection. Add a regression test proving a stale/unknown selected model ID no longer blocks qualified hardware from reporting available and retry-setup-eligible. Co-authored-by: Copilot App <[email protected]>
…pported Two more follow-ups from structured review, same bug class in both the setup page and the tray Hub page: Both InitializeLocalAiReviewAsync (CapabilitiesPage) and RefreshAvailabilityAsync (LocalAiPageViewModel) folded every non-null eligibility failure into a single "definitively unsupported" outcome. LocalInferenceEligibility.Evaluate can also return FailureCode.HardwareFactsIncomplete without throwing, for example when an NVML read comes back partial or transient (missing stable GPU ID, driver version, or CUDA capability) rather than because the device truly cannot run Local AI. Folding that into "unsupported" permanently disabled the option and hid the Recheck affordance the rest of this change exists to provide, exactly like the thrown-probe-failure path already avoids doing. Route HardwareFactsIncomplete through the same retryable path used for a thrown probe failure (TryApplyProbeFailure / ShowLocalAiProbeUnknown on setup, hasAvailabilityProbeError on the Hub view model) instead of TryApplyUnsupported / a definitive IsLocalAiAvailable=false, so recheck stays available. Add a regression test proving incomplete hardware facts read as a retryable probe error, and extend the setup contract test to assert the new branch shape. Co-authored-by: Copilot App <[email protected]>
…able CanChangeModel did not check IsSetupAvailable, unlike its sibling CanRetrySetup, so an installed (Verified/Loaded) model kept the Change Model action live even after a definitive unsupported-hardware probe result. ChangeModel() routes into the same onboarding flow as RetrySetup(), so a device that cannot run Local AI at all should not offer a live path back into that setup, while runtime management (start/stop/restart/logs) correctly remains available for the existing installation. Add a regression assertion proving CanChangeModel and ChangeModel() are blocked once hardware is confirmed unsupported. Co-authored-by: Copilot App <[email protected]>
ClawSweeper review flagged that all new Local AI availability copy from
this salvage was hardcoded English: the CapabilitiesPage InfoBar
title/message/action, the checking and probe-error state titles/messages
and accessibility help text, and the detailed diagnostic reason shown in
the setup dialog and the Hub tip.
Shared stays locale-neutral: LocalInferenceEligibilityDiagnostics now
returns a LocalInferenceUnavailableReason (a kind enum plus plain facts —
model name, required/detected GPU memory in GB, driver version) instead
of a formatted English sentence.
Each UI owner localizes at its own boundary:
- OpenClaw.SetupEngine.UI has no .resw files and cannot reference the Tray
app project (circular), so it gets its own small SetupLocalization
helper that resolves resource keys against the same merged app resource
map the Tray app's LocalizationHelper reads (the existing
x:Uid="Onboarding_LocalAi_RecheckAvailabilityButton" binding already
relies on this). CapabilitiesPage.xaml.cs now routes every checking/
probe-error/unavailable title, message, help-text, and the "why
unavailable" dialog through SetupLocalization; the InfoBar action
("See why") gets an x:Uid.
- LocalAiPageViewModel (source-linked into OpenClaw.Tray.Tests without a
WinUI resource host) now exposes the locale-neutral
LocalInferenceUnavailableReason instead of a formatted string, so it
stays testable without LocalizationHelper. LocalAiPage.xaml.cs (the
View, which already has full WinUI/LocalizationHelper access) formats
it into localized text, matching the existing ResourceKey-on-ViewModel/
format-in-View pattern already used for engine/model/gateway status.
Add resource keys to all five supported locales (en-us, fr-fr, nl-nl,
zh-cn, zh-tw) and localization regression coverage: a contract test
proving the setup page's checking/probe-error/unavailable copy and
dialog route through SetupLocalization (not hardcoded English) with
matching keys in every locale, and a test proving the shared diagnostics
stay fact-only while both UI owners localize the same reason kinds.
Update existing tests that asserted on formatted English text to assert
on the locale-neutral Kind instead.
Co-authored-by: Copilot App <[email protected]>
Structured review caught a gap in the prior localization commit: the Welcome page's "Local AI available" badge text and the accessible name AutomationProperties.SetName appends to the install choice when Local AI is detected were still hardcoded English, so every non-English locale showed and announced English copy on this path. Route the badge text through x:Uid, and have the accessible name append the same localized fragment (via SetupLocalization, reading it from the current AutomationProperties.Name instead of duplicating the base sentence as a second hardcoded literal). Extend SetupLocalization with the same "Key.Property" -> "Key/Property" XAML resource-path fallback LocalizationHelper already uses, so the code-behind accessible name can share the exact resw entry the x:Uid binding resolves for the visible badge instead of a duplicate key. Add resw entries for all five locales and regression coverage: a contract test proving the badge and accessible name route through SetupLocalization with a matching key in every locale, and a source test proving SetupLocalization implements the same XAML-property fallback shape as LocalizationHelper. Co-authored-by: Copilot App <[email protected]>
ShowLocalAiProbeUnknown unconditionally set _config.LocalAi.Enabled to false whenever a probe failure was reported, even though that state is retryable rather than definitive (matches ShowLocalAiAvailabilityChecking before an earlier fix in this same series). If Local AI was already selected (e.g. after navigating back to review, or loading a preconfigured session) and a transient probe failure occurred, the toggle was forced off; a subsequent successful recheck then initialized from the already-cleared value, so a successful recovery silently left Local AI unselected. Preserve the toggle from the current config value, matching the checking state's behavior, so only a definitive ShowLocalAiUnavailable result clears the selection. Co-authored-by: Copilot App <[email protected]>
0290231 to
50f6a84
Compare
…ecking progress - CapabilitiesPage/WelcomePage: gate availability on device-level LocalInferenceEligibility.Evaluate(hardware), reconciling a stale or removed SelectedModelId to a valid/recommended model instead of hiding the badge or marking a capable device unavailable (Codex HIGH). - CapabilitiesPage: localize the remaining .wslconfig inspection failure reason through SetupLocalization (Codex MEDIUM). - LocalAiPageViewModel: guarantee the availability probe CTS is disposed on every stale/non-enqueued/rejected callback path via a new ApplyAvailabilityResultOnUiThread wrapper, and release the current-probe slot (not just dispose the token) when the dispatcher refuses the enqueue, so the ViewModel is never stuck reporting IsCheckingAvailability or throws ObjectDisposedException on a later deactivate/cancel (Codex LOW, hardened after a second-pass review finding on the rejected-enqueue path). - CapabilitiesPage.UpdatePrimaryButtonState: do not block Continue at step 3 while Local AI availability is merely Checking/Unknown; only a concrete negative/busy result gates forward progress. The install stage already tolerates Local AI resolving unavailable later, so this closes a dead end where neither the toggle nor Continue could be used (Opus HIGH). - LocalAiPage (Hub): distinguish a definitive unavailable result from a probe-unknown/checking state with a different localized title and severity, and show explicit checking/recheck progress (progress ring, checking title/message) instead of silently hiding all availability chrome while a probe is in flight (Opus MEDIUM x2). - SetupLocalization/LocalAiPageViewModel/CapabilitiesPage: replace Debug.WriteLine (compiled out in Release) with a release logger path so probe/localization failures remain diagnosable (Opus LOW). - LocalAiPageViewModel.RecheckAvailability: enforce CanRecheckAvailability in the command itself, not only in UI binding (Opus LOW). - WelcomePage: make the Local AI badge's accessible-name suffix idempotent across repeated detections and raise a live-region automation event so it is announced (Opus LOW). - Add regression coverage: device-eligibility gating and stale-model reconciliation, checking-state visibility, recheck command gating, step-3 non-dead-end, Hub title/severity distinction, Welcome accessible-name idempotency, and rejected-enqueue CTS release. Co-authored-by: Copilot App <[email protected]>
|
Pushed a new commit (
Full details and the updated validation/proof are in the PR description above. Requesting fresh review (ClawSweeper/Codex/Opus) on |
Summary
Clean replacement for #1204 (
karkarl-refine-local-ai-setup-ux), built directly on currentmain. That branch's history mixes unrelated, already-landed commits with the real contribution, so this PR recomputes the true diff (merge-base911f3686to PR head568db5c1) and rebases it onto today'smaininstead of rewriting/force-pushing the original branch. Rebased twice more since asmainkept advancing on the same files (#1203,#1254, and others); each rebase was validated fresh.LocalAiSetupAvailabilityCoordinatorand locale-neutralLocalInferenceEligibilityDiagnosticsInfoBar.ActionButtonkeeps See why independently usable and on the message lineWhat changed vs. #1204 (retained vs. discarded)
Retained (all 24 files, ~1.6k LOC): the entire real contribution from #1204 applies here, nothing was dropped as "already landed" or unrelated. Verified by grepping current
mainfor the PR's new symbols (LocalAiSetupAvailabilityCoordinator,IsLocalAiOnlyGroup,LocalInferenceEligibilityDiagnostics,LocalAiUnavailablePanel) before starting: none existed, confirming every touched file carries a real, non-trivial diff againstmain.Discarded: only the stale, already-merged commits that #1204's branch carried from its outdated base (e.g. #1111, #1226, #1229, #1210, #1230, #1234, already on
mainindependently). None of that reappears here.Fixed beyond #1204's last pushed head, all covered by focused tests:
DispatcherQueue.TryEnqueuegenuinely deferred the callback; the result is now applied and the probe's cancellation released together, gated by one currency check.ShowLocalAiUnavailablewas missing theUpdatePrimaryButtonState()call its siblings had).CanChangeModel, added independently bymain's fix(local-ai): model setup unavailable after install #1254 while this branch was being rebased, didn't checkIsSetupAvailablelikeCanRetrySetupdoes).ShowLocalAiProbeUnknown, the sibling of fix Rename MoltBot to OpenClaw across entire codebase #2 above): a transient failure unconditionally clearedLocalAi.Enabled, so a successful recheck afterward initialized from the already-cleared value instead of restoring the prior selection.Each fix has a dedicated regression test.
Round 2 (external Codex + Opus review on this PR)
CapabilitiesPage/WelcomePagenow gate device availability onLocalInferenceEligibility.Evaluate(hardware)first, then reconcile the configuredSelectedModelIdseparately: a model that no longer exists in the catalog, or exists but this specific hardware cannot install at all (!CanInstall, i.e. trulyUnsupported, not merelyEligibleButBusy), falls back to the recommended/device-eligible model instead of leaving setup stuck on a stale or hardware-incompatible selection.WelcomePage's badge is evaluated device-only (no model parameter)..wslconfigfailure reason localized (Codex MEDIUM) throughSetupLocalizationacross all 5 locales.LocalAiPageViewModelnow guarantees the probe'sCancellationTokenSourceis released/disposed exactly once on every path (dispatched apply, non-enqueued, rejected-enqueue, or already-disposed/inactive), usingInterlocked.Exchange/CompareExchangeso a worker thread releasing the token can never race the UI thread'sCancelAvailabilityRefresh()into a double-cancel/double-dispose.RecheckAvailability()also now enforces its ownCanRecheckAvailabilitygate instead of only the weaker "not already in flight" check.LocalAiOptionContent.IsHitTestVisible, which a naive re-enable of just the toggle's ownIsEnabledwould not undo) so turning Local AI off is always an escape hatch. Continue's own gate is unchanged and never bypasses eligibility or an as-yet-undetermined WSL networking-consent decision merely because availability is still pending.SetupLocalization/probe failure diagnostics now useTrace.TraceWarning, notDebug.WriteLine(Opus LOW), sinceDebug.WriteLineis compiled out entirely in Release builds;Traceis not, and its default listener reaches DebugView/ETW.LiveRegionChangedautomation event (with peer creation forced, since one may not exist yet) announces the change.Localization (fix #8)
OpenClaw.Shared'sLocalInferenceEligibilityDiagnosticsnow returns aLocalInferenceUnavailableReason(a kind enum plus plain facts: model name, required/detected GPU memory in GB, driver version) instead of a formatted English sentence, keeping Shared locale-neutral. Each UI owner localizes at its own boundary:OpenClaw.SetupEngine.UIhas no.reswfiles of its own and cannot reference the Tray app project (which references it, so the reverse would be circular). It gets a small newSetupLocalizationhelper that resolves resource keys against the same merged app resource map the Tray app'sLocalizationHelperalready reads (the existingx:Uid="Onboarding_LocalAi_RecheckAvailabilityButton"binding relies on the same mechanism).CapabilitiesPage.xaml.csnow routes every checking/probe-error/unavailable title, message, help text, the "why unavailable" dialog, the.wslconfiginspection failure, and the Welcome-page badge/accessible name through it.LocalAiPageViewModel(source-linked intoOpenClaw.Tray.Testswithout a WinUI resource host) exposes the locale-neutralLocalInferenceUnavailableReasoninstead of a formatted string, so it stays testable withoutLocalizationHelper.LocalAiPage.xaml.cs(the View, which already has full WinUI/LocalizationHelperaccess) formats it into localized text, including the new checking/probe-unknown title distinction — matching the existing resource-key-on-ViewModel / format-in-View pattern already used for engine/model/gateway status.Resource keys were added to all five supported locales (en-us, fr-fr, nl-nl, zh-cn, zh-tw), and localization regression coverage was added: contract tests proving the setup page's checking/probe-error/unavailable copy, the "why unavailable" dialog, the Welcome-page badge/accessible name, and the Hub's checking/probe-unknown titles all route through
SetupLocalization/LocalizationHelper/x:Uid(not hardcoded English) with matching keys in every locale; a test proving the shared diagnostics stay fact-only while both UI owners localize the same reason kinds; and a source test provingSetupLocalizationimplements the same "Key.Property" → "Key/Property" XAML-resource fallbackLocalizationHelperalready uses.Owner boundary (why all these files are one cohesive change)
Everything here belongs to a single seam: "is Local AI available, and does the UI correctly reflect, escape, and localize that during checking/unsupported/error states."
LocalAiSetupAvailabilityCoordinator,LocalInferenceEligibilityDiagnostics, andSetupLocalizationare the shared policy/diagnostics/localization layer;CapabilitiesPage/WelcomePage/ProgressPageare the setup-time consumers;LocalAiPage/LocalAiPageViewModelare the Hub-time consumer; the.reswfiles are the copy for both; the test files are 1:1 with the production files they cover.Concurrency note
Fetched and diffed against #1204's live head repeatedly during this work; its branch was never touched, read, or force-pushed. #1204 should be closed/superseded only after this PR is reviewed, green, and ready.
Validation
Full, untargeted
OpenClaw.Tray.Testsrun: still blocked in this environment (hangs with no test output after ~6 minutes; reproduces the same way on a clean pre-fix checkout, so it is a pre-existing environmental blocker in this sandbox, not a regression from this change). Recommend a maintainer/CI run of the full untargeted suite before merge.Real behavior proof
WelcomeInstallLocalGatewayChoice-> "Recommended" + "Local AI available").openclaw://hub/local-aiin an isolated data dir with no prior config.NotInstalledstate renders correctly, no spurious unavailable banner, "Retry setup or download" enabled, engine/model status all correct, confirming no regression on the common/available happy path.LocalAiPageViewModelTests/LocalAiSetupUxContractTestswith controlled fake hardware probes and dispatcher fakes.Review
autoreview(Codex, gpt-5.6-sol, high reasoning) was run to convergence across this round's fix cycles, each producing a real, verified bug (device/model eligibility gating, wslconfig localization, CTS ownership races across two hardening passes, the step-3 dead end plus its hit-test-visibility follow-up, the pending-state consent-bypass gap, a checking-notification ordering gap, and the model-eligibility reconciliation gap) that was fixed and covered by a new or updated regression test, then re-reviewed clean of that finding. One reviewer-reported finding (a claimed C# definite-assignment compile error for theeligibilitylocal on the device-ineligible path) was investigated and rejected:eligibilityis explicitly initialized tonullat declaration, and a from-scratchobj/binrebuild ofOpenClaw.SetupEngine.UIcompiles with 0 warnings/errors, confirming the finding does not reproduce.Not verified / blocked: full untargeted Tray suite (environmental hang, see above); WSL install E2E (would require actually installing a WSL distro on a shared host, skipped as out of scope for this validation pass; the setup-flow code paths are covered by the existing
SetupStepsTests/WslGlobalConfigManagerTests/LocalAiSetupUxContractTests).Supersedes #1204.