Skip to content

fix(memory): suggest reindex, not --fix, for a missing qmd index - #116958

Merged
steipete merged 1 commit into
openclaw:mainfrom
chelsealong:fix/memory-status-qmd-missing-index-hint
Jul 31, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
chelsealong:fix/memory-status-qmd-missing-index-hint

Conversation

@chelsealong

@chelsealong chelsealong commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #116937.

When an agent has no qmd store at all (0 files, no index — not a stale
one), openclaw memory status --agent <id> reports the audit issue
"QMD index file is missing." followed by a blanket hint:

Fix: openclaw memory status --fix --agent <id>

Running that suggested --fix returns Repair: no changes and leaves
the problem unresolved. Per --help, --fix only repairs stale recall
locks and normalizes promotion metadata — it has no code path that
creates a missing qmd index. The audit issue for a missing qmd index
(qmd-index-missing) is already marked fixable: false in
short-term-promotion-artifacts.ts, but cli-status.runtime.ts always
printed the --fix hint whenever any audit issue existed, regardless
of whether that issue was actually repairable by --fix.

Why This Change Was Made

extensions/memory-core/src/cli-status.runtime.ts builds the "Issues"
section of memory status from audit.issues /
dreamingAudit.issues, each of which already carries a fixable
boolean. The fix hint should reflect that flag instead of firing
unconditionally:

  • Only print Fix: openclaw memory status --fix --agent <id> when at
    least one present issue is actually fixable: true (applies to both
    the short-term promotion audit and the dreaming-artifacts audit).
  • When the qmd index file is missing (qmd-index-missing), print
    Fix: openclaw memory index --agent <id> instead — memory index
    runs the manager's sync/reindex path, which creates the missing
    index from scratch (confirmed by reading
    extensions/memory-core/src/cli-index-search.runtime.ts, where
    runMemoryIndex calls syncFn and only stats the resulting db file
    afterward).

This is the minimal fix described as option 2 in the issue: change the
suggested remediation message rather than teaching --fix a new,
unrelated repair path.

User Impact

Operators debugging an agent with a missing memory index now get a
command that actually resolves the problem, instead of being sent down
a dead-end (--fix reporting "no changes"). No behavior changes for
any issue that --fix can actually repair.

Evidence

Added a test in extensions/memory-core/src/cli.test.ts:
"suggests reindexing instead of --fix when the qmd index is missing".
It sets a qmd-backend status pointing at a nonexistent db path and
asserts the output contains Fix: openclaw memory index --agent main
and does not contain Fix: openclaw memory status --fix --agent main.

Confirmed the test fails without the fix (reverted only
cli-status.runtime.ts via git checkout HEAD~1 -- extensions/memory-core/src/cli-status.runtime.ts, ran the test, saw
the old blanket Fix: openclaw memory status --fix --agent main hint
printed instead), then restored the fix and re-ran:

$ node scripts/run-vitest.mjs extensions/memory-core/src/cli.test.ts
 Test Files  1 passed (1)
      Tests  79 passed (79)

Also ran, both clean:

$ ./node_modules/.bin/oxfmt --check extensions/memory-core/src/cli-status.runtime.ts extensions/memory-core/src/cli.test.ts
$ node scripts/check-changed.mjs -- extensions/memory-core/src/cli-status.runtime.ts extensions/memory-core/src/cli.test.ts
# typecheck extensions / typecheck extension tests / lint extension changed files / guards all passed

AI-assistance disclosure: this change was authored with the assistance
of an AI coding agent (Claude), reviewed and validated as described
above before being pushed.

Real QMD Behavior Proof

Requested by ClawSweeper review: a redacted terminal transcript from a
real QMD-backed agent showing the missing-index status, openclaw memory index --agent <id> running, and the follow-up status no longer
reporting the missing-index condition.

Ran against a real qmd binary (npm install -g @tobilu/qmd, v2.5.3)
in an isolated HOME/state dir (no mocks, no CLI-internal test
harness):

