Skip to content

fix(local-ai): recommend Qwen3.8 with measured context profiles - #1281

Merged
shanselman merged 6 commits into
openclaw:mainfrom
joelagnel:fix/5090-test
Sep 3, 2026
Merged

shanselman merged 6 commits into
openclaw:mainfrom
joelagnel:fix/5090-test

Conversation

@joelagnel

@joelagnel joelagnel commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary - Recommend models by explicit generation priority, then select the largest fitting context and highest KV precision. - Add measured-conservative Qwen3.8 27B context profiles with F16 and Q8_0 KV fallbacks. - Persist the selected profile through setup and launch llama-server with its context and KV-cache settings. - Retire Qwen3.5 9B from new installs and reject 16 GiB GPUs, while keeping existing managed 9B installations launchable. - Show true binary GiB values. Default capacity examples: - RTX 5090 class (34,190,458,880 CUDA-visible bytes): Qwen3.8 27B, 192K, Q8_0. - 24 GiB: Qwen3.8 27B, 64K, F16. - 16 GiB: unsupported. Qwen3.5 9B is no longer selectable. Fixes #1280. ## Release blocker fixes (74b008fe) Two release blockers found in the earlier head 28092144 are fixed in this branch. 1. Implicit consent for the user-wide WSL change (security). 28092144 deleted the affirmative consent checkbox and set config.LocalAi.WslMirroredNetworkingConsent = config.LocalAi.Enabled, so merely enabling Local AI silently authorized a user-wide .wslconfig mirrored-networking rewrite and a global wsl.exe --shutdown that stops every running distribution. The checkbox, the _localAiNetworkingConsentRequired gate, the reset-on-state-change helper, and the Continue gate are restored. Enabling Local AI alone no longer grants consent, and Continue stays blocked until the box is checked whenever the change is actually required. The entire consent surface in CapabilitiesPage.xaml.cs is byte-identical to the pre-regression state. 2. Existing Qwen3.5 9B installs stranded on upgrade (compatibility). 28092144 deleted the 9B entry outright. Because the launch path resolves LocalModelCatalog.Find(manifest.ModelCatalogId) and throws when it returns null, every user with an existing managed 9B installation would have been unable to start Local AI after upgrading. The entry is now a hidden legacy catalog record: excluded from Models, ExplicitAlternatives, and Default, so it can never be offered, recommended, or newly installed, but resolvable through FindInstalled on the installed-receipt, launch, and display paths only. Its pins are reproduced exactly as installed, and it exposes only the native-context F16 profile a pre-profile install could have recorded, so nothing is remapped and a receipt that could never have existed still fails closed. ## Merge with current main (569ebeec) Regular merge of origin/main at 09bc834f, which includes #1253 (fix(local-ai): bound GPU admission by dedicated device memory), #1300, and #1302. No rebase or force push. Three conflicts, resolved as follows: - CapabilitiesPage.xaml.cs: comment-only conflict; took main's CUDA-read wording. - LocalAiInstallReconciler.cs: kept both sides. This branch's five profile receipt checks (context plus the four KV precisions) and #1253's new GpuIdsMatch helper, which replaced the previous ordinal SelectedGpuId comparison. - LocalInferenceQualificationTests.Evaluate_IgnoresLegacySharedMemoryFields: the one semantic conflict. #1253 owns the memory semantics, so shared/unified memory stays ignored and the 8 GiB dedicated GPU is Unsupported with 8 GiB detected and free. #1281 owns the catalog, so the unsupported-fallback plan is the smallest offered model. LocalInferenceSelector.SelectDefaultModelAndProfile falls back to Models.OrderBy(m => m.Weights.SizeBytes).First(), and Qwen3.8 27B (16,464,440,224 bytes) is smaller than Qwen3.6 27B (17,106,773,120) and Qwen3.6 35B-A3B (22,663,387,424), so the expectation is Qwen3.8 27B. This branch does not modify #1253's GPU-capacity contract. ## Required proof pools - windows-11-arm64: native ARM64 model selection and app launch behavior changed. - windows-wsl-dgx-blackwell: DGX/Blackwell model selection, setup, and fixed-prompt inference changed. - windows-winui-interactive: model details and the WSL consent prompt changed. ## Validation Current head: 8df3fb7c - .\build.ps1: passed, all projects and documentation validation succeeded. - dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj: 3,905 passed, 32 environment-gated skips. - dotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj: 2,829 passed. - dotnet test .\tests\OpenClaw.SetupEngine.Tests\OpenClaw.SetupEngine.Tests.csproj: 1,030 passed. - dotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj: 709 passed. - Rubber-duck review of the blocker fixes and of the merge resolution: no blocking issues. Regression coverage added for both blockers: - LocalAiWslNetworkingConsentTests proves that without consent the step returns FailedTerminal before applying anything: ApplyMirroredNetworking is never called, the .wslconfig bytes are unchanged, no backup is staged, and no shutdown is issued. A second case proves enabling Local AI alone does not satisfy the gate. - LocalAiSetupUxContractTests asserts the consent checkbox exists, that WslMirroredNetworkingConsent is never assigned from the enable toggle or a literal true, and that the Continue gate requires the checkbox. - LocalAiPortLifecycleTests.Router_LaunchesRetiredQwen9BInstallAfterUpgrade builds a manifest with the KV-precision fields stripped from disk, exactly as a pre-upgrade install would have been written, and proves it still resolves and launches. - LocalAiPortLifecycleTests.Catalog_DoesNotOfferRetiredQwen9BForNewInstalls proves the retired entry cannot re-enter selection. - LocalAiPortLifecycleTests.Router_RejectsRetiredQwen9BReceiptWithUnsupportedProfile proves compatibility did not become silent remapping. ## Real behavior proof Consent gate, live WinUI at this head. Setup was launched isolated on the consent step. Screenshot attached in the PR thread. - Local AI on, consent unchecked: warning panel shown with the full prompt ("Local AI needs mirrored WSL networking. Setup will update your global .wslconfig and stop all running WSL distributions once. No distributions are deleted. Save any work in WSL first.") and the checkbox "I understand and allow this global WSL change and one-time shutdown." "Install & set up" is disabled. - Checking the box: accessibility tree diff shows LocalAiNetworkingConsentCheckBox off -> on and PrimaryButton (disabled) -> enabled in the same action. - Toggling Local AI off and back on: the checkbox returns to off and "Install & set up" is disabled again, so re-enabling never silently re-grants consent. Consent deny changes nothing. The host .wslconfig SHA-256 was 5B5A9A4B...61542F0 with no running distributions before the run, and byte-identical with no running distributions after. The denied-consent path was exercised against a redirected temp config so the user's real global config was never a test subject. Selection and receipt behavior at this head, from a standalone harness built against this branch after the merge: Offered models (3): - qwen3.8-27b-mtp-ud-q4-k-m priority=400 default=True - qwen3.6-35b-a3b-mtp-q4-k-m priority=300 default=False - qwen3.6-27b-mtp-q4-k-m priority=200 default=False Find(qwen3.5-9b) offered for new installs: False FindInstalled(qwen3.5-9b) resolvable for existing installs: True RTX 5090 class (31.84 GiB): Eligible model=qwen3.8-27b profile=ctx-196608-q8_0 required=29.11 GiB 24 GiB class: Eligible model=qwen3.8-27b profile=ctx-65536-f16 required=23.58 GiB 16 GiB class: Unsupported (required 21.59 GiB) Retired Qwen3.5 9B install, KV fields stripped from the on-disk manifest: launch.ModelAlias = qwen3.5-9b-mtp-q4-k-m gateway primary model = llamacpp/qwen3.5-9b-mtp-q4-k-m ctx-size = 262144 / cache-type-k = f16 / cache-type-v = f16 RESULT: existing Qwen3.5 9B install launches after upgrade. Non-installable legacy profile: Rejected: "The managed local AI context and KV cache receipt do not match a qualified catalog profile." This reproduces the three capacity claims in the summary at the current head, after the #1253 merge. Not verified / blocked: - Hardware blocker: Qwen3.8 selection, download, launch, and fixed-prompt inference could not be recaptured at this head. The available validation host is a 16 GiB RTX 4080 SUPER, which this PR intentionally classifies as unsupported, so it cannot select or run the Qwen3.8 27B profile at all. This needs the windows-wsl-dgx-blackwell or RTX 5090 pool. - The earlier Windows model-selection proof was collected from integration head 38a172f1. Its quoted WSL warning string is superseded: that concise message came from the removed-consent build, and the affirmative checkbox prompt shown above is what ships here. ## Security and compatibility - The user-wide .wslconfig mirrored-networking rewrite and the one-time global wsl.exe --shutdown require explicit affirmative consent. Enabling Local AI does not imply it, and setup cannot proceed without it when the change is needed. - Existing manifests referencing the retired Qwen3.5 9B model ID keep launching from their own pinned receipt. Model artifacts are never silently remapped, and the retired model can never be newly installed. - No new permissions or credential handling are introduced.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. 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: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed September 2, 2026, 8:06 PM ET / September 3, 2026, 00:06 UTC.

