Skip to content

feat: change the Local AI model in settings and choose the Gateway default model - #1744

Merged
larroy merged 18 commits into
openclaw:mainfrom
larroy:feat/local-ai-model-settings
Nov 4, 2026
Merged

larroy merged 18 commits into
openclaw:mainfrom
larroy:feat/local-ai-model-settings

Conversation

@larroy

@larroy larroy commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: changing the Local AI model sends users through the full setup wizard, and settings has no place to choose the Gateway's default model.

User Impact

User impact: users can change the Local AI model directly on the Local AI page, either by picking a catalog model that fits their PC or by pasting a public Hugging Face GGUF. A new Model section in settings groups Default model (choose the Gateway's default, including Local AI) with Local AI.

  • Earlier model downloads stay in the Hugging Face cache, so switching back only re-verifies them.
  • Only public, non-gated, single-file GGUF models are accepted.
  • A model that may exceed GPU memory needs an explicit Switch anyway.
  • While Local AI is installed, a cloud default must be a provider/model id with a single slash, because Local AI's existing fallback rule rejects others. The page explains this instead of saving.

Why This Change Was Made

  • In-place switch: the new model is downloaded and verified while the current one keeps serving. The runtime then withdraws the old Gateway route, saves the new receipt, and restarts if it was running. If the new model does not start, the previous receipt is restored and restarted.
  • Custom models: a pasted reference (owner/repo, owner/repo:Q4_K_M, a file path, or a huggingface.co / hf.co link) is pinned to a commit revision plus its Git LFS SHA-256 and size. Layers, KV heads, head size and trained context are read from the GGUF header without downloading the weights. The catalog's capacity rules then choose a context tier. Custom installs use a new schema-6 receipt that carries this recipe.
  • Default model: writes agents.defaults.model.primary with a partial config.patch. When Local AI is installed it also records the choice as Local AI's fallback, so a later Local AI start or stop leaves the Gateway consistent.
  • The wizard route for model changes (ShowLocalAiModelSetup) is removed. Retry setup still opens the existing setup flow.
  • A second commit fixes a freeze found while testing: verifying an already-downloaded 16 GB model reported progress after every 1 MiB read, and the page redrew everything for each report. Progress now reaches the UI at most every 100 ms (step changes immediately), and only the progress text and bar redraw.

Evidence

  • Live Hugging Face resolution (throwaway test, removed):
    • unsloth/Qwen3-0.6B-GGUF:Q4_K_M pinned Qwen3-0.6B-Q4_K_M.gguf at 50968a44…, 28 layers, 40,960 context.
    • unsloth/Qwen3-8B-GGUF:Q4_K_M gave 5,027,784,512 bytes and SHA-256 120307ba…49bd4, matching the Hub's file listing.
    • A bare repo link defaulted to the Q4_K_M file; a /blob/ link to a Q8_0 file resolved that file.
  • Isolated app, local MCP: app.navigate with model and with local-ai both reached the new pages, and the sidebar shows the Model header with both items.
  • Freeze regression test: with the old per-report delivery restored it counted 16,390 full refreshes; with the fix it stays in single digits.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • windows-winui-interactive: new Default model page, new Local AI model controls, and a new Settings sidebar section.
  • windows-11-arm64: developed and launched only on a Windows ARM64 host.
  • windows-wsl-gateway-e2e: Local AI route withdrawal, rebind, and default-model writes go through the Gateway.

Validation

  • ./build.ps1: all projects built and documentation validation passed on the feature commit (d4ed57a7). After the progress fix, the WinUI step could not copy its DLLs because a running Companion instance (started by setup) held them; dotnet build of OpenClaw.Tray.WinUI.csproj into a separate output folder succeeded with 0 errors.
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: 4331 passed, 36 skipped.
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore: 4095 passed.
  • dotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj with OPENCLAW_REPO_ROOT set: 2344 passed, 1 skipped.
  • dotnet test ./tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj: 1585 passed, 5 skipped, 1 failed. The failure, LocalAiApiCredentialStoreTests.ConcurrentCreationConvergesOnOneCredential, is in code this PR does not touch and passed when rerun alone.
  • OpenClaw.Tray.UITests builds with -r win-arm64.

Real Behavior Proof

  • Environment tested: Windows 11 ARM64, NVIDIA RTX Spark N1X, isolated tray profile with local MCP enabled (no Gateway connected, Local AI not installed in that profile).
  • PR head or commit tested: navigation and rendering on d4ed57a7; the switch-freeze report came from the developer's own Local AI install.
  • Exact steps or command run: winnode --command app.navigate --params '{"page":"model"}' and --params '{"page":"local-ai"}', then window captures. Model-card states were rendered with synthetic hardware in a throwaway UI test.
  • Evidence after fix: {"navigated": true, "page": "model"} and {"navigated": true, "page": "local-ai"}; captures show the Model header with Default model and Local AI, and the fit-warning card reading "It needs about 41.7 GB of GPU memory and NVIDIA RTX 4080 has 16.0 GB."
  • Observed result: both pages render their disconnected / not-installed states correctly; the custom box and "Switch anyway" render as designed.
  • Screenshot or artifact links verified? (Yes/No/N/A): N/A. Screenshots were taken locally and are not attached.
  • Not verified or blocked:
    • A complete real switch (download, restart, chat reply) on current head.
    • Setting the Gateway default model against a live Gateway, including whether it accepts a partial config.patch.
    • Native and WSL route rebind against a real Gateway.
    • The progress fix inside the running app, since the Companion instance locked the build output.

Security Impact

  • New permissions or capabilities? (Yes/No): No
  • Secrets or tokens handling changed? (Yes/No): No
  • New or changed network calls? (Yes/No): Yes
  • Command or tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any answer is Yes, explain the risk and mitigation: custom model resolution calls the Hugging Face API (/api/models/<repo>/revision/<rev> and /tree/<sha>) and reads the GGUF header from /resolve/<sha>/<file>. It uses the existing Hugging Face HTTPS policy, now shared as HuggingFaceHttp: the first request must go to huggingface.co, redirects may only reach huggingface.co or hf.co hosts, and URLs must be credential-free. No token is sent, so gated or private repos are rejected. Downloaded weights are verified against the pinned size and SHA-256 before use, as for catalog models. The Default model page writes Gateway config only when the operator connection has write scope.

Compatibility and Migration

  • Backward compatible? (Yes/No): Yes
  • Config or environment changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • If yes, list the exact upgrade steps: Existing schema 3, 4 and 5 receipts are read unchanged. Schema 6 is written only for custom models, so an older build cannot read a custom-model install; catalog installs are unaffected.

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge.

What this changes

This PR adds in-place Local AI model switching, Gateway default-model selection, and provider management in Settings.

Example: Replace Qwen3.8 27B with unsloth/Qwen3-0.6B-GGUF:Q4_K_M.

  • Before: Change model reopens setup.
  • After: Settings acquires the replacement in place and tests running-model inference before completing the switch.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Meaningful live model-switch evidence and connection-binding repairs improve confidence, but durable recovery and user-visible correctness defects prevent landing.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🧂 unranked krab (1/6) Security review found an item that needs attention.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Changing a managed local model requires reopening setup, and Settings lacks direct default-model and provider management.
Reason: The collaborator-authored direction establishes owner approval and provides clear user value without another product decision.

Merge readiness

⛔ Blocked before merge - 14 items remain

Keep open: this collaborator-authored feature remains useful and absent from main, but nine existing correctness findings still block merging despite green CI.

Priority: P2
Reviewed head: 16d1644b7c06436feaa28656ec511afb5d0bbf05

Before merge

  • Add real behavior proof - Authority-chain proof required: credited ARM64 production-component output establishes replacement loading, failure/timeout rollback, and restored inference, and the native Settings report establishes an allowed default-model apply; supply current-head rejection before final configuration or credential I/O after Gateway reassignment and operator-session revocation/replacement, including queued writes and retained answers, plus native/WSL rebind and fallback outcomes and mounted provider interaction. Historical screenshots show intermediate states only. Screenshots, recordings, redacted logs, or live output are acceptable; redact IPs, API keys, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Admit cloud writes from durable ownership evidence (P1) - A native binding can remain Pending while manifest loading fails and the runtime publishes Failed/None with Unknown model evidence. HasManagedInstall then returns false, so the direct primary-write branch bypasses the lifecycle Pending guard. A new cloud primary can strand the retained provider and recovery receipt. Determine admission from durable binding ownership even when artifact evidence is unavailable.
  • Journal the cloud-primary transition before dispatch (P1) - For a stopped native install with fallback anthropic/claude-sonnet-5, changing to openai/gpt-6 can persist remotely before a lost reply, crash, or receipt-save failure. The receipt retains the old fallback and configuration hash, while the absent provider and new primary satisfy neither recovery alternative. Subsequent Start/Stop rejects reconciliation. Persist transition intent before network I/O and settle uncertain outcomes through the lifecycle.
  • Publish and confirm Local AI selection on healthy WSL runtimes (P2) - If another operator changes the Gateway primary to cloud while the WSL-managed listener remains healthy at the same endpoint, EnsureStartedAsync refreshes the existing listener and WSL CompleteStartAsync performs no publication. This path reports Local AI applied while new conversations still use cloud. Publish through the lifecycle owner and confirm the exact primary before reporting success.
  • Forward provider state changes to the mounted page (P2) - The page subscribes only to the parent view model, and the parent never forwards Providers.PropertyChanged. An authStatus reply arriving after model/config refresh leaves the card showing Loading; provider selection retains old controls, and sign-in questions require an unrelated parent update to appear. Subscribe to child notifications with UI dispatch and matching teardown.
  • Show connection-loss errors in the model settings flows (P2) - GatewayConnectionLostException derives from OperationCanceledException and escapes this filter when config.get or a Local AI operation loses its connection. AsyncEventHandlerGuard treats it as cancellation without populating the page error. ModelProviderSetupViewModel.IsExpected likewise excludes connection loss during key and sign-in requests. Handle connection loss separately from caller cancellation and show reconnect or uncertain-outcome recovery guidance.
  • Preserve running intent changed during runtime acquisition (P2) - wasRunning is captured before acquisition. During InstallingRuntime, which the page treats as noncancelable, the user can navigate to Default model and choose a cloud default, stopping the old runtime through a page that does not share the switcher's busy gate. The stale true value later restarts Local AI and overrides that newer choice. Preserve current running intent under runtime transaction ownership immediately before replacement.
  • Check rollback startup before claiming recovery (P2) - If replacement loading fails and restarting the restored installation returns a Failed snapshot, that result is ignored and the user is told Local AI went back to the previous model. EnsureStartedAsync reports ordinary startup failures through its return value, so no exception is required. Check the returned state and surface failed recovery with an actionable next step.
  • Reject incomplete Hugging Face listings explicitly (P3) - When the twentieth tree response still advertises another page, this loop returns the partial listing as complete. An explicitly requested GGUF on page 21 is reported missing, and automatic file selection can overlook candidates. Resolve explicit paths directly or report the pagination limit before selecting from incomplete results.
  • Localize the new model-settings validation errors (P3) - In a French or Chinese installation, choosing an owned Local AI fallback such as openrouter/meta/llama-5 displays this English literal directly through DefaultModelStatusText.Text. Root AGENTS.md requires native error copy in .resw resources with every supported language updated. Return a presentation error identifier and resolve localized copy in the page.
  • Resolve security concern: Verify retained wizard authority through credential persistence - No current bypass is established: the repaired client rejects detected Gateway and epoch changes, but supplied evidence does not exercise administrator revocation during an admitted provider wizard before the production credential-store effect.
  • Resolve merge risk - The PR owner must establish that a retained provider wizard cannot persist credentials after its administrator authority is revoked; connection fencing alone does not establish authorization at the Gateway's final credential-write boundary.
  • Improve patch quality - Add final-effect proof that Gateway reassignment and operator-session revocation invalidate queued configuration writes and retained provider answers before configuration or credential I/O.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P1] Admit cloud writes from durable ownership evidence — src/OpenClaw.Tray.WinUI/Presentation/DefaultModelPageViewModel.cs:194
  • [P1] Journal the cloud-primary transition before dispatch — src/OpenClaw.Tray.WinUI/Services/LocalAiGatewayLifecycle.cs:294-296
  • [P2] Publish and confirm Local AI selection on healthy WSL runtimes — src/OpenClaw.Tray.WinUI/Presentation/DefaultModelPageViewModel.cs:172-179
  • [medium] Verify retained wizard authority through credential persistence — src/OpenClaw.Tray.WinUI/Services/ModelProviderGatewayService.cs:198

