Skip to content

fix(doctor): report missing managed local embedding setup - #123575

Merged
fuller-stack-dev merged 104 commits into
openclaw:mainfrom
fuller-stack-dev:fix/gateway-startup-preflight
Aug 16, 2026
Merged

fuller-stack-dev merged 104 commits into
openclaw:mainfrom
fuller-stack-dev:fix/gateway-startup-preflight

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Aug 14, 2026 •

Copy link
Copy Markdown
Member

Related: #67407

Problem

An external upgrade supervisor can stop a healthy Gateway before the selected
OpenClaw target exposes a deterministic startup blocker. With an existing
semantic index and memory.search.provider=local, static config validation
passes while direct startup refuses readiness when managed llama.cpp provider
configuration is missing.

Merged #124041 restores installed llama.cpp provider runtime compatibility.
Merged #124110 keeps broad Doctor lint off writable migration paths. The
existing models-auth CLI performs the supported consentful setup. None of those
surfaces provides the passive exact-target signal needed before cutover.

Contract

openclaw doctor --lint --only memory-core/managed-local-embedding-setup --severity-min error --json
  • Exit 1 with one structured managed-llama-cpp-setup finding when an
    existing semantic index selects local embeddings but managed llama.cpp
    configuration is missing.
  • Exit 0 with no finding when managed setup exists, no semantic index exists,
    or the selected memory provider is not local.
  • Report the supported interactive remediation without invoking it:
openclaw models --agent main auth login --provider llama-cpp --method local

This is one declared deterministic startup prerequisite, not universal Gateway
readiness. The check is default-disabled, so ordinary doctor --lint selection
and exit behavior remain unchanged.

Ownership And Scope

  • Doctor lint owns the non-mutating machine-readable surface.
  • Memory Core owns semantic-index relevance.
  • The selected installed embedding provider owns its setup predicate.
  • Core resolves the separately installed official llama.cpp plugin through the
    existing registry-aware provider public surface; it does not bundle or load
    llama.cpp directly.
  • Shared SQLite state is isolated only when the selected check declares that
    requirement. Unrelated Doctor lint remains available under writer contention.
  • Static config validation and direct startup refusal remain unchanged.
  • The check does not download models, create credentials, run setup, start
    services, contact model endpoints, or change provider/default-model
    selection.

Why This Is Still Needed

#124041 fixes the runtime SDK/import path after upgrade, but it does not expose
missing managed local-embedding setup before the old Gateway is stopped.
#124110 removes broad Doctor migration writes, but it does not identify this
provider-owned prerequisite. OCM still needs a structured exact-target signal;
scraping Gateway error text would duplicate OpenClaw policy and remain too late
for safe cutover.

Exact-Head Proof

  • Fresh canonical-main red: config validate --json exited 0; direct Gateway
    startup exited 1 for missing managed llama.cpp setup.
  • Reviewed head: afe8c2d82d84efc153b2958be2b99813285d1f39.
  • Reviewed tree: 90edb0296dcd53cc2b06706ed5675419c2f2d0b3.
  • Canonical base: 2585edba2efda9ff50e6bed0a6de8cfaef8254fc.
  • Exact package SHA-256:
    3972915155bfbcd63537b9c0d3414b2f2639d6cb0f5ba32216d4805187b850df.
  • Source-blind behavior contract SHA-256:
    ea50e44cb0d51324125b7159cc31cf27b7775dffdfc5ba31b4603356eca87c09.
  • Source-blind behavior report SHA-256:
    9e11c57c02ef517af20689382eb47d31d817e1c651c868e1b170bc98e26e4952.
  • Missing setup exited 1 with deterministic structured JSON and the
    models-auth remediation. Configured, non-local, and no-index controls exited
    0. Missing provider exited 1 with the distinct
    memory-embedding-provider-plugin requirement.
  • Repeated runs were byte-identical with empty stderr. Config, state, SQLite
    sidecars, provider artifacts, provider selection, and primary model remained
    unchanged.
  • An unrelated selected Doctor check exited 0 twice while an active global
    SQLite writer was running.
  • Direct packaged Gateway startup exited 1, exposed no listener, and reported
    the same startup prerequisite.
  • Focused exact-head owner tests passed 71/71 across five Vitest shards; the
    omitted/default plugin-validation regression also passed.
  • pnpm deadcode:full, exact package build, tarball integrity/import graph,
    formatting, and git diff --check passed.
  • Blacksmith Testbox package proof used lease
    tbx_01m044f7730jddhz5m8mrpj28d, Actions run 31920657551.
  • Fresh branch-wide P1 autoreview reported no findings (patch is correct,
    confidence 0.86; TruffleHog clean).
  • The OpenGrep test-helper finding is fixed by explicit restoration of only
    HOME, OPENCLAW_CONFIG_PATH, and OPENCLAW_STATE_DIR.
  • Native review artifacts validate READY FOR /prepare-pr with zero findings.