$ node openclaw.mjs config patch --stdin <<< '{ "memory": { "backend": "qmd" } }'
Applied 1 config update(s). Restart the gateway to apply.

$ mkdir -p ~/.openclaw/workspace/memory
$ echo '# Test note' > ~/.openclaw/workspace/memory/notes.md

$ node openclaw.mjs memory status --agent main
Memory Search (main)
Provider: qmd (requested: qmd)
...
Store: ~/.openclaw/agents/main/qmd/xdg-cache/qmd/index.sqlite
...
Issues:
  sessions directory missing (~/.openclaw/agents/main/sessions)
  QMD index file is missing.
  Fix: openclaw memory index --agent main

$ node openclaw.mjs memory index --agent main
[memory] qmd manager initialized for agent "main" mode=cli collections=3 durationMs=933
[memory] qmd sync completed for agent "main" reason=cli durationMs=196
QMD index: ~/.openclaw/agents/main/qmd/xdg-cache/qmd/index.sqlite (114688 bytes)
Memory index updated (main).

$ node openclaw.mjs memory status --agent main
Memory Search (main)
Provider: qmd (requested: qmd)
...
Indexed: 1/1 files · 1 chunks
Store: ~/.openclaw/agents/main/qmd/xdg-cache/qmd/index.sqlite
...
Issues:
  sessions directory missing (~/.openclaw/agents/main/sessions)

Before the fix (missing index, main had the unconditional hint), the
last line of the first status run would instead have been Fix: openclaw memory status --fix --agent main, which repairs nothing for
this issue. With the fix, the hint is openclaw memory index --agent main, and running it creates the real QMD index.sqlite from
scratch, after which the "QMD index file is missing." issue and its
hint no longer appear in status output — confirming memory index
resolves the exact reported condition end-to-end against a real QMD
sidecar.

`memory status` always appended "Fix: openclaw memory status --fix"
when any audit issue was present, even when none of the issues were
actually repaired by --fix. A missing qmd index file (qmd-index-missing)
is marked fixable: false, so running the suggested --fix left the
issue unresolved. Gate the --fix hint on at least one fixable issue,
and suggest `openclaw memory index --agent <id>` (which builds a fresh
index) when the qmd index file is missing.
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 31, 2026
@clawsweeper

clawsweeper Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 1:37 PM ET / 17:37 UTC.

ClawSweeper review

What this changes

The PR changes Memory Core status guidance so a missing QMD index recommends reindexing, while --fix is suggested only for repairable audit issues.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: current main still gives a non-working memory status --fix instruction for a missing QMD index. The patch corrects that recovery guidance at the status-output boundary, adds focused coverage, and the updated PR body now provides credible real-QMD terminal proof; no correctness or security finding was identified.

Priority: P2
Reviewed head: 1fc4276872e7afdc7bbeff9b21e0cb6c079cb233

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-aligned repair with an explicit regression assertion and credible real-QMD command proof.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The updated PR body contains an after-fix terminal transcript against a real QMD binary: status reports the new command, indexing creates the database, and the follow-up status clears the missing-index condition.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The updated PR body contains an after-fix terminal transcript against a real QMD binary: status reports the new command, indexing creates the database, and the follow-up status clears the missing-index condition.
Evidence reviewed 5 items Current-main defect: Current main appends the memory status --fix command whenever any short-term audit issue exists, although the missing-QMD-index audit issue is explicitly non-fixable.
Correct recovery owner: The index command binds the active manager’s sync method, and the QMD manager implements sync by running its update path; the QMD manager owns the per-agent qmd/index.sqlite index path.
Feature provenance: Blame traces the unconditional status hint and the QMD audit producer to the same current implementation commit, so the patch changes the decision boundary that creates the misleading guidance rather than adding a parallel repair path.
Findings None None.
Security None None.

How this fits together

Memory Core is OpenClaw’s bundled local-memory plugin. Its status command combines memory-manager state with artifact audits, while its index command drives the selected backend’s synchronization path and reports the result.

