← Back to PRs

#11364: fix(memory/qmd): prevent cascading failure when query fails or returns empty

by blazerui open 2026-02-07 19:00 View on GitHub →
stale
- Allow qmd query mode with automatic fallback to search on failure - Check both stdout and stderr for 'no results found' marker - Read OPENCLAW_QMD_MODE from spawn env to avoid surprises - Only ignore top-level /memory/ in .gitignore <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR hardens the `qmd` memory query path by (1) allowing an automatic fallback from query→search when the query invocation fails or produces empty output, (2) detecting the “no results found” marker in both stdout and stderr, and (3) ensuring `OPENCLAW_QMD_MODE` is read from the spawned process environment (rather than surprising defaults). It also tightens `.gitignore` to only ignore the top-level `/memory/` directory instead of broader patterns. These changes fit into the memory subsystem by making the QMD manager more resilient to tool failures/empty-result edge cases while keeping repo hygiene around generated memory artifacts more precise. <h3>Confidence Score: 3/5</h3> - Mostly safe, but has a couple edge-case behaviors that can break intended fallback semantics. - The changes are localized and improve robustness, but the fallback behavior is one-directional (query→search only) and the stderr/no-results handling relies on assumptions that can become brittle with small refactors. Fixing these would reduce surprising failures and align behavior with the PR intent. - src/memory/qmd-manager.ts <!-- greptile_other_comments_section --> <sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub> <!-- /greptile_comment -->

Most Similar PRs