Tests

  • Missing end-to-end proof: Current-head mounted provider interaction, Gateway authorization rejection, native/WSL routing, and released-state interrupted transitions remain unproven; the remaining defects also need demonstrated base-fail/head-pass regressions.
Agent review details

How this fits together

Settings supplies model choices and credentials to authenticated Gateway services; the Local AI runtime coordinates verified downloads, processes, durable installation receipts, and route ownership.

flowchart LR
A[Settings pages] --> B[Presentation owners]
B --> C[Model switcher]
C --> D[Verified model cache]
C --> E[Local AI runtime]
E --> F[Receipts and route lifecycle]
B --> G[Authenticated Gateway client]
F --> G
Loading

Technical review

Best possible solution:

Complete model transitions through the existing runtime and lifecycle owners, preserving durable ownership, current user intent, recoverable receipts, and visible localized outcomes.

Do we have a high-confidence way to reproduce the issue?

Main retains the setup-based model-change route, and the remaining patch failures follow concrete source paths; this read-only review ran no reproduction.

Is this the best way to solve the issue?

The approved in-place direction is worthwhile, but its smallest complete implementation must keep authenticated identity, durable receipts, current running intent, Gateway routing, and visible results consistent.

Full review comments:

  • [P1] Admit cloud writes from durable ownership evidence — src/OpenClaw.Tray.WinUI/Presentation/DefaultModelPageViewModel.cs:194
    A native binding can remain Pending while manifest loading fails and the runtime publishes Failed/None with Unknown model evidence. HasManagedInstall then returns false, so the direct primary-write branch bypasses the lifecycle Pending guard. A new cloud primary can strand the retained provider and recovery receipt. Determine admission from durable binding ownership even when artifact evidence is unavailable.
    Confidence: 0.99
  • [P1] Journal the cloud-primary transition before dispatch — src/OpenClaw.Tray.WinUI/Services/LocalAiGatewayLifecycle.cs:294-296
    For a stopped native install with fallback anthropic/claude-sonnet-5, changing to openai/gpt-6 can persist remotely before a lost reply, crash, or receipt-save failure. The receipt retains the old fallback and configuration hash, while the absent provider and new primary satisfy neither recovery alternative. Subsequent Start/Stop rejects reconciliation. Persist transition intent before network I/O and settle uncertain outcomes through the lifecycle.
    Confidence: 0.99
  • [P2] Publish and confirm Local AI selection on healthy WSL runtimes — src/OpenClaw.Tray.WinUI/Presentation/DefaultModelPageViewModel.cs:172-179
    If another operator changes the Gateway primary to cloud while the WSL-managed listener remains healthy at the same endpoint, EnsureStartedAsync refreshes the existing listener and WSL CompleteStartAsync performs no publication. This path reports Local AI applied while new conversations still use cloud. Publish through the lifecycle owner and confirm the exact primary before reporting success.
    Confidence: 0.99
  • [P2] Forward provider state changes to the mounted page — src/OpenClaw.Tray.WinUI/Pages/DefaultModelPage.xaml.cs:40-45
    The page subscribes only to the parent view model, and the parent never forwards Providers.PropertyChanged. An authStatus reply arriving after model/config refresh leaves the card showing Loading; provider selection retains old controls, and sign-in questions require an unrelated parent update to appear. Subscribe to child notifications with UI dispatch and matching teardown.
    Confidence: 0.99
  • [P2] Show connection-loss errors in the model settings flows — src/OpenClaw.Tray.WinUI/Presentation/DefaultModelPageViewModel.cs:155-158
    GatewayConnectionLostException derives from OperationCanceledException and escapes this filter when config.get or a Local AI operation loses its connection. AsyncEventHandlerGuard treats it as cancellation without populating the page error. ModelProviderSetupViewModel.IsExpected likewise excludes connection loss during key and sign-in requests. Handle connection loss separately from caller cancellation and show reconnect or uncertain-outcome recovery guidance.
    Confidence: 0.99
  • [P2] Preserve running intent changed during runtime acquisition — src/OpenClaw.SetupEngine/LocalAiModelSwitcher.cs:217-221
    wasRunning is captured before acquisition. During InstallingRuntime, which the page treats as noncancelable, the user can navigate to Default model and choose a cloud default, stopping the old runtime through a page that does not share the switcher's busy gate. The stale true value later restarts Local AI and overrides that newer choice. Preserve current running intent under runtime transaction ownership immediately before replacement.
    Confidence: 0.98
  • [P2] Check rollback startup before claiming recovery — src/OpenClaw.SetupEngine/LocalAiModelSwitcher.cs:269-270
    If replacement loading fails and restarting the restored installation returns a Failed snapshot, that result is ignored and the user is told Local AI went back to the previous model. EnsureStartedAsync reports ordinary startup failures through its return value, so no exception is required. Check the returned state and surface failed recovery with an actionable next step.
    Confidence: 0.99
  • [P3] Reject incomplete Hugging Face listings explicitly — src/OpenClaw.SetupEngine/HuggingFaceModelReferenceResolver.cs:114-116
    When the twentieth tree response still advertises another page, this loop returns the partial listing as complete. An explicitly requested GGUF on page 21 is reported missing, and automatic file selection can overlook candidates. Resolve explicit paths directly or report the pagination limit before selecting from incomplete results.
    Confidence: 0.99
  • [P3] Localize the new model-settings validation errors — src/OpenClaw.Tray.WinUI/Presentation/DefaultModelPageViewModel.cs:197
    In a French or Chinese installation, choosing an owned Local AI fallback such as openrouter/meta/llama-5 displays this English literal directly through DefaultModelStatusText.Text. Root AGENTS.md requires native error copy in .resw resources with every supported language updated. Return a presentation error identifier and resolve localized copy in the page.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d50e57913465.

