Skip to content

fix(llama): support embedding-only managed setup - #130883

Merged
obviyus merged 7 commits into
mainfrom
codex/issue-128880
Aug 27, 2026
Merged

obviyus merged 7 commits into
mainfrom
codex/issue-128880

Conversation

@obviyus

@obviyus obviyus commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Guided managed llama.cpp setup stopped below the 16 GiB chat-model RAM floor, even when memory.search.provider explicitly requested local embeddings. The operator saw Setup skipped, and openclaw memory status --deep could not initialize local memory.

Fixes #128880.

Root cause

Managed setup had one hard-coded success shape: chat plus embeddings. The setup result always selected a llama.cpp chat model, the provider builder always restored the default chat catalog row, and the shared preset API could not distinguish preserving chat from intentionally removing it.

Fix

  • Select one explicit chat or embedding-only setup plan before downloads start.
  • Offer embedding-only setup only for explicit local-memory intent and only after separate consent.
  • Save embedding-only managed providers with models: [] and no default-model change.
  • Leave external providers and non-empty llama.cpp chat inventories untouched.
  • Recognize local-memory intent from global and per-agent configuration.
  • Make configured model inventory authoritative in the managed catalog.
  • Give the shared preset owner explicit preserve, remove, and configure chat policies.
  • Document the consent and unchanged-chat behavior.

Production code is +179/-96 lines (net +83). The added capability needs an explicit setup plan and two owner-boundary contracts; the preset refactor itself is net negative. The approved product contract makes an explicit empty managed inventory intentional.

Proof

  • The setup, catalog, and active-chat regressions failed before their owner-boundary repairs.
  • node scripts/run-vitest.mjs extensions/llama-cpp --reporter=verbose: 12 files and 132 tests passed.
  • Pinned formatter, whitespace, coercion-helper, and import-cycle checks passed.
  • In a disposable Ubuntu 24.04 virtual machine with 8 GiB RAM, exact current main at 3ee363fc084 showed Setup skipped and memory status --deep failed because managed local embeddings were unavailable.
  • Exact head bbd1d79a4c8 obtained explicit embedding-only consent, downloaded one verified 328,577,056-byte GGUF, preserved openai/gpt-5.4, saved models: [], and generated an embedding-only preset.
  • The managed server reported healthy, returned one real 768-value embedding, and returned changed input from a real hybrid memory search.
  • Per-agent local-memory intent reached the explicit consent prompt and installed nothing after consent was declined.
  • External and managed llama.cpp chat inventories stayed byte-for-byte unchanged and remained listed after setup refused unsafe replacement.
  • The managed server, virtual machine, forwarded port, SSH key, and disposable state were stopped and removed after proof.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: llama-cpp size: M maintainer Maintainer-authored PR labels Aug 27, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 8:28 AM ET / 12:28 UTC.

ClawSweeper review

What this changes

This PR adds a consented embedding-only managed llama.cpp setup path for local memory search, preserving existing chat setup and treating an empty configured model inventory as authoritative.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main still skips managed setup below the chat RAM floor, while the current head addresses both prior blockers and has no remaining actionable correctness finding.

Priority: P1
Reviewed head: bbd1d79a4c8fccaa0124e1d042c3764a9badef84

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has a clear owner-boundary design, covers the earlier blockers, and introduces no supported correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository state identifies the author as a MEMBER, so the external-contributor real-behavior-proof gate does not apply; the detailed VM claim remains self-reported because GitHub artifacts were unavailable.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies the author as a MEMBER, so the external-contributor real-behavior-proof gate does not apply; the detailed VM claim remains self-reported because GitHub artifacts were unavailable.
Evidence reviewed 6 items Current-main bug remains: Current main returns profiles: [] after the below-16-GiB chat-model gate, so it does not provide the requested embedding-only setup path.
Prior route-preservation finding addressed: Embedding-only setup is refused before consent or downloads when an existing llama.cpp provider is external or has configured chat inventory; the resulting remove policy is reachable only after that guard.
Prior empty-inventory finding addressed: Managed catalog construction passes the persisted model array through unchanged, and tests confirm an empty managed inventory remains empty rather than restoring Gemma.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/llama-cpp/src/setup.test.ts --reporter=verbose

Result: PASS (completed)

