Skip to content

fix(memory): preserve QMD search results in noisy output - #115023

Merged
steipete merged 1 commit into
mainfrom
codex/fix-memory-qmd-noisy-stdout
Jul 28, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-memory-qmd-noisy-stdout

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #114314

What Problem This Solves

Fixes an issue where users searching QMD-backed memory lose real search hits when the QMD subprocess prints bracketed log prefixes, inline log arrays, or a no-results warning alongside a valid JSON result.

Why This Change Was Made

Parse valid result JSON before treating log output as an empty search. Recognize only standalone result arrays and scan QMD stdout once, so bracketed log metadata cannot shadow real hits and malformed output cannot cause quadratic rescanning. Preserve existing genuine no-results behavior, including harmless diagnostic logs. The fix is confined to the existing memory-host parser and its regression tests; it adds no configuration, fallback, storage files, migrations, schema changes, or plugin API.

User Impact

QMD-backed memory search returns the actual indexed memory hits despite subprocess diagnostic noise, while genuine empty queries still return an empty result promptly and safely.

Evidence

  • Reproduced all four original noisy-output variants on trusted Blacksmith Testbox: 4 failing regressions against current main, with the 10 existing tests still passing.
  • Final focused and adjacent product proof: 208 passing tests across the QMD parser, real subprocess pipes, QMD process lifecycle, and 162 memory-core QMD manager tests.
  • Full repository changed-code gate passed on Blacksmith Testbox tbx_01kykpq3gr0kfh5b8fc4b5cwf7, including production and test typechecks, changed-file lint and formatting, storage guards, plugin boundaries, and runtime import cycles.
  • Final independent Codex autoreview: clean; no accepted or actionable findings. The review specifically checked logged genuinely empty searches, inline log arrays, and linear-time malformed-output handling.
  • AI-assisted implementation and review.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jul 28, 2026
@steipete
steipete marked this pull request as ready for review July 28, 2026 06:56
@steipete steipete closed this Jul 28, 2026
@steipete steipete reopened this Jul 28, 2026
@clawsweeper

clawsweeper Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 28, 2026, 3:16 AM ET / 07:16 UTC.

ClawSweeper review

What this changes

This PR changes QMD memory-search output parsing so bracketed diagnostics and no-results warnings do not hide a later valid JSON result array, with regression coverage for noisy stdout.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 3 items remain

Keep this PR open for human review. The narrow parser change appears to address the linked QMD result-loss path without introducing a concrete correctness finding, but its claimed Testbox runs are not inspectable real-behavior proof, and the maintainer label requires explicit maintainer handling. Likely related people: steipete is the available recent memory-area routing candidate, with low confidence pending a complete local history pass.

Priority: P2
Reviewed head: 0ec251049cb293f9fdc79871ffcf15f071f30f5b

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused patch and regressions are strong enough for normal maintainer review, but uninspectable test-only claims leave the required real behavior proof gate unmet.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body reports Testbox regressions, focused tests, and a changed-code gate, but contains no inspectable after-fix QMD subprocess output, redacted runtime log, recording, terminal capture, or linked artifact. Please add redacted real behavior proof; updating the PR body should trigger a fresh ClawSweeper review, or a maintainer can request one with @clawsweeper re-review. 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.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports Testbox regressions, focused tests, and a changed-code gate, but contains no inspectable after-fix QMD subprocess output, redacted runtime log, recording, terminal capture, or linked artifact. Please add redacted real behavior proof; updating the PR body should trigger a fresh ClawSweeper review, or a maintainer can request one with @clawsweeper re-review. 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 4 items Current-main failure mechanism: The current parser checks a stdout no-results marker before parsing JSON and extracts from the first [ in noisy output; a bracketed log or warning can therefore mask a later result array, matching the linked report.
Proposed bounded repair: The PR moves stdout marker handling after JSON-array extraction and changes extraction to consider standalone array lines, while adding regressions for bracketed logs, embedded log arrays, and leading/trailing warnings.
Linked canonical bug: The PR explicitly links the open report describing the same two failure modes: a bracketed prefix selected as JSON and a no-results marker short-circuiting a later valid array.
Findings None None.
Security None None.

How this fits together

The memory host invokes QMD as a subprocess and converts its stdout and stderr into normalized search hits. This parser sits between the QMD command output and memory retrieval, so it must separate diagnostics from the JSON array consumed by the search result pipeline.

flowchart LR
  A[Memory search request] --> B[QMD subprocess]
  B --> C[Stdout and stderr]
  C --> D[QMD output parser]
  D --> E[Validated result array]
  E --> F[Memory search hits]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports Testbox regressions, focused tests, and a changed-code gate, but contains no inspectable after-fix QMD subprocess output, redacted runtime log, recording, terminal capture, or linked artifact. Please add redacted real behavior proof; updating the PR body should trigger a fresh ClawSweeper review, or a maintainer can request one with @clawsweeper re-review. 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.
  • Resolve merge risk (P1) - Before merge, the external PR needs inspectable after-fix proof from a real QMD subprocess run showing diagnostic stdout followed by a returned memory hit; the PR body currently reports tests and gates but provides no linked terminal output, redacted logs, recording, or artifact.
  • Complete next step (P2) - The remaining merge blocker is contributor-supplied real behavior proof, which an automated repair lane cannot produce on the contributor's behalf.
Agent review details

Security

None.

PR surface

Source +24, Tests +38. Total +62 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 40 16 +24
Tests 1 38 0 +38
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 78 16 +62

Review metrics

None.

Stored data model

Persistent data-model change detected: unknown-data-model-change: packages/memory-host-sdk/src/host/qmd-query-parser.test.ts, unknown-data-model-change: packages/memory-host-sdk/src/host/qmd-query-parser.ts, vector/embedding metadata: packages/memory-host-sdk/src/host/qmd-query-parser.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #114314
Summary: This PR is the explicit candidate fix for the open report, and its parser changes and regressions cover the report's stated bracketed-log and no-results-marker mechanisms.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the parser repair narrow, retain the regression cases, and attach a redacted real QMD command or memory-search transcript that visibly shows noisy output followed by the preserved hit before maintainer merge review.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the parser repair narrow, retain the regression cases, and attach a redacted real QMD command or memory-search transcript that visibly shows noisy output followed by the preserved hit before maintainer merge review.

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

Yes from source inspection: current-main checks stdout for a no-results marker before attempting its JSON payload, and its fallback starts at the first bracketed sequence, which directly explains the linked noisy-output cases. I did not execute the QMD subprocess in this read-only review.

Is this the best way to solve the issue?

Yes, the proposed ordering is the narrow maintainable fix: parse a valid standalone result array before treating output as an empty search, while retaining explicit no-results handling when no payload exists.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This fixes a bounded memory-search correctness regression that can suppress valid results but has no demonstrated broad runtime or data-loss impact.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports Testbox regressions, focused tests, and a changed-code gate, but contains no inspectable after-fix QMD subprocess output, redacted runtime log, recording, terminal capture, or linked artifact. Please add redacted real behavior proof; updating the PR body should trigger a fresh ClawSweeper review, or a maintainer can request one with @clawsweeper re-review. 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.

Label justifications:

  • P2: This fixes a bounded memory-search correctness regression that can suppress valid results but has no demonstrated broad runtime or data-loss impact.
  • 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 real behavior proof before merge: The PR body reports Testbox regressions, focused tests, and a changed-code gate, but contains no inspectable after-fix QMD subprocess output, redacted runtime log, recording, terminal capture, or linked artifact. Please add redacted real behavior proof; updating the PR body should trigger a fresh ClawSweeper review, or a maintainer can request one with @clawsweeper re-review. 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

What I checked:

  • Current-main failure mechanism: The current parser checks a stdout no-results marker before parsing JSON and extracts from the first [ in noisy output; a bracketed log or warning can therefore mask a later result array, matching the linked report. (packages/memory-host-sdk/src/host/qmd-query-parser.ts:21, 9d5ecc73da57)
  • Proposed bounded repair: The PR moves stdout marker handling after JSON-array extraction and changes extraction to consider standalone array lines, while adding regressions for bracketed logs, embedded log arrays, and leading/trailing warnings. (packages/memory-host-sdk/src/host/qmd-query-parser.ts:21, 0ec251049cb2)
  • Linked canonical bug: The PR explicitly links the open report describing the same two failure modes: a bracketed prefix selected as JSON and a no-results marker short-circuiting a later valid array. (packages/memory-host-sdk/src/host/qmd-query-parser.test.ts:28, 0ec251049cb2)
  • Available CI signal: The supplied check digest shows the memory runtime boundary and several fast contract checks passed, while broader build, lint, type, and smoke lanes were still in progress; checks are supplemental to real behavior proof. (0ec251049cb2)

Likely related people:

  • steipete: Authored the focused parser repair and supplied the linked regression analysis; no complete local file-history pass was available to establish a stronger current-main ownership trail. (role: recent memory-area contributor; confidence: low; commits: 0ec251049cb2; files: packages/memory-host-sdk/src/host/qmd-query-parser.ts, packages/memory-host-sdk/src/host/qmd-query-parser.test.ts)

Rank-up moves

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

  • Add a redacted terminal capture, runtime log, or reproducible transcript showing noisy QMD stdout followed by the returned memory hit.
  • Keep the artifact limited to the changed path and redact private paths, endpoints, identifiers, and any credentials.

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-28T07:09:33.878Z sha 0ec2510 :: needs real behavior proof before merge. :: none

@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 28, 2026
@steipete
steipete merged commit 81628fb into main Jul 28, 2026
146 of 151 checks passed
@steipete
steipete deleted the codex/fix-memory-qmd-noisy-stdout branch July 28, 2026 08:09
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QMD stdout noise can override valid memory search results

1 participant