Merge-risk options

Maintainer options:

  1. Verify authorization at the final effect (recommended)
    The PR owner should demonstrate allowed writes and rejection after Gateway reassignment or operator-session revocation, including retained provider answers before credential persistence.

Provenance checked

  • Model-change setup route changes intended behavior with a stated reason (a14dc72: Expose model changes through existing setup while retaining Gateway replacement confirmation; this PR explicitly replaces that broad route with an in-place transaction.)
  • Verified Hugging Face cache and HTTPS policy keeps the original intent (7dab793: Reuse verified cache artifacts while preserving compatibility copies, recovery, and verification leases; the HTTP extraction retains existing redirect restrictions.)
  • Manifest construction keeps the original intent (6e37e7b: Carry verified additional assets into persisted recipes; the extracted factory shares that mapping between setup and switching.)
  • Channel configuration envelope keeps the original intent (c417cba: Use atomic config.patch with a coherent configuration and concurrency hash; the extracted parser preserves that mapping.)

Testing

Proof path: shipped entry point.

Security

Needs attention: Connection-bound sends address the reported replacement-Gateway disclosure paths, while authorization at final credential persistence remains unproven.

Evidence

Security concerns:

  • [medium] Verify retained wizard authority through credential persistence — src/OpenClaw.Tray.WinUI/Services/ModelProviderGatewayService.cs:198
    No current bypass is established: the repaired client rejects detected Gateway and epoch changes, but supplied evidence does not exercise administrator revocation during an admitted provider wizard before the production credential-store effect.
    Confidence: 0.97