[test] starting test/vitest/vitest.extensions.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130883-jLNWIv/target

 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › pins the default model identity and integrity 21ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › keeps the 16 GiB default-model gate 1ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › keeps app discovery read-only 3ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › detects a fully prepared managed server 4ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › does not detect chat from a cached model when the managed inventory is empty
2ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › does not offer the default download below the RAM floor 2ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › offers embedding-only setup for local memory below the chat RAM floor 3ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › requires consent before embedding-only setup 2ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › offers embedding-only setup after the chat download is declined 2ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › offers embedding-only setup for per-agent local memory intent 1ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › does not replace an external llama.cpp provider used as 'the default primary'
 1ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › does not replace an external llama.cpp provider used as 'a default fallback'
1ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › does not replace an external llama.cpp provider used as 'an agent primary' 1m
s
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › does not replace an external llama.cpp provider used as 'the default subagent
 model' 1ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › does not replace an external llama.cpp provider used as 'an agent subagent mo
del' 1ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › does not replace a managed llama.cpp provider used as 'the default primary' 1
ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › does not replace a managed llama.cpp provider used as 'a default fallback' 1m
s
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › does not replace a managed llama.cpp provider used as 'the default subagent m
odel' 1ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › does not replace a managed llama.cpp provider used as 'an agent subagent mode
l' 1ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › requires consent before installing and downloading 1ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › writes one durable managed-server provider after preparation 2ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › preserves custom model config when refreshing an existing managed server 1ms
 ✓  extensions  extensions/llama-cpp/src/setup.test.ts › llama.cpp managed setup › replaces external endpoint state when switching to managed setup 2ms

 Test Files  1 passed (1)
      Tests  23 passed (23)
   Start at  12:29:46
   Duration  10.23s (transform 8.01s, setup 968ms, import 8.85s, tests 59ms, environment 0ms)

[test] passed 1 Vitest shard in 16.70s

Assertions:

  • PASS expect_output: offers embedding-only setup for local memory below the chat RAM floor
  • PASS expect_output: does not detect chat from a cached model when the managed inventory is empty

How this fits together

The llama.cpp plugin’s guided setup writes a managed local server configuration used by the provider catalog and local-memory embedding runtime. Its chosen plan controls model downloads, the server preset, and whether existing chat routing remains available.

flowchart LR
  A[Local memory intent] --> B[Guided llama.cpp setup]
  B --> C{Chat or embedding-only plan}
  C --> D[Managed server preset]
  D --> E[Persisted provider inventory]
  E --> F[Model catalog]
  E --> G[Local embedding runtime]
Loading

Before merge

  • Resolve merge risk (P1) - The managed catalog now treats models: [] as an intentional empty inventory instead of synthesizing the default chat model; that is needed for embedding-only setup but is an upgrade-sensitive behavior change for manually authored managed configurations.
  • Complete next step (P2) - No narrow repair remains from this review; await exact-head CI and normal maintainer merge handling.
Agent review details

Security

None.

PR surface

Source +83, Tests +276, Docs +18. Total +377 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 5 179 96 +83
Tests 4 295 19 +276
Docs 2 22 4 +18
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 496 119 +377

Review metrics

Metric Value Why it matters
Runtime, test, and docs delta runtime +179/-96; tests +295/-19; docs +22/-4 The +83 runtime-line increase is concentrated in the explicit setup-plan and preset-policy boundary required to represent embedding-only setup safely.

Stored data model

Persistent data-model change detected: vector/embedding metadata: docs/plugins/llama-cpp.md, vector/embedding metadata: extensions/llama-cpp/README.md, vector/embedding metadata: extensions/llama-cpp/src/setup.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #128880
Summary: This PR is the candidate repair for the reported low-RAM managed llama.cpp setup failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Accept explicit empty-inventory semantics (recommended)
    Merge with the intentional rule that a managed provider’s persisted empty model inventory must not synthesize a chat model.

Technical review

Best possible solution:

Retain the explicit setup-plan and preset-policy boundaries, with the persisted model inventory authoritative and exact-head CI completing before merge.

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

Yes—current main has a deterministic low-RAM early return in runLlamaCppSetup; the PR body also describes an after-fix VM run, although its artifacts were not available for independent inspection.

Is this the best way to solve the issue?