OCM Integration

Run the exact target binary and environment before quiescing the old Gateway.
Block on the structured finding and present requirement, target, and
fixHint. Do not scrape human error strings, invoke setup automatically,
substitute unfiltered Doctor, or treat a clean result from this single check as
universal startup readiness.

Release-note impact: external supervisors can detect missing managed local
embedding setup before stopping a healthy Gateway.

AI-assisted: yes. No agent transcript is included.

@clawsweeper

clawsweeper Bot commented Aug 14, 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: memory-core Extension: memory-core cli CLI command changes commands Command implementations extensions: llama-cpp size: XL maintainer Maintainer-authored PR labels Aug 14, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Aug 14, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 9:27 PM ET / August 16, 2026, 01:27 UTC.

ClawSweeper review

What this changes

Adds an opt-in Doctor lint check that detects when an existing Memory Core semantic index uses local embeddings without managed llama.cpp setup.

Merge readiness

⚠️ Ready for maintainer review - 5 items remain

Keep open for maintainer review. The latest head appears to address the prior deferred-snapshot finding, but this is a substantial new, default-disabled readiness capability and installed-provider policy contract rather than a narrow established-behavior repair.

Priority: P2
Reviewed head: fe400dc32ba0b35d2a9b819a20aea0cc8a00b96d
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is substantial and its latest source addresses the prior snapshot concern, but merge readiness depends on explicit contract sponsorship and fresh exact-head validation.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is outside the external-contributor proof gate; its body nevertheless records claimed packaged and source-blind behavior checks.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is outside the external-contributor proof gate; its body nevertheless records claimed packaged and source-blind behavior checks.
Evidence reviewed 6 items Deferred inspection at the selected owner boundary: The new Memory Core check reads semantic-index state before invoking provider setup inspection, so the provider-state snapshot is deferred until an index makes the check relevant.
Selection-aware lint path: The CLI selects the deferred config/state path only for the isolated check, while mixed selections use a private snapshot and ordinary lint remains direct.
Installed-provider trust boundary: Provider inspection resolves bundled policy first and only loads an external policy artifact when its manifest marks the install trusted and official.
Findings None None.
Security None None.

How this fits together

Doctor lint reads configuration, Memory Core’s existing index metadata, and provider-owned setup policy to emit structured readiness findings. Upgrade supervisors can consume that output before deciding whether to replace a running Gateway.

flowchart LR
  A[Upgrade supervisor] --> B[Doctor lint command]
  B --> C[Memory Core index check]
  C --> D[Provider setup policy]
  D --> E[Structured readiness finding]
  E --> F[Cutover decision]
Loading

Decision needed

Question Recommendation
Should OpenClaw permanently own this generic provider-to-Doctor readiness contract for an external upgrade supervisor, beginning with managed local embeddings? Sponsor the scoped readiness contract: Keep the default-disabled check and generic provider-owned predicate, then require fresh merge-result validation for normal lint, --all, and installed-provider upgrades.

Why: The source supports the proposed ownership split, but deciding whether this single provider cutover requirement merits a new generic installed-provider policy hook is product and compatibility direction, not a mechanical correctness choice.