What I checked:

Likely related people:

  • Joel: Raw commit ccd64bb adds src/OpenClaw.SetupEngine/LocalAiSetupSteps.cs:41 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ccd64bbb7d68; files: src/OpenClaw.SetupEngine/LocalAiSetupSteps.cs)
  • Karen: Raw commit 7dcbc2f adds src/OpenClaw.Tray.WinUI/Services/LocalAiGatewayLifecycle.cs:14 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7dcbc2f798a8; files: src/OpenClaw.Tray.WinUI/Services/LocalAiGatewayLifecycle.cs)
  • Pedro Larroy: Raw commit c2ce4f5 adds src/OpenClaw.SetupEngine/LocalAiSetupSteps.cs:59 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c2ce4f50eb63; files: src/OpenClaw.SetupEngine/LocalAiSetupSteps.cs)
  • Scott Hanselman: Raw commit 7dab793 adds src/OpenClaw.SetupEngine/HuggingFaceModelInstaller.cs:80 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7dab793673ff; files: src/OpenClaw.SetupEngine/HuggingFaceModelInstaller.cs)

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a useful Settings feature with significant pre-merge defects, rather than an urgent regression already shipped by this PR.
  • merge-risk: 🚨 compatibility: Installation receipts and durable ownership change, and interrupted cloud transitions can leave existing installations unable to reconcile.
  • merge-risk: 🚨 auth-provider: The patch changes Gateway primary models, Local AI fallback routing, and provider credential flows.
  • merge-risk: 🚨 security-boundary: Retained provider sign-in authority crosses into Gateway credential persistence without supplied final-effect revocation proof.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦐 gold shrimp and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-16T19:50:20.902Z sha 389d724 :: needs real behavior proof before merge. :: [P1] Serialize journal settlement with the active model-switch commit
  • reviewed 2026-10-22T16:16:11.144Z sha b236684 :: needs real behavior proof before merge. :: [P1] Reject unresolved native routing before writing a cloud primary | [P2] Publish the Local AI selection for an already healthy WSL listener
  • reviewed 2026-10-22T21:40:50.103Z sha a77048c :: needs real behavior proof before merge. :: [P1] Reject unresolved native routing before writing a cloud primary | [P2] Publish Local AI selection for an already healthy WSL listener
  • reviewed 2026-10-28T19:49:02.308Z sha 017cf3c :: needs real behavior proof before merge. :: [P1] Verify replacement inference before ending rollback protection | [P1] Bind deferred default-model writes to the admitted Gateway | [P1] Admit cloud writes from durable ownership evidence | [P1] Journal the cloud-primary transition before dispatch | [P1] Keep provider wizard requests on their original connection | [P2] Publish and confirm Local AI selection on healthy WSL runtimes
  • reviewed 2026-11-02T21:24:23.514Z sha 4523e43 :: needs real behavior proof before merge. :: [P1] Verify replacement inference before ending rollback protection | [P1] Bind deferred default-model writes to the admitted Gateway | [P1] Admit cloud writes from durable ownership evidence | [P1] Journal the cloud-primary transition before dispatch | [P1] Keep provider wizard requests on their original connection | [P2] Publish and confirm Local AI selection on healthy WSL runtimes
  • reviewed 2026-11-03T15:11:57.283Z sha e20618b :: needs real behavior proof before merge. :: [P1] Bind deferred default-model writes to the admitted Gateway | [P1] Admit cloud writes from durable ownership evidence | [P1] Journal the cloud-primary transition before dispatch | [P1] Keep provider wizard requests on their original connection | [P2] Publish and confirm Local AI selection on healthy WSL runtimes | [P2] Forward provider state changes to the mounted page
  • reviewed 2026-11-03T20:38:52.071Z sha d00452b :: needs real behavior proof before merge. :: [P1] Admit cloud writes from durable ownership evidence | [P1] Journal the cloud-primary transition before dispatch | [P1] Keep provider wizard requests on their original connection | [P2] Publish and confirm Local AI selection on healthy WSL runtimes | [P2] Forward provider state changes to the mounted page | [P2] Show connection-loss errors in the model settings flows
  • reviewed 2026-11-04T00:33:11.100Z sha 7711079 :: needs real behavior proof before merge. :: [P1] Admit cloud writes from durable ownership evidence | [P1] Journal the cloud-primary transition before dispatch | [P2] Publish and confirm Local AI selection on healthy WSL runtimes | [P2] Forward provider state changes to the mounted page | [P2] Show connection-loss errors in the model settings flows | [P2] Preserve running intent changed during runtime acquisition

