Repository navigation
fix(memory): return JSON when the memory backend is unavailable - #140229
Conversation
Report disabled memory and backend acquisition failures through the existing single-command JSON writers. Reuse the canonical CLI error envelope and preserve status aggregation, diagnostics, exit codes, and manager cleanup. Absorb the redundant acquisition wrapper into its command owner. Closes #140184.
|
🦞👀 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. |
|
Codex review: blocked before merge. Reviewed September 6, 2026, 11:46 AM ET / 15:46 UTC. ClawSweeper reviewWhat this changesThe memory CLI now returns JSON for disabled or unavailable backends across six commands, with regression coverage and documentation for the alternate results. Merge readiness⛔ Blocked before merge - 1 item remains The repair remains necessary: current main and v2026.9.2 retain the empty-output branch. No actionable correctness or security defects were found in the introduced changes. Priority: P2 Review scores
Verification
How this fits togetherThe bundled Memory Core plugin handles memory CLI commands and acquires each agent's search backend before doing work. This change makes acquisition outcomes readable by scripts while preserving successful results and aggregate status output. flowchart TD
A[Memory CLI command] --> B[Resolve agent and configuration]
B --> C[Acquire memory backend]
C --> D{Backend available?}
D -->|Yes| E[Run command and close backend]
D -->|No| F[Emit availability JSON and diagnostics]
E --> G[Normal command result]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +120, Docs +14. Total +133 across 7 files. View PR surface stats
Review metricsNone. 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. Technical reviewBest possible solution: Keep availability reporting in the shared acquisition owner, with distinct disabled and failed outcomes and unchanged successful command contracts. Do we have a high-confidence way to reproduce the issue? Yes, from source: disable memory search and invoke memory search with --json; current main returns from acquisition before writing a result. The linked report supplies a matching built-CLI reproduction; this review did not execute it. Is this the best way to solve the issue? Yes. The patch repairs the shared early-return path, reuses the canonical error envelope, and avoids changing successful results, status aggregation, or backend lifecycle behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 62da492b5207. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Report disabled memory and backend acquisition failures through the existing single-command JSON writers. Reuse the canonical CLI error envelope and preserve status aggregation, diagnostics, exit codes, and manager cleanup. Absorb the redundant acquisition wrapper into its command owner. Closes openclaw#140184.
Closes #140184
Additional instructions
Keep Allow edits from maintainers enabled when applicable.
What Problem This Solves
Fixes an issue where users running
memory search --jsonreceive an empty stdout stream and exit code 0 when memory search is disabled. JSON consumers cannot parse that response or distinguish an unavailable backend from a completed search. Five other single-agent JSON commands share the same missing-manager branch.Why This Change Was Made
The memory plugin's manager-acquisition owner now emits one availability result for
search,promote,promote-explain,rem-harness,rem-backfill, andsession-backfillwhen their--jsonoption is selected. The change absorbs a redundant one-caller wrapper and reuses the canonical CLI error formatter through the existing private memory host facade; status retains ownership of its single aggregate array.User Impact
Disabled commands return
{"agentId":"main","status":"disabled"}with the existing successful exit behavior. Acquisition failures return the standard{"ok":false,"error":{"type":"cli_error","message":"..."}}envelope plusagentId, with exit code 1. The memory CLI documentation explains these alternate outcomes before consumers read normal result fields.Successful result shapes remain intact, including
{"results":[]}for an enabled search with no matches. Status still returns its array of available agents, including[]when all are disabled. Existing diagnostics, argument validation, and manager cleanup remain at their current owners; unavailable commands do not run search, promotion, or backfill work or invent completed-work counts. No configuration, database schema, migration, or protocol change is included.Evidence
Candidate:
90b87fa859f2a85f99de69ea6a4fb1b0761ceed2oncodex/qa-memory-json-20260906.c2ffbec6fc9af0da51921acfb5bbb19b66aecd78, Node v24.20.0Memory search disabled.and newline. Disabled status:[]. Enabled positive and no-match searches: valid JSON. The isolated fixture was cleaned up.90b87fa859f2a85f99de69ea6a4fb1b0761ceed2; source, dependency and artifact identities verified.90b87fa859f2a85f99de69ea6a4fb1b0761ceed2.The backend-open fixture is an empty directory at the database filename inside fresh isolated state; it exercises real acquisition errors without writing database records. No model or external provider request is involved.
The candidate contains 44 added / 45 removed production lines (net −1), 122 added / 2 removed test lines (net +120), and 14 added documentation lines. No generated files, lockfiles, or snapshots changed.
Review follow-through
The September 6, 15:46 UTC ClawSweeper review of the exact candidate found no correctness or security defects. Its sole before-merge item, “Add data-model compatibility proof,” is not applicable to this patch: the six edits in the search/promotion and REM/backfill callers only pass the JSON writer to the shared acquisition owner. That owner preserves the same configuration, agent, purpose, source-inspection and local-service arguments; missing managers still return before work, and successful managers retain the same cleanup.
Compared with the PR parent, the complete memory storage implementation, state database owners, memory host SDK, configuration, plugin manifest and canonical database schema documentation are unchanged. The patch changes no stored vector/embedding metadata, schema, migration or persisted representation. The existing paired built-CLI proof confirms real backend-open failure handling and unchanged enabled indexing/search/status controls; it is not presented as a migration test. No migration is needed for an output-only availability result.