ClawSweeper review

What this changes

This PR adds Qwen3.8 Local AI profiles selected from GPU capacity, persists the selected context and KV-cache settings, retires Qwen3.5 9B from new installs, and updates setup and tray presentation.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 7 items remain

Keep open. The branch has a concrete setup-recovery regression for existing Qwen3.5 9B installs, and it still needs current-head supported-GPU launch and inference proof plus maintainer confirmation of the model-versus-context recommendation policy.

Priority: P1
Reviewed head: 8df3fb7c17cfdbafde926dbe7474fb0c7e2315bd
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The PR has substantial implementation and focused coverage, but an upgrade-recovery defect and incomplete supported-hardware proof prevent merge confidence.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The current-head standalone harness exercises catalog selection and manifest-to-preset receipt handling, while the prepared screenshot is from an earlier integration head. The changed Qwen3.8 production path still lacks current-head supported-GPU download, llama-server launch, and fixed-prompt inference evidence; post redacted terminal output or logs should show that path and result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The current-head standalone harness exercises catalog selection and manifest-to-preset receipt handling, while the prepared screenshot is from an earlier integration head. The changed Qwen3.8 production path still lacks current-head supported-GPU download, llama-server launch, and fixed-prompt inference evidence; post redacted terminal output or logs should show that path and result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Legacy catalog split: The introduced catalog moves Qwen3.5 9B into a legacy-only collection; the public offered-model collection excludes it, while installed-receipt lookup uses a separate resolver.
Recovery requires the selected offered model: The selector resolves an explicitly requested model through the offered-only lookup, and setup recovery rejects a manifest whose model ID differs from the selected plan. A legacy 9B manifest therefore cannot be reused when setup selects the new default Qwen3.8 plan.
Recovery test gap: The reconciler tests cover a matching current catalog plan and GPU-ID migration, but do not cover a pre-profile Qwen3.5 9B manifest being recovered after this catalog change.
Findings 1 actionable finding [P1] Preserve legacy 9B setup recovery
Security None None.