Reviewed November 3, 2026, 11:42 PM ET / November 4, 2026, 04:42 UTC (Revision 10).

@larroy

larroy commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the review findings in the latest commit.

  • [P1] Binding and manifest recover together: RebindModelAsync now records the previous model in gateway-binding.json (RebindFrom) before the manifest is saved. Every manifest load settles that record to whichever model the manifest names. A failed manifest save settles it back immediately. Covered by NativeLocalAiLifecycleTests.RebindModel_InterruptedCommitSettlesToTheCommittedManifest (both outcomes) and LocalAiPortLifecycleTests.ReplaceInstall_ManifestSaveFailureSettlesBindingBackToPreviousModel.
  • [P2] Fallback scoped to the owning Gateway: the Default model page changes Local AI's fallback, or stops Local AI, only when the active Gateway is the one Local AI is bound to. On other Gateways it writes only that Gateway's default. Covered by CloudChoiceOnGatewayThatDoesNotOwnLocalAi_WritesOnlyThatGateway.
  • [P2] Fallback receipts stay consistent: the lifecycle receipt is written first and is idempotent, and the manifest only after it. A rejected update leaves the manifest unchanged, and a retry repairs both. Covered by SetGatewayFallback_RejectedLifecycleLeavesManifestAndRetryRepairsBoth.
  • [P2] Provider sign-in: models whose provider still needs sign-in are listed as disabled, with a localized note, and CanApply refuses them. Covered by ChoiceWhoseProviderNeedsSignIn_IsListedButCannotBeApplied.
  • [P2] Thrown start failures: a start that throws after the switch commits now takes the same rollback as a start that returns a failure. FailedStart_RestoresPreviousReceiptAndRestarts covers both.
  • Data-model compatibility: the developer's real schema-4 state.json, written by the released app, loads unchanged on this branch. A temp copy was used, and it resolved catalog model qwen3.6-35b-a3b-mtp-q4-k-m with its recorded ctx-262144-f16 profile, leaving the file byte-identical. Schema 3, 4 and 5 loading is also covered by the existing LocalAiManifestMigrationTests and the Bolt schema-5 tests. Schema 6 is written only for custom models.

Validation on this head:

  • ./build.ps1: all builds succeeded; documentation validation passed.
  • Shared.Tests: 4331 passed, 36 skipped.
  • Tray.Tests: 4098 passed.
  • Connection.Tests: 1588 passed, 5 skipped.
  • SetupEngine.Tests: 2347 passed, 1 skipped.

Still not verified: a complete real switch against a connected native or WSL Gateway.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 16, 2026
@larroy
larroy requested review from joelagnel, karkarl and shanselman and removed request for joelagnel and shanselman October 16, 2026 20:06
@larroy

larroy commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

I verified complete real switch against a connected native
Screenshot 2026-10-16 at 11 19 18 AM

@larroy

larroy commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author
Screenshot 2026-10-16 at 11 19 26 AM

@larroy
larroy force-pushed the feat/local-ai-model-settings branch from 389d724 to 852bd82 Compare October 16, 2026 23:54
@karkarl

karkarl commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Hanselman review: HOLD_FOR_AUTHOR

#1744 (feat: change the Local AI model in settings and choose the Gateway default model)

Code review complete; not merge-ready. Reviewed head 852bd8219bbd3768279a2b11f8b924248bd5b8df, base and merge base a259c5668fe4658c26baff30940185c77e8f47a3. Both reviewers inspected the complete 71-file patch plus affected owners, callers and tests. Compared with ClawSweeper's reviewed predecessor 389d724ceebd560e1ef2977a26594cb1be25d07c, the current PR production/test blobs are unchanged; the scoped delta only adds an unrelated base-layer architecture row.

Independent reviewers: claude-opus-5.5, high reasoning and gpt-6-astra, high reasoning, long_context. Both received the same full prompt and hashed patch. The supported read-only code-review task type replaced unavailable rubber-duck; no model substitution or helper-isolation claim.

HIGH consensus