Yes—the explicit chat versus embedding-only plan and explicit preset policy repair the setup owner without changing the schema or adding a parallel provider path.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies the author as a MEMBER, so the external-contributor real-behavior-proof gate does not apply; the detailed VM claim remains self-reported because GitHub artifacts were unavailable.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The current setup flow deterministically leaves configured local memory unusable on low-RAM hosts until this repair lands.
  • merge-risk: 🚨 compatibility: The PR intentionally changes managed-provider handling of an explicitly empty model inventory, which can affect existing manually authored configurations.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies the author as a MEMBER, so the external-contributor real-behavior-proof gate does not apply; the detailed VM claim remains self-reported because GitHub artifacts were unavailable.

Evidence

What I checked:

  • Current-main bug remains: Current main returns profiles: [] after the below-16-GiB chat-model gate, so it does not provide the requested embedding-only setup path. (extensions/llama-cpp/src/setup.ts:206, f04a622c1f35)
  • Prior route-preservation finding addressed: Embedding-only setup is refused before consent or downloads when an existing llama.cpp provider is external or has configured chat inventory; the resulting remove policy is reachable only after that guard. (extensions/llama-cpp/src/setup.ts:256, bbd1d79a4c8f)
  • Prior empty-inventory finding addressed: Managed catalog construction passes the persisted model array through unchanged, and tests confirm an empty managed inventory remains empty rather than restoring Gemma. (extensions/llama-cpp/src/managed-provider.ts:95, bbd1d79a4c8f)
  • Preset owner separates policies: The shared preset writer has explicit preserve, remove, and configure chat modes; embedding runtime refreshes use preserve, while the explicit embedding-only plan uses remove. (extensions/llama-cpp/src/managed-server.ts:54, bbd1d79a4c8f)
  • Current-main provenance: Blame attributes the current-main RAM-gated setup and catalog behavior to the recent model-catalog refactor, making Peter Steinberger the strongest routing candidate for the existing owner boundary. (extensions/llama-cpp/src/setup.ts:206, 111c3c633ded)
  • No Codex dependency signal: The changed plugin imports its own llama.cpp modules and OpenClaw Plugin SDK interfaces; it neither imports nor claims compatibility with the separate Codex runtime or protocol. (extensions/llama-cpp/src/setup.ts:4, bbd1d79a4c8f)

Likely related people:

  • steipete: Current-main blame attributes the affected setup, default inventory, and catalog behavior to the model-catalog refactor. (role: current-main setup and catalog owner; confidence: high; commits: 111c3c633ded, a5237fe925a8; files: extensions/llama-cpp/src/setup.ts, extensions/llama-cpp/src/defaults.ts, extensions/llama-cpp/src/managed-provider.ts)
  • Jacqueline Henriksen: The embedding-only managed-server capability that this setup path exposes was introduced in the prerequisite runtime work. (role: embedding-runtime introducer; confidence: medium; commits: 72c227c7cc30; files: extensions/llama-cpp/src/managed-server.ts, extensions/llama-cpp/src/embedding-provider.ts)

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 (1 earlier review cycle)
  • reviewed 2026-08-27T11:42:01.178Z sha c1eb656 :: found issues before merge. :: [P1] Preserve managed chat routes before embedding-only setup | [P2] Honor empty model inventory during app-guided detection

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. labels Aug 27, 2026
@obviyus

obviyus commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator Author
Item Details
Bug On hosts below the llama.cpp chat-model RAM floor, guided setup stopped even when the operator only wanted local memory embeddings.
Fix Guided setup now offers a separate embedding-only install after explicit consent, saves models: [], preserves chat selection, and refuses to replace existing chat inventory.
Example Before: an 8 GiB host showed Setup skipped, and local memory could not initialize. After: the same host installs only the managed server and embedding model while the existing chat model stays selected.
Proof Exact current main reproduced the failure. Exact head bbd1d79a4c8 installed the verified embedding model, passed /health, returned a real 768-value embedding, completed a real memory search, preserved external and managed chat inventories, passed 132 plugin tests, passed exact-head CI, and passed the local ClawSweeper gate with no findings.

The maintainer-approved contract intentionally treats an explicit empty managed model inventory as embedding-only.

@obviyus
obviyus merged commit 06038f9 into main Aug 27, 2026
143 checks passed
@obviyus
obviyus deleted the codex/issue-128880 branch August 27, 2026 12:39
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 28, 2026
Allow low-memory local-memory setups to install only the verified managed server and embedding model while preserving every configured chat route.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: llama-cpp maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

[Bug]: runLlamaCppSetup refuses embedding-only setup on <16 GB RAM despite runtime supporting it

1 participant