fix(core): share memory filename config state#5419
Conversation
|
@qwen-code /triage |
|
Thanks for the PR, @tt-a1i! Template: headings don't match Direction: This is a textbook DRY fix. Approach: Scope is minimal — one file reduced to re-exports, one test added for the shared-state invariant. Nothing to cut. The Moving on to code review and testing. 🔍 中文说明感谢 @tt-a1i 的贡献! 模板: 标题与 方向: 经典的 DRY 修复。 方案: 范围最小化——一个文件精简为重新导出,一个测试验证共享状态不变量。没有可砍的部分。测试中的 进入代码审查和测试 🔍 — Qwen Code · qwen3.7-max |
Code ReviewIndependent proposal before reading the diff: I'd replace the duplicated state in Reviewing the diff against this baseline:
No blockers found. Test ResultsNon-user-visible refactoring — verified via unit tests (250 tests across all related test files): 中文说明代码审查读 diff 前我的独立方案:将
无阻塞问题。 测试结果非用户可见的重构——通过单元测试验证(3 个相关测试文件共 250 个测试全部通过)。 — Qwen Code · qwen3.7-max |
|
This is a clean, focused PR that does exactly one thing and does it well. My independent proposal (replace duplicated state with re-exports, add a shared-state test) matches the PR's approach — which means the author found the obvious right answer, not a clever workaround. That's the best signal you can get. The behavioral improvement in All 250 related tests pass, build is clean, linting is clean. The template heading mismatch is minor and doesn't affect review quality. Approving. ✅ 中文说明这是一个干净、聚焦的 PR,只做一件事并且做得很好。 我的独立方案(将重复状态替换为重新导出,添加共享状态测试)与 PR 方案一致——说明作者找到了显而易见的正确答案,而非一个取巧的方案。这是最好的信号。
250 个相关测试全部通过,构建干净,lint 干净。模板标题不匹配是次要问题,不影响审查质量。 批准 ✅ — Qwen Code · qwen3.7-max |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship. ✅
✅ Verification report — recommend mergeI built a real, runtime verification of this PR (esbuild-transpiled module A/B + a tmux real-process boot + the PR's own unit/lint suite), not just a diff read. Verdict: correct, low-risk de-duplication fix. The divergent-state bug is real at the module level; it is currently latent in production but TL;DR
What the bug was
Evidence1. Module-state A/B. I transpiled both branches' modules with esbuild into a tree where 2. tmux real-process boot. Mirroring the real public surface ( This also confirms the re-export introduces no circular import and the ESM live-binding works through the barrel — the only real structural risk of a re-export-only module. Reachability — honest caveat for the merge decisionThe divergence is real at the module level but latent in production today. No source file imports It still matters: Optional non-blocking follow-up
🇨🇳 中文版(点击展开)✅ 验证报告 — 建议合并我对本 PR 做了真实的运行时验证(esbuild 转译后的模块 A/B + tmux 真实进程启动 + PR 自带的单测/lint),不是只读 diff。结论:这是一个正确、低风险的去重修复。状态分裂的 bug 在模块层面是真实存在的;目前在生产中是“潜伏”的,但 速览
Bug 是什么
证据1. 模块状态 A/B。 我用 esbuild 把两个分支的模块转译到同一个目录树里: 2. tmux 真实进程启动。 复刻真实的公开导出面( 这同时证明该重导出不引入循环依赖,且 ESM live-binding 经 barrel 正常工作 —— 这正是“纯重导出模块”唯一真正的结构性风险点。 可达性 —— 给合并决策的诚实提示这个分裂在模块层面是真实的,但目前在生产中是潜伏的。没有任何源码文件 import 但它仍然重要: 可选、不阻塞的后续
Verified on a worktree at PR head |
wenshao
left a comment
There was a problem hiding this comment.
[Suggestion] config/config.test.ts:225-232 still has a vi.mock('../tools/memory-config', ...) block, but config.ts only imports from memory/const.js. This mock intercepts a module that no production import touches — consider removing it in a follow-up.
— qwen3.7-max via Qwen Code /review
| // QWEN.md is first to maintain backward compatibility (used by /init command and save_memory tool). | ||
| let currentGeminiMdFilename: string | string[] = [ | ||
| DEFAULT_CONTEXT_FILENAME, | ||
| export { |
There was a problem hiding this comment.
[Suggestion] The JSDoc above this export says "Extracted from memoryTool.ts to avoid loading the full tool module when only the filename configuration is needed" — but the file is now a pure re-export barrel with no logic of its own. Additionally, grep shows zero production-code consumers of this module (all imports already use memory/const.js directly). Consider either updating the comment to reflect the barrel role (e.g., "Re-export barrel for backward compatibility. Canonical definitions live in ../memory/const.ts.") or removing the file entirely in a follow-up if no external consumers depend on it.
— qwen3.7-max via Qwen Code /review
Summary
tools/memory-config.tsre-export the memory filename config frommemory/const.tsPart of #4063.
Test plan
npx -p node@22 node node_modules/vitest/vitest.mjs run --coverage.enabled=false packages/core/src/memory/const.test.ts packages/core/src/memory/writeContextFile.test.ts packages/core/src/config/config.test.tsnpx prettier --check packages/core/src/tools/memory-config.ts packages/core/src/memory/const.test.tsnpx eslint packages/core/src/tools/memory-config.ts packages/core/src/memory/const.test.tsgit diff --checkAI Assistance Disclosure
I used Codex to review the changes, sanity-check the implementation against existing patterns, and help spot potential edge cases.