Issue Opus 5.5 GPT-6 Astra Fix Confidence
Stale ownership observation can split durable receipts. LocalAiGatewayLifecycle.cs:62-65 settles the journal using installation A loaded before hardware/file awaits. If replacement has journaled A-to-B but not committed manifest B, observation restores binding A and clears the journal. Manifest B then commits without a remaining recovery journal. Startup and rollback reject the mismatch. Keep observation read-only and serialize recovery with the full receipt commit, using a fresh durable manifest. Add a deterministic concurrent-observation regression. HIGH HIGH 80%

LOW consensus

These were independently flagged by one model and verified against the pinned source by the coordinator.

Issue Opus 5.5 GPT-6 Astra Fix Confidence
New model selection reuses an incompatible retired runtime. LocalAiModelSwitcher.cs:121-126 replaces the qualified runtime with any installed runtime in the same family, including b10655/b11026. Current recipe minimums require newer builds. Upgrade to the compatible current pin or reject before acquisition; test a released legacy receipt. HIGH not flagged 90%
Nested custom GGUF paths download successfully but cannot install. HuggingFaceModelReference.cs:95-96 accepts subfolders, which the resolver and hub cache preserve. After verification, the mandatory legacy-copy path rejects any filename containing a slash. Support the path consistently or reject before download, and test the real installer rather than only parsing. MEDIUM not flagged 90%
Cloud selection writes before rejecting pending native ownership. DefaultModelPageViewModel.cs:169-189 bypasses runtime handoff when the owned listener is Failed rather than Healthy. After a landed publication with a lost reply, it changes the primary, then the pending binding rejects fallback persistence. The retained provider no longer matches recovery's expected primary. Block unresolved routing before dispatch, or reconcile through the runtime owner. not flagged MEDIUM 90%
Choosing Local AI can report success while WSL keeps the cloud default. DefaultModelPageViewModel.cs:143-155 only ensures listener health. An already-healthy unchanged WSL listener is not republished after its Gateway primary was changed externally. Apply selection through the existing lifecycle owner and verify the resulting primary before success. not flagged MEDIUM 90%

Rejected/disputed concerns: Opus withdrew two original findings after bounded evidence checks. Recovery suppression after a failed offline switch follows explicit teardown's fail-closed policy and is recoverable through explicit Start. The proposed mid-download Default model navigation race is not demonstrated: leaving Local AI cancels acquisition, and its own Start/Stop buttons are disabled while busy. These remain LOW (disputed), not accepted defects or independent agreement. Existing HTTPS/digest checks, bounded GGUF parsing and partial guarded config patches did not establish additional defects. Missing authority proof alone is not a security vulnerability.

Prior repairs: Ordinary cross-Gateway fallback scoping, lifecycle-first fallback persistence, provider sign-in gating, thrown-start rollback and sequential journal recovery are present. The previously reported concurrent journal race remains. The new pending-primary-write finding is distinct from the repaired manifest-write ordering.

Validation and remaining proof

Inspected exact-head CI run 38983839552 and its logs: CI Gate succeeded, with 17 successful and 7 conditionally skipped check runs. Logs report Shared 4403 passed/1 skipped, Connection 1662/1, Tray 4105/0 and SetupEngine 2358/1; the focused switching/default-model tests executed. Hosted setup/connect reports 40 passed/7 skipped. These are inspected CI results, not locally executed tests or independent TRX validation. No builds, tests or runtime operations were run by this read-only review.

Both author screenshot links resolve and were visually inspected: native starting state and replacement verification while the old router runs. They support connected intermediate native UI behavior. They do not show final replacement inference, Default model application, rollback or authority rejection, and precede the current-head force push without source/binary attribution. The author's reported complete native switch is acknowledged, not treated as fully evidenced or absent.

Remaining gates:

  • windows-winui-interactive: current-head mounted default-model apply/auth/error states; catalog/custom switching, fit override, cancellation/rollback, responsive progress and successful completion.
  • windows-wsl-gateway-e2e: changed WSL withdrawal/rebind, fallback/default writes and exact-model inference. Also provide corresponding real native-Gateway transactions and rejection before writes after identity/session changes; ordinary WSL setup CI is not proof of these new paths.
  • windows-11-arm64: retain the author-declared current-build native launch/architecture and model-switch/inference proof. Artifact compilation and older screenshots are insufficient.
  • Compatibility: demonstrate released receipt/ownership preservation through interrupted switching, plus legacy-runtime selection. Reported byte-identical schema-4 loading does not establish this transaction.

Decision: HOLD_FOR_AUTHOR. Take confidence: 35%. Recommendation confidence: 98%. Author should repair the five accepted defects, add focused regressions and supply current-head proof. GitHub also currently reports merge conflicts. No source, GitHub metadata, reviews, comments or runtime state were changed.

@larroy
larroy force-pushed the feat/local-ai-model-settings branch 2 times, most recently from 872c165 to 5e59325 Compare October 20, 2026 04:11
@larroy

larroy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Fix: serialize the model-rebind journal with the manifest commit (5e59325)

Addresses the review finding "Stale ownership observation can split durable receipts" (ClawSweeper P1 "Serialize journal settlement with the active model-switch commit").

Problem

ReplaceInstallAsync journaled A→B in gateway-binding.json (RebindFrom), released the binding lease, then saved manifest B. LocalAiGatewayLifecycle.ObserveOwnershipAsync could run in that window. It used an install snapshot that SetupLocalAiHost.ObserveAsync loaded before probing, so it still named A. It settled the binding back to A and cleared the journal. Manifest B then committed with no journal left. Native startup and rollback then rejected the A-binding/B-manifest mismatch.