How this fits together

Local AI combines detected NVIDIA GPU capacity with a pinned model catalog to choose a runnable profile. Setup persists that choice as an installation receipt, then llama-server consumes the receipt to start the local provider and the tray displays its state.

flowchart LR
  A[Detected NVIDIA GPU] --> B[Local AI eligibility]
  B --> C[Model and context profile]
  C --> D[Setup installation receipt]
  D --> E[llama-server launch preset]
  E --> F[Local provider]
  E --> G[Tray status]
Loading

Decision needed

Question Recommendation
Should default Local AI recommendation prioritize the Qwen3.8 model over a potentially larger context profile on older models? Adopt model-first recommendations: Keep Qwen3.8 as the default priority, document the tradeoff, and land after the recovery repair and supported-hardware proof.

Why: The linked open issue identifies this as a user-facing model-quality versus agent-context tradeoff, and the branch selects one policy without recorded maintainer approval.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The current-head standalone harness exercises catalog selection and manifest-to-preset receipt handling, while the prepared screenshot is from an earlier integration head. The changed Qwen3.8 production path still lacks current-head supported-GPU download, llama-server launch, and fixed-prompt inference evidence; post redacted terminal output or logs should show that path and result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Preserve legacy 9B setup recovery (P1) - Moving Qwen3.5 9B into the legacy-only collection lets the router launch its receipt, but setup recovery still selects through the offered catalog and requires the manifest model ID to equal that new plan. Re-running setup for a valid legacy install therefore terminates and tells the user to uninstall. Recover the receipt explicitly or migrate it with focused pipeline coverage.
  • Resolve merge risk (P1) - Existing Qwen3.5 9B installations can still launch directly, but re-running setup or installation recovery selects Qwen3.8 and terminates with an instruction to uninstall because the receipt no longer matches the selected plan.
  • Resolve merge risk (P1) - The new default deliberately trades context capacity for Qwen3.8 model priority, but the linked policy issue remains open and has no maintainer decision recorded.
  • Resolve merge risk (P1) - The current-head evidence does not run the newly qualified Qwen3.8 artifact through llama-server launch and fixed-prompt inference on supported hardware.
  • Complete next step (P2) - Repair legacy Qwen3.5 9B setup recovery, add the focused regression test, obtain redacted current-head supported-GPU launch and inference proof, and record maintainer approval of the recommendation policy before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P1] Preserve legacy 9B setup recovery — src/OpenClaw.Shared/Inference/Catalog/LocalModelCatalog.cs:241-263
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 33 files, +902/-151 lines The change spans catalog selection, persisted receipts, setup, runtime presentation, and tests.
Production versus tests production +460/-110, tests +442/-41 The substantial regression coverage is useful, but it does not cover legacy setup recovery.

