fix(cli): /memory show --project and --global now display all configured context files#2368
Merged
LaZzyMan merged 1 commit intoQwenLM:mainfrom Mar 25, 2026
Merged
Conversation
…red context files Previously, `/memory show --project` and `/memory show --global` only checked the first filename from `getCurrentGeminiMdFilename()` (i.e., `QWEN.md`), ignoring other configured context files like `AGENTS.md`. This caused the commands to report empty even when `AGENTS.md` existed and was being loaded by the actual memory loading mechanism (`loadServerHierarchicalMemory`). Changes: - Replace `getCurrentGeminiMdFilename()` with `getAllGeminiMdFilenames()` in memoryCommand.ts - Add `findAllExistingMemoryFiles()` helper that iterates all configured filenames and aggregates content from all existing files - Update both `--project` and `--global` subcommands to display content from all found memory files - Add tests for fallback (only AGENTS.md exists) and dual-file scenarios
Collaborator
Review 结论:✅ Approve感谢 @huww98 的 PR!这是一个高质量的 bug fix。 Review 总结
关键发现问题根因: #2018 添加了多文件支持 ,但 仍只检查第一个文件,导致只有 存在时报告为空。 修复方案: 用 替换 ,遍历所有配置的文件名并聚合内容。 建议(可选)
Reviewer 验证步骤Review completed by @qwen-code-dev-bot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
/memory show --projectand/memory show --globalonly checked the first filename (QWEN.md) from the configured context files array, ignoringAGENTS.md. After #2018 added multi-file support (['QWEN.md', 'AGENTS.md']), these commands would report empty when onlyAGENTS.mdexisted, even though the actual loading mechanism (loadServerHierarchicalMemory) correctly loaded it.Dive Deeper
The root cause is that
getCurrentGeminiMdFilename()returns only the first element of the configured filenames array. While #1428 fixed the hardcodedQWEN.mdby using this function, it still only reads one file — insufficient after #2018 introduced the multi-filename array.Changes:
getCurrentGeminiMdFilename()withgetAllGeminiMdFilenames()inmemoryCommand.tsfindAllExistingMemoryFiles()helper that iterates all configured filenames and aggregates content from all existing files--projectand--globalsubcommands to display content from all found memory filesAGENTS.mdexists) and dual-file scenarios (bothQWEN.mdandAGENTS.mdexist)Reviewer Test Plan
AGENTS.mdfile (noQWEN.md) in a project directoryqwenand execute/memory show --project— should displayAGENTS.mdcontent (previously showed empty)QWEN.mdandAGENTS.md— should display content from both files/memory show(without flags) — should still work as before (reads from cached aggregated memory)Testing Matrix
Linked issues / bugs
Related to #968 (memory display inconsistency)
Related to #727 (context.fileName not respected — partially fixed by #1428, this PR completes the fix for multi-file case)
🤖 Generated with Qoder