Before merge

  • Resolve merge risk (P1) - Merging changes doctor --lint --all and explicit scoped lint outcomes for existing local semantic indexes, so automation may newly block an upgrade until llama.cpp setup is completed.
  • Resolve merge risk (P1) - The PR adds a generic provider-policy hook and executes a trusted installed provider artifact during Doctor; maintainers need to confirm that this is the intended durable control-plane contract.
  • Resolve merge risk (P1) - Production code grows by 635 net lines across Doctor, config, plugin discovery, and SQLite inspection paths for one provider-specific cutover signal.
  • Resolve merge risk (P1) - The head is behind current main and exact-head CI is still incomplete, including a failed dependency check; refresh and validate the merge result before landing.
Agent review details

Security

None.

PR surface

Source +635, Tests +1357, Docs +7. Total +1999 across 29 files.

View PR surface stats
Area Files Added Removed Net
Source 18 725 90 +635
Tests 10 1371 14 +1357
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 29 2103 104 +1999

Review metrics

Metric Value Why it matters
Production versus test LOC production +725/-90; tests +1371/-14; docs +7 The large production increase crosses Doctor, config, plugin-policy, and SQLite-inspection boundaries, so its new capability and owner split need explicit sponsorship.
New readiness surface 1 default-disabled Doctor check; 1 provider-policy hook; 0 new user config options The check is opt-in, but --all and selected automation gain a new failure mode for existing installations.

Stored data model

Persistent data-model change detected: database schema: extensions/memory-core/src/doctor-health.test.ts, migration/backfill/repair: docs/cli/doctor.md, migration/backfill/repair: extensions/llama-cpp/doctor-contract-api.test.ts, migration/backfill/repair: extensions/memory-core/api.ts, migration/backfill/repair: extensions/memory-core/src/doctor-health.test.ts, migration/backfill/repair: extensions/memory-core/src/doctor-health.ts, and 26 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Confirm scope, then refresh proof (recommended)
    Approve the provider-owned pre-cutover contract, rebase or merge-refresh the head, and require exact-head tests and CI covering normal lint, --all, and the scoped check.
  2. Pause the new readiness surface
    Close or defer this branch if a one-provider supervisor signal is not sufficient justification for a durable cross-plugin Doctor policy contract.

Technical review

Best possible solution:

If maintainers sponsor this pre-cutover capability, retain the default-disabled, provider-owned predicate and prove a freshly merged head preserves both ordinary lint behavior and immutable inspection under live writer contention.

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

No high-confidence reviewer-side execution was performed in this read-only review. Source establishes the runtime prerequisite and the PR body supplies claimed packaged before/after evidence, but that exact setup was not independently run here.

Is this the best way to solve the issue?

Unclear. The provider-owned predicate and Memory Core relevance split are coherent, but maintainers must decide whether the generic provider-policy contract is the right permanent layer for this one pre-cutover workflow.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is outside the external-contributor proof gate; its body nevertheless records claimed packaged and source-blind behavior checks.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a targeted operator-facing readiness improvement, but it is default-disabled and does not establish an urgent default-path outage.
  • merge-risk: 🚨 compatibility: Existing installed-provider and supervisor workflows can receive a new blocking lint finding or unsupported-provider result after upgrade.
  • merge-risk: 🚨 availability: A false or indeterminate readiness result can prevent an external supervisor from cutting over to an otherwise usable Gateway.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is outside the external-contributor proof gate; its body nevertheless records claimed packaged and source-blind behavior checks.

Evidence

What I checked:

Likely related people:

  • Josh Avant: Current-main blame and history attribute the existing lint registration and vector-index provider diagnostic to this commit. (role: introduced adjacent Doctor and Memory Core diagnostic behavior; confidence: high; commits: fc4d5d744fad; files: src/commands/doctor-lint.ts, src/flows/bundled-health-checks.ts, extensions/memory-core/src/migration/doctor-vector-index-provider-diagnostic.ts)
  • fuller-stack-dev: The related merged llama.cpp compatibility and read-only Doctor lint PRs establish recent involvement beyond this proposed branch. (role: recent contributor to adjacent provider and Doctor compatibility work; confidence: medium; commits: a02ed2cfda80, b1b06d12125b; files: extensions/llama-cpp, src/commands/doctor-lint.ts)

