Skip to content

doctor(memory): surface FTS5 unavailable state in doctor checks - #62338

Closed
ZanderH-code wants to merge 4 commits into
openclaw:mainfrom
ZanderH-code:codex/doctor-fts5-warning
Closed

ZanderH-code wants to merge 4 commits into
openclaw:mainfrom
ZanderH-code:codex/doctor-fts5-warning

Conversation

@ZanderH-code

@ZanderH-code ZanderH-code commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #62328. openclaw doctor could report memory embeddings as ready while SQLite FTS5 keyword/BM25 fallback was unavailable in the running gateway, leaving operators without a visible diagnosis.

What Changed

  • Extend doctor.memory.status with validated fts fields (enabled, available, and optional error).
  • Carry the gateway FTS probe through probeGatewayMemoryStatus.
  • Warn from noteMemorySearchHealth when the gateway reports FTS unavailable.
  • Keep malformed gateway FTS payloads out of the typed doctor response.

Evidence

  • Targeted gateway handler coverage verifies valid FTS state is returned and malformed state is ignored.
  • Targeted doctor coverage verifies unavailable FTS5 produces an operator warning, available FTS does not warn, and explicitly disabled memory search keeps its existing early exit.
  • The repaired aggregate diff is limited to the doctor gateway-health, memory-search, and gateway doctor RPC surfaces plus focused tests.
  • Clownfish validation and review completed successfully on head 5a7b237c2f155584d36204119d612f252ee01070.

Test Plan

  • pnpm test:serial src/commands/doctor-gateway-health.test.ts src/commands/doctor-memory-search.test.ts src/gateway/server-methods/doctor.test.ts
  • pnpm check:changed

Required GitHub checks must be green before merge.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime commands Command implementations size: S labels Apr 7, 2026
@greptile-apps

greptile-apps Bot commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR surfaces SQLite FTS5 unavailability in openclaw doctor by extending the doctor.memory.status gateway payload with an fts probe field, threading it through probeGatewayMemoryStatus, and emitting a dedicated doctor warning in noteMemorySearchHealth when FTS is reported unavailable. The implementation is clean and the test coverage is solid.

Confidence Score: 5/5

Safe to merge — no functional or data-integrity issues found.

All findings are P2 style/cleanup suggestions; the core logic, type guards, and test coverage are correct.

No files require special attention.

Comments Outside Diff (1)

  1. src/commands/doctor-memory-search.ts, line 177-187 (link)

    P2 Inline fts type duplicates GatewayMemoryProbe

    The opts.gatewayMemoryProbe inline type re-declares the fts shape already exported as GatewayMemoryProbe from doctor-gateway-health.ts. Importing and reusing that type keeps the contract in one place.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/commands/doctor-memory-search.ts
    Line: 177-187
    
    Comment:
    **Inline `fts` type duplicates `GatewayMemoryProbe`**
    
    The `opts.gatewayMemoryProbe` inline type re-declares the `fts` shape already exported as `GatewayMemoryProbe` from `doctor-gateway-health.ts`. Importing and reusing that type keeps the contract in one place.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/commands/doctor-memory-search.ts
Line: 177-187

Comment:
**Inline `fts` type duplicates `GatewayMemoryProbe`**

The `opts.gatewayMemoryProbe` inline type re-declares the `fts` shape already exported as `GatewayMemoryProbe` from `doctor-gateway-health.ts`. Importing and reusing that type keeps the contract in one place.

```suggestion
  opts?: {
    gatewayMemoryProbe?: import("./doctor-gateway-health.js").GatewayMemoryProbe;
  },
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "doctor(memory): surface FTS5 unavailabil..." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor Author

Addressed the review suggestion about duplicated type shape.

Changes pushed in commit 550ed05:

  • Reused GatewayMemoryProbe in noteMemorySearchHealth options instead of inlining a duplicate gatewayMemoryProbe type.
  • Kept behavior unchanged.

Validation run:

  • corepack pnpm exec vitest src/commands/doctor-memory-search.test.ts -t "warns when gateway probe reports FTS unavailable"

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label May 1, 2026
@clawsweeper

clawsweeper Bot commented May 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 6, 2026, 6:14 PM ET / 22:14 UTC.

Summary
The PR adds an optional fts object to the gateway doctor memory status payload, carries it through the CLI gateway probe, and warns from openclaw doctor when gateway memory search reports FTS5 unavailable.

PR surface: Source +72, Tests +148. Total +220 across 6 files.

Reproducibility: yes. at source level: current main records FTS availability in memory-core status but drops it from the gateway doctor payload and CLI doctor warning path. I did not run a live FTS5-unavailable gateway in this read-only review.

Review metrics: 1 noteworthy metric.

  • Gateway doctor payload: 1 optional response field added. doctor.memory.status.fts is an additive operator/protocol shape that maintainers should notice before merge.

Stored data model
Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-gateway-health.test.ts, migration/backfill/repair: src/commands/doctor-gateway-health.ts, migration/backfill/repair: src/commands/doctor-memory-search.test.ts, migration/backfill/repair: src/commands/doctor-memory-search.ts, migration/backfill/repair: src/gateway/server-methods/doctor.test.ts, migration/backfill/repair: src/gateway/server-methods/doctor.ts, and 5 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #62328
Summary: This PR is the candidate implementation for the doctor/status visibility portion of the canonical FTS5-unavailable memory-search issue; broader recall restoration remains separate.

Members:

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

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted live openclaw doctor terminal output, logs, or a short recording from a gateway that reports FTS5 unavailable.
  • [P1] If maintainers want this documented as public gateway protocol, add or restore docs for the optional doctor.memory.status.fts field.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR has tests and generic validation text, but no inspectable redacted terminal output, logs, recording, or linked artifact showing the after-fix openclaw doctor warning in an FTS5-unavailable gateway setup. 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.

Risk before merge

  • [P1] The contributor-visible proof is still insufficient for the external-PR real-behavior gate: tests and generic validation do not show the changed openclaw doctor output in an FTS5-unavailable gateway setup.
  • [P1] The PR adds one optional doctor.memory.status response field; it is additive, but maintainers should still confirm the protocol/docs expectation before merge.

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow diagnostic forwarding after adding redacted real openclaw doctor output or logs from an FTS5-unavailable gateway; leave the broader keyword/BM25 recall restoration tracked by the canonical memory-search issue and adjacent fallback PR.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] The remaining blocker is contributor-visible real behavior proof and normal maintainer review of the additive doctor payload, not a safe autonomous code repair.

Security
Cleared: The diff changes doctor/gateway diagnostic code and focused tests only; I found no dependency, workflow, secret, permission, package, or code-execution surface change.

Review details

Best possible solution:

Land the narrow diagnostic forwarding after adding redacted real openclaw doctor output or logs from an FTS5-unavailable gateway; leave the broader keyword/BM25 recall restoration tracked by the canonical memory-search issue and adjacent fallback PR.

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

Yes, at source level: current main records FTS availability in memory-core status but drops it from the gateway doctor payload and CLI doctor warning path. I did not run a live FTS5-unavailable gateway in this read-only review.

Is this the best way to solve the issue?

Yes for the diagnostic slice: forwarding the existing memory-core FTS status through gateway doctor status and warning rendering is the narrow owner-boundary fix. It does not solve the broader keyword/BM25 recall restoration problem.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a normal-priority diagnostic fix for a real memory-search degradation while vector search and the wider runtime remain usable.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR has tests and generic validation text, but no inspectable redacted terminal output, logs, recording, or linked artifact showing the after-fix openclaw doctor warning in an FTS5-unavailable gateway setup. 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

PR surface:

Source +72, Tests +148. Total +220 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 80 8 +72
Tests 3 159 11 +148
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 239 19 +220

What I checked:

  • Repository policy read: Root AGENTS.md and the scoped gateway/server-methods guides were read; their review policy makes gateway protocol changes, proof quality, and source-plus-history checks relevant to this PR. (AGENTS.md:1, e80e8a2b6730)
  • Current main omits FTS from doctor payload: Current DoctorMemoryStatusPayload exposes embedding and Dreaming data, and the handler responds with agentId, provider, embedding, and dreaming without forwarding manager.status().fts. (src/gateway/server-methods/doctor.ts:116, e80e8a2b6730)
  • Memory-core already has the FTS fact: The memory manager already reports fts.enabled, fts.available, and fts.error from its status object, so the PR forwards an existing owner fact rather than adding a new runtime probe. (extensions/memory-core/src/memory/manager.ts:1180, e80e8a2b6730)
  • Doctor CLI path consumes the gateway memory probe: runGatewayHealth stores probeGatewayMemoryStatus(...), and runMemorySearchHealthContribution passes that probe into noteMemorySearchHealth, which is the path this PR extends. (src/flows/doctor-health-contributions.ts:1140, e80e8a2b6730)
  • PR implements the diagnostic forwarding: The PR diff adds the optional fts response shape, validates boolean enabled/available, trims an optional error, threads it through GatewayMemoryProbe, and emits a dedicated FTS5 warning. (src/gateway/server-methods/doctor.ts:124, 5a7b237c2f15)
  • Focused tests cover the new contract: The PR adds tests for valid FTS status, malformed FTS status, available/no-warning behavior, unavailable warning behavior, and the disabled-memory early exit. (src/commands/doctor-memory-search.test.ts:1226, 5a7b237c2f15)

Likely related people:

  • therk: Commit 8d69251 added the gateway memory doctor probe and touched the same doctor command and gateway server-method files this PR extends. (role: introduced doctor memory probe path; confidence: medium; commits: 8d6925147599; files: src/commands/doctor-gateway-health.ts, src/commands/doctor-memory-search.ts, src/gateway/server-methods/doctor.ts)
  • gumadeiras: Commit metadata for the merged doctor memory probe work lists gumadeiras as reviewer and co-author, and commit 2816f69 directly changed the same doctor probe files. (role: reviewer/merger and adjacent contributor; confidence: medium; commits: 2816f69d8bd4, 8d6925147599; files: src/commands/doctor-gateway-health.ts, src/commands/doctor-memory-search.ts, src/gateway/server-methods/doctor.ts)
  • steipete: Commit cad83db moved the memory engine into the memory plugin and includes the memory manager status path whose fts shape this PR forwards. (role: memory engine and FTS status history contributor; confidence: medium; commits: cad83db8b2f7, 75423a00d610; files: extensions/memory-core/src/memory/manager.ts, src/gateway/server-methods/doctor.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (1 earlier review cycle)
  • reviewed 2026-07-03T23:00:59.450Z sha e14540270559917658a471fad9a860a6a9017b42 :: needs real behavior proof before merge. :: [P3] Remove the release-owned changelog entry

@ZanderH-code
ZanderH-code force-pushed the codex/doctor-fts5-warning branch from 7c56aa9 to e145402 Compare May 2, 2026 18:18
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label May 2, 2026
@ZanderH-code

Copy link
Copy Markdown
Contributor Author

Updated this PR to align with current main and the review follow-ups.

What changed:

  • rebased the branch onto the latest main
  • preserved the newer gateway/doctor probe semantics from current main while keeping the FTS5 visibility change
  • added the required CHANGELOG.md entry
  • documented the additive doctor.memory.status.fts field in docs/gateway/protocol.md
  • kept noteMemorySearchHealth(...) using GatewayMemoryProbe instead of duplicating the probe shape

Validation:

  • corepack pnpm exec vitest src/gateway/server-methods/doctor.test.ts -t "returns gateway embedding probe status for the default agent"
  • corepack pnpm exec vitest src/commands/doctor-memory-search.test.ts -t "warns when gateway probe reports FTS unavailable"
  • git diff --check

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label May 3, 2026
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels May 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 19, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 5, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed 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 Jun 5, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 6, 2026
@clawsweeper clawsweeper Bot added 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. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Jun 14, 2026
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. 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 Jun 16, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. label Jun 23, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 23, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 3, 2026
@vincentkoc
vincentkoc force-pushed the codex/doctor-fts5-warning branch from e145402 to 466c2ec Compare July 6, 2026 21:55
@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label Jul 6, 2026
@vincentkoc vincentkoc self-assigned this Jul 6, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 6, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 7, 2026
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

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

Labels

commands Command implementations gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node:sqlite missing FTS5 module — memory search keyword fallback broken

2 participants