Merge-risk options

Maintainer options:

  1. Repair legacy setup recovery (recommended)
    Allow a valid existing Qwen3.5 9B receipt to be recovered or migrated without requiring uninstall, and add a regression test through the setup pipeline.
  2. Accept a deliberate recovery break
    Land the current behavior only if maintainers explicitly accept that legacy users must uninstall before rerunning setup.
  3. Pause for policy and hardware proof
    Keep the branch open until the recommendation tradeoff is approved and a supported GPU exercises download, launch, and inference at the current head.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve recovery for a valid pre-profile Qwen3.5 9B manifest or add an explicit migration, then add focused setup-pipeline regression coverage.

Technical review

Best possible solution:

Preserve recovery for a valid legacy 9B receipt or provide an explicit, tested migration path, then land the approved recommendation policy with redacted supported-GPU launch and inference evidence.

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

Yes, from source: use a valid pre-profile Qwen3.5 9B manifest, rerun setup with no offered-model override, and recovery receives a Qwen3.8 plan that fails the exact manifest-model check. This review did not execute that write-producing setup path.

Is this the best way to solve the issue?

No. The direct launcher correctly resolves a legacy receipt, but setup recovery still rejects it; the branch also needs an approved policy for the capability-versus-context default.

Full review comments:

  • [P1] Preserve legacy 9B setup recovery — src/OpenClaw.Shared/Inference/Catalog/LocalModelCatalog.cs:241-263
    Moving Qwen3.5 9B into the legacy-only collection lets the router launch its receipt, but setup recovery still selects through the offered catalog and requires the manifest model ID to equal that new plan. Re-running setup for a valid legacy install therefore terminates and tells the user to uninstall. Recover the receipt explicitly or migrate it with focused pipeline coverage.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 09bc834fd4ae.

Labels

Label justifications:

  • P1: The introduced recovery path can block existing managed Local AI users from safely rerunning setup.
  • merge-risk: 🚨 compatibility: Retiring the offered 9B model conflicts with setup reconciliation for existing 9B receipts.
  • merge-risk: 🚨 availability: The new capacity profiles have not been proven through current-head launch and inference on supported hardware.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The current-head standalone harness exercises catalog selection and manifest-to-preset receipt handling, while the prepared screenshot is from an earlier integration head. The changed Qwen3.8 production path still lacks current-head supported-GPU download, llama-server launch, and fixed-prompt inference evidence; post redacted terminal output or logs should show that path and result. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Acceptance criteria:

  • [P1] ./build.ps1.
  • [P1] dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore.
  • [P1] dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore.
  • [P1] dotnet test ./tests/OpenClaw.SetupEngine.Tests/OpenClaw.SetupEngine.Tests.csproj --no-restore --filter FullyQualifiedName~LocalAiInstallRecoveryTests.
  • [P1] dotnet test ./tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj --no-restore --filter FullyQualifiedName~LocalAiPortLifecycleTests.

What I checked:

  • Legacy catalog split: The introduced catalog moves Qwen3.5 9B into a legacy-only collection; the public offered-model collection excludes it, while installed-receipt lookup uses a separate resolver. (src/OpenClaw.Shared/Inference/Catalog/LocalModelCatalog.cs:241, 8df3fb7c17cf)
  • Recovery requires the selected offered model: The selector resolves an explicitly requested model through the offered-only lookup, and setup recovery rejects a manifest whose model ID differs from the selected plan. A legacy 9B manifest therefore cannot be reused when setup selects the new default Qwen3.8 plan. (src/OpenClaw.SetupEngine/LocalAiInstallReconciler.cs:133, 8df3fb7c17cf)
  • Recovery test gap: The reconciler tests cover a matching current catalog plan and GPU-ID migration, but do not cover a pre-profile Qwen3.5 9B manifest being recovered after this catalog change. (tests/OpenClaw.SetupEngine.Tests/LocalAiInstallRecoveryTests.cs:468, 8df3fb7c17cf)
  • Proof artifact review: The prepared artifact is an older integration-head setup screenshot showing Qwen3.8 selection. The PR body separately reports current-head catalog and receipt harness output, but explicitly records that supported-GPU Qwen3.8 download, llama-server launch, and fixed-prompt inference were not captured at this head.
  • Prior Local AI ownership: History identifies the original managed Local AI implementation in commit ccd64bb, and current main includes the dedicated-memory admission change from merged PR 1253 at 09bc834. (src/OpenClaw.Shared/Inference/Catalog/LocalModelCatalog.cs:175, ccd64bbb7d68)
  • Open product-policy item: The linked open issue asks maintainers to decide whether default recommendations should prioritize model capability or larger context, while this PR implements the model-first policy. (8df3fb7c17cf)

Likely related people:

  • joelagnel: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • shanselman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Repair and test legacy Qwen3.5 9B recovery through the setup pipeline.
  • Post redacted current-head supported-GPU llama-server launch and fixed-prompt inference evidence.
  • Record maintainer confirmation of the capability-versus-context recommendation policy.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-09-01T19:30:34.117Z sha 9b38ea9 :: needs real behavior proof before merge. :: [P1] Restore explicit approval before changing global WSL networking | [P1] Preserve or migrate existing managed Local AI installations
  • reviewed 2026-09-02T18:01:27.544Z sha 2809214 :: needs real behavior proof before merge. :: [P1] Restore explicit consent before changing global WSL networking | [P1] Migrate or preserve removed Qwen3.5 installations
  • reviewed 2026-09-02T18:08:01.629Z sha 2809214 :: needs real behavior proof before merge. :: [P1] Restore explicit consent before changing global WSL networking | [P1] Preserve or migrate removed Qwen3.5 installations
  • reviewed 2026-09-02T20:02:15.254Z sha 2809214 :: needs real behavior proof before merge. :: [P1] Restore explicit consent before global WSL reconfiguration | [P1] Preserve or migrate removed Qwen3.5 installations
  • reviewed 2026-09-02T22:58:35.458Z sha 2809214 :: needs real behavior proof before merge. :: [P1] Restore explicit consent before global WSL reconfiguration | [P1] Preserve or migrate removed Qwen3.5 installations | [P1] Use dedicated GPU capacity before selecting the 27B profile
  • reviewed 2026-09-02T23:12:25.710Z sha 74b008f :: needs real behavior proof before merge. :: [P1] Use dedicated GPU capacity before selecting a profile

public const string Qwen35BModelId = "qwen3.6-35b-a3b-mtp-q4-k-m";
public const string Qwen27BModelId = "qwen3.6-27b-mtp-q4-k-m";
public const string Qwen9BModelId = "qwen3.5-9b-mtp-q4-k-m";
public const int NativeContextTokens = 262_144;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we refactor this and name it with t-shirt size: Context Large, Medium, Small, XS. Better with an enum or an array instead of defining all those variables explicitly. This suits better if we need to use a selector or at least makes the code easier to read by explicitly declaring the options and having a map to the context size length.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tricky to do. Weaker model might have larger context or higher parameters count. I prefer something like Model name - version number - parameter count. Let's look into this after initial merge as product team might have a say on the specific strings for this and other similar strings, and I don't want to gate merging this last minute. Thanks

@joelagnel

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Sep 2, 2026
@joelagnel

