Repository navigation
fix(core): respect enableManagedAutoMemory in memory availability - #6941
Conversation
Local build & real-E2E verification report (merge reference)Verified at head Verdict: LGTM — the fix works exactly as described end-to-end, no regression found. Two behavioral notes below for maintainer awareness (neither is a blocker). 1. Wire-level A/B — system prompt actually sent to the modelDrove the built CLI (
Project 2. TUI surface A/B — real built TUI via ptyWith the setting off, the merge-base build still offered 3. Tests & typecheck (isolated worktree, real install)
4. Call-site audit & behavioral notesAll 8 production call sites of Two things worth knowing when merging:
Also for the record: the CI precheck flag ( EnvironmentmacOS (Darwin 24.6), isolated detached worktree at 中文版本(Chinese version)本地构建与真实 E2E 验证报告(合并参考)在隔离的 detached worktree 中于 head 结论:LGTM —— 修复端到端完全符合描述,未发现回归。 下面有两条行为备注供合并时参考(均不是阻塞项)。 1. Wire 层 A/B —— 实际发送给模型的 system prompt用隔离
所有场景中项目 2. TUI 界面 A/B —— 通过 pty 驱动真实构建的 TUI设置关闭时,merge-base 构建的斜杠命令菜单仍会展示 3. 测试与 typecheck(隔离 worktree,真实安装)
4. 调用面审计与行为备注审计了 合并时值得了解的两点:
另外说明:CI precheck 标记( 环境macOS(Darwin 24.6),隔离 detached worktree @ |
|
@qwen-code /triage |
Maintainer E2E Verification (macOS)Ran a real CLI E2E test on macOS to verify this PR before merging. Test MethodBuilt the PR branch (
Results
Context savings: 4,711 chars (~1,178 tokens) per request when disabled. Unit TestsThe 4 PR-specific tests (including the new ScreenshotVerdict✅ PASS — The one-line change in 中文:维护者 E2E 验证(macOS)在 macOS 上运行了真实 CLI E2E 测试,验证本 PR 的行为。 测试方法构建 PR 分支(
结果
禁用后每次请求节省上下文:4,711 字符(约 1,178 tokens) 单元测试4 个 PR 相关测试(包括新增的 截图结论✅ 通过 — |




What this PR does
Makes managed-memory availability respect the existing
memory.enableManagedAutoMemorysetting. When managed auto-memory is disabled,isManagedMemoryAvailable()now returnsfalse, so the# auto memorysystem-prompt block and related managed-memory surfaces stay aligned with the user's setting.Why it's needed
Fixes #6936. Before this change,
enableManagedAutoMemory: falsedisabled managed-memory operations but still allowed the 7-9 KB# auto memoryinstruction block to be injected into the system prompt. That meant users who explicitly disabled auto-memory to save context still paid the prompt cost for capabilities the model could not use.Reviewer Test Plan
How to verify
Review the updated
isManagedMemoryAvailable()gate and the config regression coverage. The focused test now verifies both thatisManagedMemoryAvailable()returnsfalsewhenenableManagedAutoMemoryis disabled and thatrefreshHierarchicalMemory()still keeps project memory while omitting the# auto memoryblock without reading the auto-memory index.Evidence (Before & After)
N/A — non-UI config behavior covered by unit tests.
Tested on
Environment (optional)
npm --workspace @qwen-code/qwen-code-core test -- src/config/config.test.ts→ 1 file passed, 396 tests passed.npm --workspace @qwen-code/qwen-code-core run typecheck→ passed.Risk & Scope
isManagedMemoryAvailable()also gates managed-memory commands and surfaces, so disablingmemory.enableManagedAutoMemorynow hides those surfaces consistently with the operation gate.getManagedAutoMemoryEnabled().Linked Issues
Fixes #6936
中文说明
What this PR does
让 managed memory 的可用性判断尊重现有的
memory.enableManagedAutoMemory设置。当 managed auto-memory 被关闭时,isManagedMemoryAvailable()现在会返回false,因此# auto memorysystem prompt 块以及相关 managed-memory 入口会和用户设置保持一致。Why it's needed
修复 #6936。此前
enableManagedAutoMemory: false会禁用 managed-memory 操作,但仍允许 7-9 KB 的# auto memory指令块注入 system prompt。这意味着用户即使明确关闭 auto-memory 来节省上下文,仍然要为模型无法使用的能力支付 prompt 成本。Reviewer Test Plan
How to verify
检查更新后的
isManagedMemoryAvailable()门控和 config 回归测试。聚焦测试现在同时验证:当enableManagedAutoMemory被关闭时,isManagedMemoryAvailable()返回false;并且refreshHierarchicalMemory()仍保留项目 memory,但不会注入# auto memory块,也不会读取 auto-memory index。Evidence (Before & After)
N/A — 这是非 UI 配置行为,由单元测试覆盖。
Tested on
Environment (optional)
npm --workspace @qwen-code/qwen-code-core test -- src/config/config.test.ts→ 1 个测试文件通过,396 个测试通过。npm --workspace @qwen-code/qwen-code-core run typecheck→ 通过。Risk & Scope
isManagedMemoryAvailable()也会门控 managed-memory 命令和界面入口,因此关闭memory.enableManagedAutoMemory后这些入口会与操作门控保持一致地隐藏。getManagedAutoMemoryEnabled(),避免顺手扩大 safe mode 语义。Linked Issues
Fixes #6936