Fix

  • Observation is read-only again. If ObserveOwnershipAsync finds a journaled rebind, it returns NativeLocalAiOwnershipState.Unavailable ("check again, nothing has been changed"). It doesn't settle the journal or call the Gateway. Foreign-Gateway bindings are still reported as DifferentOwner.
  • One lease for the whole switch. ILocalAiEndpointLifecycle.RebindModelAsync is replaced by CommitModelRebindAsync(previous, next, commitManifest, ct). The lifecycle holds the binding lease while it writes the journal, runs the manifest save callback and clears the journal. Another lease holder can only see a journal if a commit was interrupted by a crash. If the save throws, the binding is restored to the previous model and the exception is rethrown. The lock order is binding lease, then manifest write lock. Nothing takes them in the reverse order.
  • Crash recovery reads the manifest under the lease. SettleModelRebindAsync now takes a loader (_manifestStore.LoadAsync) and calls it while holding the lease. The outcome follows the durable manifest, not a caller's snapshot. SettleRebindBestEffortAsync is removed.

Tests (NativeLocalAiLifecycleTests, LocalAiCustomModelReceiptTests, LocalAiPortLifecycleTests)

  • An observation that runs during a commit leaves the journal to the commit. The binding bytes don't change, there are no Gateway writes, and the switch completes on B.
  • An observation of a journal left by a crash returns Unavailable and leaves the file unchanged.
  • A failed manifest commit restores the previous model and its allowlist flag.
  • An interrupted commit settles to whichever manifest was committed, for both A and B.

Not verified: a real native model switch against a live Gateway.

@larroy
larroy force-pushed the feat/local-ai-model-settings branch from 5e49646 to 434a8f7 Compare October 20, 2026 15:45
@larroy

larroy commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased onto main (12789b4) and removed the duplicate IOperatorGatewayClient.AdvertisedServerMethods that conflicted with #1968; CI is green on 16d1644.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 4, 2026
@larroy larroy added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Nov 4, 2026
@larroy

larroy commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator Author

Real behaviour proof:

Tested with native gateway and WSL. Works well changing models between vllm custom endpoint and openrouter.

Screenshot 2026-11-03 205354 Screenshot 2026-11-03 205257 Screenshot 2026-11-03 205241 Screenshot 2026-11-03 205207 Screenshot 2026-11-03 205151

larroy added 17 commits November 3, 2026 22:46
Replace the Local AI "Change model" wizard route with in-page selection:
a dropdown of catalog models that fit this PC plus an optional custom
Hugging Face GGUF reference (owner/repo, owner/repo:QUANT, file path, or
huggingface.co/hf.co link).

- Custom models are pinned to a commit revision and LFS SHA-256, sized
  from the GGUF header, and stored as a schema-6 receipt carrying the
  recipe. Oversized models require explicit "Switch anyway".
- LocalAiModelSwitcher downloads and verifies while the current model
  serves; ILocalAiRuntime.ReplaceInstallAsync withdraws the old route
  before committing the new receipt, and a failed start restores the
  previous one. Prior weights stay in the Hugging Face cache.
- Hub sidebar gains a "Model" header with a new Default model page and
  the existing Local AI page. Default model writes
  agents.defaults.model.primary via config.patch and keeps the Local AI
  fallback in sync.
- Remove IAppCommands.ShowLocalAiModelSetup and its window-manager route.
…ndow freezing

Verifying an already-downloaded model reports progress after every 1 MiB
read (about 15,700 reports per pass for a 16 GiB GGUF). The Local AI page
queued a full-page refresh on the UI thread for each one, so the window
stopped responding during "Verifying the download".

CoalescingSwitchProgress delivers byte updates at most once per 100 ms,
delivers phase changes immediately, and keeps at most one UI update queued
(carrying the latest value). Byte-only updates now raise SwitchProgress and
refresh just the progress text and bar instead of the whole page.
…odel writes

Address the review findings on the in-place model switch and the Default
model page:

- Native binding and manifest now recover together. RebindModelAsync
  journals the previous model in gateway-binding.json (RebindFrom) before
  the manifest commit; every manifest load settles the journal to whichever
  model the manifest names, and a failed manifest save settles it back at
  once.
- Fallback updates write the lifecycle receipt first and are idempotent,
  so a retry after a rejected or partial update repairs both receipts.
- The Default model page changes Local AI's fallback (and stops Local AI)
  only when the active Gateway is the one Local AI is bound to.
- Models whose provider still needs sign-in are listed but cannot be made
  the default.
- A start that throws after the switch commits now gets the same rollback
  as a start that returns a failure.
Ownership observation no longer settles a journaled rebind from a stale installation snapshot; it reports Unavailable and stays read-only. CommitModelRebindAsync holds the binding lease across journal, manifest save and journal clear, and crash recovery settles against the manifest read under that lease.
The model switcher reused any installed runtime in the same family, including the retired b10655/b11026 pins, which predate the minimum llama.cpp builds of the current recipes. Reuse only the exact runtime the new plan qualified; otherwise install the current pin side by side.
…lder

The hub cache already stored nested relative paths, but the mandatory legacy copy treated the whole path as one filename and failed after the download.
…nconfirmed

The Default model page wrote the cloud primary before the fallback update checked the native receipt, so a pending publication left a primary that recovery could not settle. The primary write now runs inside the receipt lease after a Pending check with no same-value shortcut.
A switch that outlives navigation (past its cancelable phases) could be followed by a second switch from a new Local AI page, which loaded a stale rollback baseline and could overwrite or undo the newer choice. LocalAiModelSwitcher now claims a single-flight slot before reading the receipt and rejects concurrent calls; IsSwitching/IsSwitchingChanged keep every page busy until the switch ends, then reload the installed plan.
The selection was made before the ComboBox template applied, so WinUI left the closed selection box blank. Re-select once the page loads, and keep the options instance across refreshes with unchanged content so the selector is not cleared and rebuilt.
Settings > Default model gains an Add a model provider card: save an API key
(models.authSetApiKey) or sign in (models.authLogin + wizard.next/cancel,
rendered with the shared ProviderSetupDialog) for Gateway providers listed by
models.authStatus, or add a custom OpenAI/Anthropic-compatible endpoint under
models.providers.<id> with a guarded config.patch. The chat model picker links
to that page. Features are gated on admin scope and advertised methods.
Gateway setup stores the configured agent's own primary (agents.entries.<id>.model), which the Gateway prefers over agents.defaults.model.primary. The page wrote and showed only the defaults primary, so new chats kept the setup model. Show the default agent's effective model and remove its own primary in the same config.patch; after a successful Local AI start or hand-back, remove it too.
…cess