Copy link
Copy Markdown
Collaborator Author

Joel: will add proof

@joelagnel

Copy link
Copy Markdown
Collaborator Author

Windows model-selection proof

Captured on Windows 11 ARM64 with an NVIDIA RTX Spark N1X during the validated Local AI integration run.

Local AI install review showing Qwen 3.8 27B recommended

The screen shows:

  • Local AI enabled.
  • 45.4 GiB CUDA-visible memory.
  • 40.3 GiB required by the selected profile.
  • Qwen 3.8 27B selected and marked Recommended.
  • A 16.5 GB model artifact.

During the same run, fixed-prompt inference completed with 32 generated tokens and GPU verification passed with 66/66 layers and 15,738,286,899 bytes in CUDA model buffers.

@joelagnel

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Sep 2, 2026
@shanselman shanselman added the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Sep 2, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 2, 2026
…hable

Enabling Local AI no longer implies consent for the user-wide .wslconfig
mirrored-networking rewrite and one-time wsl.exe --shutdown. The affirmative
checkbox is restored and Continue stays blocked until it is accepted whenever
the change is actually required.

Qwen3.5 9B is retired from new installs but kept as a hidden legacy catalog
entry so an existing managed installation keeps resolving its own pinned
receipt and launching after upgrade. The entry is never offered, recommended,
or selectable, exposes only the native F16 profile it could have been
installed with, and no model artifact is remapped.

Co-authored-by: Copilot App <[email protected]>
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Sep 2, 2026
@clawsweeper clawsweeper Bot removed the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Sep 2, 2026
Copilot AI added 3 commits September 2, 2026 16:42
# Conflicts:
#	src/OpenClaw.SetupEngine.UI/Pages/CapabilitiesPage.xaml.cs
#	src/OpenClaw.SetupEngine/LocalAiInstallReconciler.cs
#	tests/OpenClaw.Shared.Tests/LocalInferenceQualificationTests.cs
Cover the step-level invariant behind the restored consent gate: without
explicit consent ConfigureLocalAiWslNetworkingStep stops before applying
mirrored networking, so the user-wide .wslconfig keeps its exact bytes,
no backup is staged, and no global WSL shutdown is issued. Enabling Local
AI on its own does not satisfy the gate.

Co-authored-by: Copilot App <[email protected]>
The deny test claimed no global WSL shutdown is issued but used a real
CommandRunner and never asserted it. Inject a refusing ICommandRunner and
assert zero invocations, so a regression that shuts WSL down before
applying mirrored networking fails the test instead of running wsl.exe.

Co-authored-by: Copilot App <[email protected]>
@shanselman
shanselman merged commit de88f38 into openclaw:main Sep 3, 2026
15 checks passed
@shanselman shanselman removed the status: 🚢 actively landing A maintainer or agent is actively driving this item through implementation, validation, or merge. label Sep 3, 2026
larroy pushed a commit to larroy/openclaw-windows-node that referenced this pull request Sep 3, 2026
…claw#1281)

* fix(local-ai): recommend Qwen3.8 with measured context profiles

* fix(local-ai): drop 16 GiB model support

* fix(local-ai): restore WSL consent and keep retired 9B installs launchable

Enabling Local AI no longer implies consent for the user-wide .wslconfig
mirrored-networking rewrite and one-time wsl.exe --shutdown. The affirmative
checkbox is restored and Continue stays blocked until it is accepted whenever
the change is actually required.

Qwen3.5 9B is retired from new installs but kept as a hidden legacy catalog
entry so an existing managed installation keeps resolving its own pinned
receipt and launching after upgrade. The entry is never offered, recommended,
or selectable, exposes only the native F16 profile it could have been
installed with, and no model artifact is remapped.

Co-authored-by: Copilot App <[email protected]>

* test(local-ai): prove denied WSL consent changes nothing

Cover the step-level invariant behind the restored consent gate: without
explicit consent ConfigureLocalAiWslNetworkingStep stops before applying
mirrored networking, so the user-wide .wslconfig keeps its exact bytes,
no backup is staged, and no global WSL shutdown is issued. Enabling Local
AI on its own does not satisfy the gate.

Co-authored-by: Copilot App <[email protected]>

* test(local-ai): assert the denied consent path launches no process