flowchart LR
  A[Operator runs memory status] --> B[Memory Core status command]
  B --> C[Artifact audit]
  C --> D{Repairable or missing QMD index?}
  D --> E[Status repair guidance]
  E --> F[Operator runs memory index]
  F --> G[QMD synchronization]
  G --> H[Updated index and status]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +8, Tests +28. Total +36 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 10 2 +8
Tests 1 28 0 +28
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 38 2 +36

Review metrics

None.

Stored data model

Persistent data-model change detected: vector/embedding metadata: extensions/memory-core/src/cli-status.runtime.ts, vector/embedding metadata: extensions/memory-core/src/cli.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #116937
Summary: This PR is the focused candidate fix for the linked open report about the same missing-QMD-index remediation message.

Members:

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

Technical review

Best possible solution:

Land the focused status-guidance change so missing QMD indexes direct operators to the existing index command while genuinely repairable audit findings retain the --fix hint.

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

Yes—source confirms that a QMD status with a missing index emits the blanket --fix hint even though the corresponding audit issue is non-fixable; the PR body also provides a real-QMD before/after terminal transcript.

Is this the best way to solve the issue?

Yes—the patch corrects the existing guidance boundary and delegates recovery to the already-owned index command, rather than broadening --fix into a second reindex implementation.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The PR repairs a bounded operator-facing CLI remediation error without data loss, security exposure, or runtime unavailability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The updated PR body contains an after-fix terminal transcript against a real QMD binary: status reports the new command, indexing creates the database, and the follow-up status clears the missing-index condition.
  • proof: sufficient: Contributor real behavior proof is sufficient. The updated PR body contains an after-fix terminal transcript against a real QMD binary: status reports the new command, indexing creates the database, and the follow-up status clears the missing-index condition.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Git blame attributes the unconditional status hint and the QMD audit surface to the commit that introduced these current Memory Core modules. (role: introduced current behavior; confidence: high; commits: 89e4ef2ab721; files: extensions/memory-core/src/cli-status.runtime.ts, extensions/memory-core/src/short-term-promotion-artifacts.ts, extensions/memory-core/src/cli-index-search.runtime.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-07-31T16:57:28.745Z sha 1fc4276 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 31, 2026
@steipete
steipete merged commit fc54577 into openclaw:main Jul 31, 2026
106 of 121 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 31, 2026
…odels-20260729

* origin/main:
  fix(tui): canonical terminal outcomes, cancellation, and error privacy (#117044)
  fix(cron): avoid phantom message tool guidance (#116908)
  fix(test): avoid macOS release gate deadlocks (#116972)
  fix(openai): canonical Chat cache-hit and billing accounting (#117043)
  fix(memory-wiki): salvage human Notes before pruning imported source pages (#102294)
  fix(memory): suggest reindex, not --fix, for a missing qmd index (#116958)
  chore(msteams): add private Gateway QA adapter
  fix(ui): make session controls and failures accessible (#117019)
  docs: fix tilde paths in CLI output examples (#114595)
  fix(plugins): canonical discovery diagnostics and deterministic lifecycles (#117025)
  fix(ui): honor Gateway readiness abort and subscription ownership (#117048)
  fix(updater): harden launchd replacement timing (#117030)
  fix(gateway): preserve static asset HEAD representation metadata (#117049)
  fix(gateway): abort embeddings when clients disconnect (#116146)
  fix(googlechat): retain fallback thread continuity (#117053)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
…nclaw#116958)

`memory status` always appended "Fix: openclaw memory status --fix"
when any audit issue was present, even when none of the issues were
actually repaired by --fix. A missing qmd index file (qmd-index-missing)
is marked fixable: false, so running the suggested --fix left the
issue unresolved. Gate the --fix hint on at least one fixable issue,
and suggest `openclaw memory index --agent <id>` (which builds a fresh
index) when the qmd index file is missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

openclaw memory status --fix suggests broken remediation for missing per-agent qmd index

2 participants