A running model switch returned success as soon as the router reported
Healthy, but the router starts with load-on-startup = false, so health
never proved the new weights could load. A CUDA OOM or unsupported
GGUF passed the switch and failed on the first chat, after rollback
protection had ended.

A running switch now succeeds only after the new model answers one
bounded inference request and the router reports that exact model as
Loaded, mirroring setup's VerifyLocalAiInferenceStep. A failed or
timed-out load takes the existing rollback path and restores the
previous receipt. Stopped-runtime commits remain start-free and
check-free, and the restored previous model starts without a load
check.

The load budget is bounded by OPENCLAW_LOCAL_AI_SWITCH_LOAD_TIMEOUT
(whole seconds, 30 to 3600, default 600 matching setup's first-load
budget). A new non-cancelable LoadingModel phase covers the post-commit
wait and is localized in all six languages. The public switcher ctor now
takes the gateway API key provider so the verification request carries
the same auth as the router.

Validation: dotnet test SetupEngine (17/17 switcher tests, 2549/2553
total), Shared 4828/4852, Tray 4830/4830, ./build.ps1 all green. The
three rollback regression cases fail on the old Healthy-only branch.
Live switch proof blocked: no completed Local AI install on this host.
…d Gateway

A cloud default chosen while Local AI owns the route waits behind the runtime gate, and the queued config.patch used to resolve whatever Gateway was current at that point. Bind every default-model write, including default-agent cleanup, to the admitted Gateway id, operator client and connection epoch before the first await. Recheck that binding before config.get, after its reply and after a failed patch, and send only on the captured epoch through new connection-bound client APIs. A changed Gateway or session now fails closed, so the Local AI receipt and manifest fallback stay unchanged.
…t started on

Each models.authLogin flow is now bound by BeginLogin to its client, connection epoch and Gateway id. wizard.next and wizard.cancel recheck that binding and are sent only on the captured epoch, so a retained answer is never transmitted to a replacement Gateway or session. A lost binding retires the flow permanently and the page reports that the connection changed.
…d admit them from the saved receipt

SetPrimaryAndFallbackModelAsync now records the target as LocalAiNativeBinding.UnconfirmedPrimary before the Gateway write. Every lifecycle Gateway config read (start, stop, release, model switch) settles it to the primary the Gateway shows, so a lost reply, crash or failed receipt save no longer leaves the route needing manual reconciliation.

The Default model page now treats a saved native ownership receipt for the active Gateway as ownership even when the Local AI install cannot be loaded, so cloud choices always go through the runtime's Pending guard instead of a direct primary write.
…e model settings change

Applies the AGENTS.md module documentation rule: each production C# file changed on this branch starts with a header describing what it owns, with a usage example of its main entry points, and its primary type and cross-module methods carry XML summaries. Comments only.
@larroy
larroy force-pushed the feat/local-ai-model-settings branch from b40041b to c6e8b13 Compare November 4, 2026 07:32
@larroy
larroy requested a review from shanselman November 4, 2026 07:46
DefaultModelPage only observed DefaultModelPageViewModel, so ModelProviderSetupViewModel changes (provider selection, catalog load, sign-in dialog steps) rendered only on the next unrelated refresh. Re-raise them as Providers.
@larroy

larroy commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Data-model compatibility proof

This PR changes two persisted Local AI files. Both additions are optional members, so data written by earlier builds still loads.

Stored file Change Proof
manifest.json (install receipt) New optional customModel member and new schema 6. Schemas 3, 4 and 5 are unchanged. StoredCatalogManifestWithoutCustomModelStillLoadsResolvesAndPlans: a catalog receipt with no customModel (schema 3) loads, resolves through LocalAiInstalledModel.Resolve, and builds the launch plan.
gateway-binding.json (native Gateway ownership receipt) New optional RebindFrom and UnconfirmedPrimary fields. StoredBindingWithoutRebindOrUnconfirmedPrimaryLoadsAndRoundTrips: the previous build's JSON, written by hand, loads with the old fields intact and the new ones null, and save then load gives the same record.

Existing tests that already cover this: Save_SchemaFourManifestOmitsAdditionalAssetFieldsFromJson (new writes of older schemas keep the old shape) and Load_DoesNotTriggerCacheMigration (a schema 3 receipt keeps its schema on load).

Results: both new tests pass. Full OpenClaw.Connection.Tests run: 1711 passed, 3 failed, 1 skipped. The 3 failures are in the Store-migration PowerShell checker area (StoreMigrationPackagePresenceTests, MigrationRecordTests), not in Local AI. I did not compare against a clean checkout.

Not covered: downgrade (an older build reading a file this PR wrote). The binding file should be fine because System.Text.Json ignores unknown members by default. Older builds reject a schema 6 receipt as unsupported, which is expected for a new schema.

The new tests are in tests/OpenClaw.Connection.Tests/LocalAiStoredDataCompatibilityTests.cs. They are not yet committed or pushed to this branch.

@larroy
larroy merged commit b6edc5e into openclaw:main Nov 4, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants