fix(cli): improve memory_search error message with actionable guidance#59488
fix(cli): improve memory_search error message with actionable guidance#59488rrrrrredy wants to merge 4 commits into
Conversation
When memory_search fails due to a missing node:sqlite built-in module,
the error response previously said:
warning: 'Memory search is unavailable due to an embedding/provider error.'
action: 'Check embedding provider configuration and retry memory_search.'
This is misleading — the root cause is a Node.js runtime compatibility
issue, not an embedding provider misconfiguration.
After this fix, when the error message contains 'node:sqlite' or
'no such built-in module.*sqlite', the response returns:
warning: 'Memory search is unavailable because node:sqlite is not
available in this Node.js runtime.'
action: 'node:sqlite requires Node.js 22.5+ compiled with SQLite
support. Check your Node.js build or run:
openclaw doctor --memory to see remediation options.'
Also adds a test case for this scenario.
Fixes openclaw#59457.
Greptile SummaryThis PR improves However, the accompanying test in Confidence Score: 3/5
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ee3061313
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| : "Check embedding provider configuration and retry memory_search."; | ||
| : isSqliteMissing | ||
| ? "node:sqlite requires Node.js 22.5+ compiled with SQLite support. " + | ||
| "Check your Node.js build or run: openclaw doctor --memory to see remediation options." |
There was a problem hiding this comment.
Point users to a valid doctor command
The new remediation text tells users to run openclaw doctor --memory, but that flag does not exist, so following this advice yields an unknown-option error instead of help. In registerMaintenanceCommands the doctor command only defines flags like --fix, --deep, and --non-interactive (see src/cli/program/register.maintenance.ts), so this guidance is currently non-actionable in the exact failure path it was meant to improve.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in commit e6c8979: changed openclaw doctor --memory to openclaw doctor in the actionable error message. The --memory flag does not exist on the doctor command.
CI Failures NoteThe failing checks in this PR (
No regressions were introduced by this PR. |
'openclaw doctor --memory' does not exist; the correct command is 'openclaw doctor'. Also make the Node.js version requirement explicit (node:sqlite requires v22.5+).
…xpectation The new it block was placed after the describe's closing }), outside the describe scope, causing beforeEach fixture resets to be skipped. Move it inside the describe block. Also update the expected action string to match the corrected message in tools.shared.ts (openclaw doctor, not openclaw doctor --memory).
|
Addressed all review feedback in latest commits:
All bot review comments have been resolved. |
…ssage The test expectation was stale — tools.shared.ts was updated to 'Check your Node.js build (node:sqlite requires Node.js v22.5+) or run `openclaw doctor` to diagnose.' but tools.test.ts still had the old wording, causing the CI assertion to fail.
|
Relationship with PR #59637 PR #59637 addresses the same issue (#59457) with a more focused change (only adds the Suggested merge strategy for maintainers:
I will rebase this PR on top of #59637 once it is merged to avoid conflicts. |
|
CI failures are pre-existing and unrelated to this PR. All failing checks fail on the same pre-existing test in |
1 similar comment
|
CI failures are pre-existing and unrelated to this PR. All failing checks fail on the same pre-existing test in |
Summary
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause / Regression History (if applicable)
Regression Test Plan (if applicable)
User-visible / Behavior Changes
[describe or None]
Security Impact (required)
Human Verification (required)
Review Conversations
Compatibility / Migration
Summary
When
memory_searchfails (e.g. due to missingnode:sqlite), the error response previously contained a non-actionable message that misdiagnosed the root cause as an "embedding/provider error".This PR improves the error messages to surface the actual underlying error and suggest a concrete remediation path for each failure type.
Changes
extensions/memory-core/src/tools.shared.ts:insufficient_quota)node:sqlitemissing errorswarning+actioninstead of a generic fallbackBefore / After
Before (node:sqlite missing):
{ "warning": "Memory search is unavailable due to an embedding/provider error.", "action": "Check embedding provider configuration and retry memory_search." }After:
{ "warning": "Memory search is unavailable because node:sqlite is not available in this Node.js runtime. The built-in SQLite module requires Node.js 22.5+ compiled with SQLite support.", "action": "Upgrade to Node.js 22.5+ (with SQLite support) or configure an external embedding provider (e.g. OpenAI, Ollama) via memory.provider in openclaw.json. See https://docs.openclaw.ai/memory for setup instructions." }Testing
extensions/memory-core/src/tools.test.tscovering all three error paths: quota error, generic error, and node:sqlite missingsetMemorySearchImplto inject error conditions andexpectUnavailableMemorySearchDetailsto assert response shapeRelated
Fixes #59457