The deny test claimed no global WSL shutdown is issued but used a real
CommandRunner and never asserted it. Inject a refusing ICommandRunner and
assert zero invocations, so a regression that shuts WSL down before
applying mirrored networking fails the test instead of running wsl.exe.

Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: Copilot App <[email protected]>
larroy pushed a commit to larroy/openclaw-windows-node that referenced this pull request Sep 4, 2026
LocalModelRunRecipe no longer carries ContextTokens after openclaw#1281 moved
capacity settings to LocalInferenceRunProfile. The merged
LocalAiInferenceFailureDiagnosticsTests still referenced
model.Recipe.ContextTokens, which broke the CI test job with CS1061.
Thread the selected profile's ContextTokens through CreateInstall like
LocalAiSetupSteps does.
shanselman added a commit that referenced this pull request Sep 4, 2026
…1284)

* fix(local-ai): surface llama-server root cause on inference failure

A failed `verify-local-ai-inference` reported only "llama-server inference
returned HTTP 500 (InternalServerError)". The real cause — a CUDA
flash-attention kernel fault during model warm-up (#1242) — was reachable
only by hand-reading llama-server's own logs, which live in a different
tree from the setup log the UI links to.

Three gaps hid it:

- The HTTP error body, which carries llama.cpp's
  `{"error":{"message":"model ... failed to load"}}`, was discarded.
- Nothing read llama-server's stdout/stderr on failure, even though the
  GPU verification path already had a bounded log-tail helper.
- The GUI never surfaced the llama-server log directory.

Read a bounded, best-effort error body and raise
LlamaServerInferenceException carrying the status and the server's own
message. Extract the log-tail helper into LocalAiLogTail, add failure-line
extraction, and share it with LocalAiGpuVerification. Attach a structured
LocalAiFailureDetail (diagnostic lines plus log directory) to StepResult
and thread it to the completion page, which now renders the llama-server
lines and an "Open Local AI logs" link. The lines are also echoed into the
setup log so the root cause survives rollback.

Only server-generated error text is surfaced, never assistant output; a
test pins that contract.

Two incidental fixes:

- Capture diagnostics before resetting the router. The reset restarts
  llama-server, which appends a startup banner and can rotate the failing
  lines out of the bounded log. Covered by a regression test verified to
  fail against the old ordering.
- LogFileLauncher.RevealInExplorer opened the parent of a directory
  argument, because it unconditionally called Path.GetDirectoryName.

Refs #1242

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(local-ai): never surface unrecognized llama-server response bodies

The HTTP error-body fallback in LlamaServerInferenceClient returned raw,
unvetted response text (HTML, malformed JSON, JSON without an "error"
field) whenever the response did not match llama-server's recognized
{"error": ...} shape. That raw text flowed into the inference
exception's Message, then into StepResult.Message, the setup log
(ctx.Logger.Error), and the completion page's error text - contradicting
the documented invariant that only recognized llama-server diagnostic
text is surfaced.

Remove the raw-body fallback: ReadErrorDetailAsync now returns null
(status-only) unless a recognized error field is present. Add sentinel
assertions in LlamaServerInferenceClientTests proving unrecognized
bodies never reach the exception, and an end-to-end sentinel test in
LocalAiInferenceFailureDiagnosticsTests driving the real HTTP client
through VerifyLocalAiInferenceStep to prove the sentinel never reaches
StepResult.Message or LocalAiFailureDetail.

Co-authored-by: Copilot App <[email protected]>

* fix(local-ai): never derive a clickable help link from llama-server text

Rubber-duck review of the diagnostic-flow change surfaced a second
security-boundary gap: CompletePage.OnNavigatedTo scanned every failure
message (including the setup step's error message, which now can carry
llama-server's own text via LlamaServerInferenceException.Message) for a
URL and, if found, rendered it as a clickable HelpLink. A malicious or
compromised local model server could therefore plant a navigable link
in the completion UI by returning a recognized {"error": {"message":
"https://..."}} shape.

Skip the URL scan whenever CompletePageArgs.Detail is present, since
Detail is populated only for Local AI inference failures and reliably
identifies server-originated text. Non-Local-AI failures keep their
existing curated help links (e.g. the WSL update link). Add a
source-text contract test (CompletePage is a WinUI Page and cannot be
unit-instantiated without a XAML host).

Also fix a related display bug the same review pass found: the "Open
Local AI logs" link showed the un-translated app path instead of the
MSIX-container-resolved real path used by the setup log link and by
RevealInExplorer itself, so the visible/tooltip text could disagree
with what actually opens under MSIX virtualization. Route it through
LogFileLauncher.ResolveRealPath like the existing log link.

Finally, tighten the end-to-end sentinel test added in the prior
commit: the LocalAiFailureDetail assertions were vacuous (no log files
were written, so Diagnostics was trivially empty and LogDirectory is
never derived from the HTTP body). Replaced with assertions that
actually hold meaning: Diagnostics stays empty and LogDirectory equals
the app-controlled LocalAiPaths value.

Co-authored-by: Copilot App <[email protected]>

* fix(local-ai): hide broken log link and tighten diagnostic matching

Structured (Codex) review of the diagnostic-flow change surfaced two
more issues before landing:

1. The "Open Local AI logs" link stayed visible even when the WinUI
   setup wizard's default RollbackOnFailure=true had already deleted
   the whole Local AI tree (including the log directory) before the
   completion page renders. Clicking it could not open the promised
   folder. The diagnostic text lines above the link remain accurate
   regardless (they were captured before the rollback); only the link
   itself now checks Directory.Exists on the resolved real path and
   hides when the target is gone.

2. LocalAiLogTail's diagnostic-line regex matched any "ggml_xxx:"
   prefixed line, which also matches routine, non-failure llama.cpp
   initialization logging (e.g. "ggml_cuda_init: found 1 CUDA
   devices:"). A timeout or unrelated failure could therefore surface
   ordinary startup lines as if they were the failure's root cause.
   Removed that overly broad alternative; the remaining patterns
   (CUDA error, cudaError, exited with status, failed to load, out of
   memory, and a generic "error:" marker) already cover genuine
   failure text without the false-positive risk.

Added focused regression tests for both: a source-text contract test
proving the log link is gated on Directory.Exists, and a fixture test
proving a benign ggml_ startup log is not misclassified as a
diagnostic line.

Co-authored-by: Copilot App <[email protected]>

* fix(local-ai): recognize llama.cpp buffer-allocation failure lines

A second structured-review pass found that LocalAiLogTail's diagnostic
pattern missed a real, documented llama.cpp failure vocabulary: host
and device memory allocation failures reported as
"failed to allocate ... buffer" (e.g. from
ggml_gallocr_reserve_n_impl or graph_reserve during
llama_new_context_with_model). Those lines matched none of the
existing markers (CUDA error, cudaError, exited with status, failed to
load, out of memory, error:), so a model-load failure caused by an
allocation error would surface only the router's generic "failed to
load" line instead of the actual root cause.

Add "failed to allocate" to the recognized pattern. Add a fixture test
using representative real llama.cpp allocation-failure lines and
assert the routine "constructing llama_context" line beside them is
still excluded.

Co-authored-by: Copilot App <[email protected]>

* fix(tests): read context tokens from run profile

LocalModelRunRecipe no longer carries ContextTokens after #1281 moved
capacity settings to LocalInferenceRunProfile. The merged
LocalAiInferenceFailureDiagnosticsTests still referenced
model.Recipe.ContextTokens, which broke the CI test job with CS1061.
Thread the selected profile's ContextTokens through CreateInstall like
LocalAiSetupSteps does.

* fix(local-ai): redact inference diagnostics

Reject verbose llama-server request and response records before extracting failure evidence, redact accepted diagnostics, normalize server-controlled line separators, and isolate the new setup tests from user data.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: afecb137-a9e6-4dcb-a151-72ffd3f3b3eb

* fix(local-ai): reject payload records in diagnostics

Apply the verbose request/response guard to recognized HTTP errors, normalize log diagnostics to one line, and retain explicit model-format failure markers.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: afecb137-a9e6-4dcb-a151-72ffd3f3b3eb

---------

Co-authored-by: Pedro Larroy <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: Scott Hanselman <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: afecb137-a9e6-4dcb-a151-72ffd3f3b3eb
@larroy

larroy commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

holy cow bold

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify recommendations when stronger models require reduced context

4 participants