Rank-up moves

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

  • Obtain maintainer confirmation that the new provider-to-Doctor policy hook is an intended permanent contract.
  • Refresh the branch against current main and clear exact-head CI before landing.

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 (25 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-15T09:17:23.378Z sha 54ad902 :: needs changes before merge. :: [P1] Normalize the selected memory provider before inspecting it
  • reviewed 2026-08-15T09:46:05.733Z sha 0d82411 :: needs changes before merge. :: [P1] Do not load the external llama.cpp plugin as a bundled artifact
  • reviewed 2026-08-15T10:23:22.915Z sha 3086342 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T11:33:01.498Z sha 21a5722 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-15T12:04:44.077Z sha 21a5722 :: found issues before merge. :: [P2] Re-register the check after health-registry resets
  • reviewed 2026-08-15T12:44:14.747Z sha 9d35b37 :: found issues before merge. :: [P1] Scope the SQLite snapshot to the selected check
  • reviewed 2026-08-15T13:05:09.324Z sha 9fe4ead :: found issues before merge. :: [P1] Scope the SQLite snapshot to the selected check
  • reviewed 2026-08-16T00:30:13.755Z sha 2ca7ae8 :: found issues before merge. :: [P2] Defer the state snapshot until an index requires it

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Aug 14, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Addressing the valid prior review finding at
#123575 (comment):

  • On old head a2a459802e6a22f895b2b1be7658799418541b53, I reproduced a
    real non-memory false-ready case: malformed legacy session state made
    preflight exit 0/ready, while direct Gateway startup exited 1 with
    store_unreadable.
  • Exact head f74925a9ba826cac1a06254b71b9d13f1c977aa3 now feeds the core
    session startup owner's read-only validation and existing warning classifier
    into the aggregate preflight. The malformed fixture exits 1 with a stable
    core/session diagnostic, and direct startup agrees.
  • Missing session state and warning-only migrated state remain ready. Channel
    startup failures are caught and logged by the existing lifecycle, so they are
    not promoted into deterministic cutover blockers.
  • Memory diagnostics are enumerated through the startup-migration diagnostic
    owner, independent of loading a memory runtime adapter; the selected provider
    still owns its exact prerequisite and remediation.
  • Source-blind exact-head proof passed under network denial with byte-identical
    repeated JSON and no config/state/SQLite/WAL/SHM mutation. Exact-head build,
    Knip dependency scan, production type checks, focused tests, and fresh
    autoreview are green.

The contract remains authoritative only for declared deterministic startup
blockers; unsupported inspection fails closed as indeterminate, and later
nondeterministic runtime failures remain outside its promise.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 14, 2026
@fuller-stack-dev
fuller-stack-dev requested a review from a team as a code owner August 14, 2026 10:48
@clawsweeper clawsweeper Bot removed the rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. label Aug 14, 2026
Comment thread src/commands/doctor-lint.test.ts Fixed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact head 2ca7ae83f8e102bcf70e4477a62b25d06896fee5 addresses the prior P1 by isolating shared SQLite state only for a selected check that declares it. The active-writer negative control proves unrelated selected Doctor lint remains successful and deterministic. The later OpenGrep test-helper thread is also fixed by explicit restoration of only the three scoped environment variables. Exact package/source-blind proof, 53 focused tests, formatting, and fresh branch-wide P1 autoreview are green; native review artifacts validate with zero findings.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
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:

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact public head afe8c2d82d84efc153b2958be2b99813285d1f39 now contains canonical main 2585edba2efda9ff50e6bed0a6de8cfaef8254fc. The only live review thread is resolved/outdated. Exact-head proof is green: 71 focused owner tests plus the default plugin-validation guard, pnpm deadcode:full, formatting/diff checks, Testbox package/tarball integrity (run 31920657551), source-blind network-denied non-mutation and direct-Gateway agreement, and fresh P1 autoreview with no findings. Repository-native review artifacts validate READY FOR /prepare-pr with zero findings.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

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

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: llama-cpp extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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.

2 participants