Repository navigation
feat: choose and verify local models for Gateway hardware - #138464
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Recommend pinned Qwen, Gemma, and Muse recipes from available host resources. Install a verified runtime and require a real tool roundtrip before activation while preserving the prior configuration on failure. Closes #138426
3018bc8 to
65fb014
Compare
|
The first CI run exposed a host-dependent setup test: it mocked total RAM but still consumed the runner's real cgroup/memory/disk probes. The test now supplies a complete hardware fixture at the detector boundary, preserving its assertion that local embeddings do not suppress chat setup. The focused suite, typecheck, lint, and fresh independent P0–P2 review pass. The other failure was the inherited Control UI startup budget overrun (350,366 bytes versus 350,141 allowed). This PR changes no production UI source or build configuration. Rebased once to include the existing lazy provider-settings catalog repair from #137342; the budget is unchanged. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 2:41 PM ET / 18:41 UTC. ClawSweeper reviewWhat this changesAdds hardware-aware managed llama.cpp model selection, verified runtime/model installation, and tool-use verification before a new local model becomes the Gateway default. Merge readiness⛔ Blocked before merge - 2 items remain No introduced blocker found. This active maintainer-owned PR keeps managed local-model policy in the llama.cpp plugin, verifies an isolated candidate with a restricted real tool roundtrip before persistence, and preserves existing managed and external-server paths. Priority: P2 Review scores
Verification
How this fits togetherThe managed llama.cpp plugin supplies local model setup to Gateway onboarding and Model Setup. It detects the Gateway host, prepares a verified local server and model, then hands a candidate route to shared inference verification before persisting the default. flowchart LR
A[Gateway onboarding] --> B[Managed llama.cpp setup]
B --> C[Host hardware detection]
C --> D[Model and runtime selection]
D --> E[Verified download and isolated server]
E --> F[Inference and tool verification]
F --> G[Persisted default model]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1007, Tests +1175, Docs +73, Other 0. Total +2255 across 30 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land after exact-head CI is green while retaining plugin-owned hardware/runtime policy and generic inference verification; keep the separate live multi-model router-inventory defect in #138452 scoped independently. Do we have a high-confidence way to reproduce the issue? Not applicable as an issue reproduction: the PR supplies after-fix managed Apple Metal activation evidence, while source tests cover insufficient resources and failed verification without persisting a candidate. Is this the best way to solve the issue? Yes. Provider-specific hardware, artifact, and runtime policy remains in the llama.cpp plugin, while the shared verifier owns only the generic model/tool capability check. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0062f2b127bb. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Addressing the review's compatibility and rank-up items: The stored-data detector matched transient state, not a schema change. In Compatibility proof is included in the passing suites: old and managed embedding cache paths retain their index identity; embedding-only inventory stays empty; existing custom GGUF identities stay literal; configured direct-model and router services retain their commands/arguments/environment/cwd; external routes are preserved; and failed/cancelled activation retains the prior configuration. Real source and built activation also exercised the normal configuration write/read flow. No data migration is required for these unchanged formats. Rank-up disposition: exact-head CI is required and is finishing. Non-Metal physical activation remains deferred because the proof host is Apple silicon; the PR explicitly limits live evidence to Metal and preserves the documented externally managed server path. Windows CUDA/Linux claims remain bounded to direct upstream source and fixture validation, including CUDA archive/device checks. The separate pre-existing multi-model lifecycle defect stays in #138452. These are the recorded mitigations for the review's platform risk; no test or performance gate is waived. |
|
Ready to land: exact-head CI33906548543 completed successfully for All five new model recipes completed real OpenClaw activation on macOS Metal, including an actual read-tool roundtrip; the final built plugin also passed with Qwen3.5 9B. Failed verification preserves the previous default, and candidate presets are isolated. Windows CUDA/Linux selection and packaging have source/fixture proof; physical Windows GPU behavior and measured peak VRAM are not claimed. The first CI run's host-dependent test is fixed at its hardware-detector fixture. The inherited UI startup overrun is resolved by rebasing onto the existing lazy-settings fix from #137342, with no size-limit change. The two task commits remained patch-identical through that rebase. Pre-existing multiple-model router switching is tracked separately in #138452. Production delta is +1,401/−394 (net +1,007); tests +1,263/−88 (net +1,175). Growth supplies the requested resource selection, verified runtime/artifact handling, and real tool-use activation; the old duplicate inference probe was removed. The plugin manifest remains refreshable local discovery, so uninstalled recipe choices are not advertised as usable models in the global catalog. Latest ClawSweeper findings: none. Its compatibility/platform review items are addressed in the recorded disposition; exact-head CI rank-up is complete, and physical non-Metal activation remains an explicitly documented follow-up. |
|
Merged via squash.
|
…38464) * feat: choose and verify local models for Gateway hardware Recommend pinned Qwen, Gemma, and Muse recipes from available host resources. Install a verified runtime and require a real tool roundtrip before activation while preserving the prior configuration on failure. Closes openclaw#138426 * test: isolate local setup from runner hardware capacity
Closes #138426
What Problem This Solves
Managed local model setup previously selected one fixed model regardless of the Gateway's hardware and verified only a text reply. Operators had to work out whether the model and runtime would fit and whether the result could actually use OpenClaw tools.
Why This Change Was Made
The existing llama.cpp plugin now owns hardware detection, curated model selection, verified runtime installation, and a host/model/download confirmation. Core activation reuses one inference-verification flow and adds a real file-read tool challenge for managed models before changing the default. Each candidate uses an isolated preset and port so failed verification preserves the previous selection and server preset.
The recipes pin Hugging Face revisions and SHA-256 identities. Recommendations account for current RAM/container limits, one GPU's usable memory, a 64K context, embeddings, and disk capacity. Separate disks get separate budgets; shared or uncertain storage pools retain a combined reserve. Verified cached artifacts are reused on retries. Managed streams now use the existing llama-server payload adapter, fixing the thinking-off setting that otherwise prevented one new recipe from returning a final answer during activation.
User Impact
The existing Run a model locally → llama.cpp → Set up model flow recommends:
These are selection floors, not guaranteed speed or comparative benchmark rankings. CPU recommendations stop at 9B. Existing Gemma recipes remain available for existing and cached routes. The pinned runtime supports Apple Metal, CPU platforms, and Windows CUDA 12.4 with the matching verified runtime DLL archive. Linux NVIDIA hosts receive an explicit CPU confirmation or can connect an externally managed server.
No public configuration key, environment variable, SQLite schema, or dependency is added. The docs describe the Gateway-host boundary, resource budgets, runtime choices, verification, and retry behavior.
Evidence
65fb014c70f6a122b7d475955ab4b14d397f5208, includingopenclaw/ci-gate.Setup flow
Before starting setup:
Hardware-specific confirmation:
After verified activation, mobile:
Follow-ups and scope
The real-router investigation reproduced a pre-existing issue when switching between multiple configured managed models: #138452. Fresh single-model activation is covered here; the full configured-inventory lifecycle repair belongs in that follow-up. Another pre-existing custom-source concern is concurrent resolutions of a mutable Hugging Face ref joining the same destination with different resolved digests; the new immutable recipes do not take that differing-artifact path.
Production growth supplies hardware/catalog selection, verified GPU installation, cached integrity reuse, and real tool verification. The previous duplicated inference probe is extracted into one shared owner, not retained as a parallel implementation.
Diff accounting: metadata +2/−2 (net +0), docs +95/−22 (net +73), tests +1263/−88 (net +1175), production +1401/−394 (net +1007).