chore(cli): drop redundant home-directory startup warning - #5839
Conversation
Running in $HOME is already handled by the memory layer (empty effective cwd skips the workspace search), so the home directory is a fully supported working directory, not a degraded state. The warning was pure noise with no actionable guidance, and co-working from $HOME is a legitimate use case that peer coding agents also allow without complaint. Root-directory and ripgrep-availability warnings remain untouched.
|
Thanks for the PR! Template looks good ✓ On direction: aligned. The home directory warning was noise — On approach: scope is minimal and correct — removes the check, its tests, and the now-unused Moving on to code review. 🔍 中文说明感谢贡献! 模板完整 ✓ 方向:对齐。home directory 警告是噪音—— 方案:范围最小且正确——移除了检查逻辑、对应测试和不再使用的 进入代码审查 🔍 — Qwen Code · qwen3.7-max |
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
|
Code review: clean. The diff is minimal and correct — removes Unit tests: 3/3 pass ✓ Real-scenario testing: Before (installed build,
|
|
Straightforward removal PR that does exactly what it says. The home-directory warning was firing on a legitimate use case that the memory layer already handles correctly, so removing it is the right fix — not a band-aid or a workaround. The diff is the minimum change needed: remove the check, its tests, and the now-unused import. The before/after confirms it works. Easy to review, easy to revert if needed. LGTM. ✅ 中文说明简洁的移除 PR,名副其实。home-directory 警告针对的是一个合理的使用场景,且 memory 层已正确处理,因此移除是正确的修复——不是临时补丁或变通方案。diff 是完成任务所需的最小改动:移除了检查逻辑、测试和不再使用的 import。前后对比确认了效果。易于审查,易于回滚。 LGTM。✅ — Qwen Code · qwen3.7-max |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship. ✅
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
No review findings. Downgraded from Approve to Comment: CI still running.
— qwen3.7-max via Qwen Code /review
✅ Verification report — local real-runtime test (Linux)Built and ran the change end-to-end from an isolated worktree at the PR head ( Env: Linux · Node v22.22.2 · ripgrep 14.1.1 · dev runtime ( 1. Runtime A/B — real CLI, base vs PR (same harness, only
|
| Launch dir | BASE (check present) | PR (check removed) |
|---|---|---|
$HOME (/root) |
home-dir warning printed (×1) | no home-dir warning (×0) |
/ (root) |
— | root-dir warning still fires (×1) |
| project dir | none | none |
The warning surfaces on both channels wired in gemini.tsx (stderr pre-TUI + the Notifications panel). Real interactive TUI captured in tmux, launched from the real home dir:
BASE — warning renders in the Notifications box:
╭────────────────────────────────────────────────────────────────────────────────────────────────╮
│ You are running Qwen Code in your home directory. It is recommended to run in a project-specific…│
╰────────────────────────────────────────────────────────────────────────────────────────────────╯
> Type your message or @path/to/file
PR (AFTER) — clean boot, no Notifications box:
Tips: Try /insight to generate personalized insights from your chat history.
────────────────────────────────────────────────────────────────────────────
> Type your message or @path/to/file
→ Home warning removed; root-directory and ripgrep checks remain intact (verified the root warning still fires from /).
2. Unit tests + revert-proof
- PR tests pass:
userStartupWarnings.test.ts→ 3/3 green. - Revert-proof (the test genuinely pins the new behavior): running the PR's test file against the base implementation makes the error-handling case fail:
Base has two checks that both catch fs errors (home + root) → 2 messages; the PR's
× error handling > should handle errors when checking directory → expected [ …(2) ] to deeply equal [ Array(1) ]toEqual([expectedWarning])correctly encodes the single-check result. Good change, not a vacuous edit.
3. Safety of the removal (the "why" checks out)
packages/core/src/utils/memoryDiscovery.ts already special-cases cwd === home (isHomeDirectory): it checks only the home-level QWEN.md and skips the workspace-tree scan. So $HOME is a first-class, supported working directory — the warning was advisory noise, not a guard against a degraded state. The PR's justification holds.
4. Static checks
- No dangling references after the removals —
os/vi.mock/homeDirare fully gone (grep-clean); the now-unusednode:osimport is correctly dropped. tsc --noEmiton the cli package: the only errors are 2× TS6305 about an unbuiltcore/dist(toml-to-markdown-converter) in the isolated worktree — zero errors touch cli/PR source. PR files type-check clean. (eslint couldn't run in the symlinked worktree due to a plugin-resolution artifact; the only lint-relevant risk, the unusedosimport, is removed.)
Nits (non-blocking)
- None functional. Pure, well-scoped removal; root/ripgrep paths byte-identical to base.
🇨🇳 中文版(点击展开)
✅ 验证报告 — 本地真实运行测试(Linux)
在 PR HEAD(bd152d264,merge-base 18373fb96)的独立 worktree 上完整构建并运行。结论先行:行为与描述完全一致,测试改动是有意义的,且未波及其他告警 —— 可以安全合并。 同时补齐了 PR 表格中标为 N/A 的 Linux 平台覆盖。
环境: Linux · Node v22.22.2 · ripgrep 14.1.1 · dev 运行时(tsx 直跑源码)+ 在 tmux 中驱动真实交互式 TUI。
1. 运行时 A/B —— 真实 CLI,base vs PR(同一套环境,仅替换 userStartupWarnings.ts)
| 启动目录 | BASE(保留检查) | PR(移除检查) |
|---|---|---|
$HOME(/root) |
打印 home 目录告警(×1) | 无 home 目录告警(×0) |
/(根目录) |
—— | 根目录告警仍然触发(×1) |
| 项目目录 | 无 | 无 |
该告警在 gemini.tsx 接的两条通道都会出现(TUI 前的 stderr + Notifications 面板)。在真实交互式 TUI(tmux,从真实 home 目录启动)中:
BASE —— 告警显示在 Notifications 框内:
╭────────────────────────────────────────────────────────────────────────────────────────────────╮
│ You are running Qwen Code in your home directory. It is recommended to run in a project-specific…│
╰────────────────────────────────────────────────────────────────────────────────────────────────╯
> Type your message or @path/to/file
PR(AFTER) —— 干净启动,无 Notifications 框:
Tips: Try /insight to generate personalized insights from your chat history.
────────────────────────────────────────────────────────────────────────────
> Type your message or @path/to/file
→ home 告警已移除;根目录与 ripgrep 检查保持完好(已验证从 / 启动根目录告警仍触发)。
2. 单元测试 + 反向验证(revert-proof)
- PR 测试通过:
userStartupWarnings.test.ts→ 3/3 全绿。 - 反向验证(证明测试确实绑定了新行为): 把 PR 的测试文件跑在 base 实现上,error-handling 用例会失败:
base 有两个检查(home + root)都会捕获 fs 错误 → 2 条消息;PR 改成
× error handling > should handle errors when checking directory → expected [ …(2) ] to deeply equal [ Array(1) ]toEqual([expectedWarning])正确反映了单检查后的结果。是有效改动,不是空改。
3. 移除的安全性("为什么"成立)
packages/core/src/utils/memoryDiscovery.ts 已对 cwd === home 做特殊处理(isHomeDirectory):只检查 home 层级的 QWEN.md,跳过工作区目录树扫描。所以 $HOME 本就是一等公民、受支持的工作目录 —— 这条告警只是噪音,并非用于防止某种降级状态。PR 的理由成立。
4. 静态检查
- 移除后无悬空引用 ——
os/vi.mock/homeDir已彻底删除(grep 干净);不再使用的node:osimport 被正确去掉。 - cli 包
tsc --noEmit:仅有的报错是 2 个 TS6305,关于独立 worktree 中未构建的core/dist(toml-to-markdown-converter)—— 没有任何报错涉及 cli/PR 源码。PR 文件类型检查干净。(eslint 因 worktree 软链导致插件解析问题未能运行;唯一与 lint 相关的风险即未使用的osimport 已被移除。)
小问题(不阻塞)
- 无功能性问题。是一处干净、范围明确的移除;root/ripgrep 路径与 base 逐字节相同。
Verified locally via tmux + real runtime on an isolated worktree at the PR head; base/PR diff isolated to a single file swap for clean attribution.
What this PR does
Removes the "You are running Qwen Code in your home directory" startup warning. When the workspace root equals the user's home directory, Qwen Code no longer prints the advisory message at startup. The root-directory and ripgrep-availability warnings are untouched.
Why it's needed
Running in
$HOMEis already handled correctly by the memory layer — whencwd === home, an empty effective cwd is passed so the workspace memory search is skipped. In other words, the home directory is a fully supported working directory, not a degraded state.The warning was pure noise: it never told the user what to do about it, and co-working from the home directory (e.g. managing
~/.qwenconfigs, cross-project scratch work) is a legitimate use case that peer coding agents like Claude Code also allow without complaint. Removing it eliminates a false-alarm prompt that added no functional value.Reviewer Test Plan
How to verify
cd packages/cli && npx vitest run src/utils/userStartupWarnings.test.ts— all 3 tests pass.npm run typecheckandnpx eslint packages/cli/src/utils/userStartupWarnings.ts packages/cli/src/utils/userStartupWarnings.test.ts— both clean.cd ~ && npm run devand confirm no "home directory" warning appears at startup; the root-directory warning still fires under/.Evidence (Before & After)
Non-UI change (warning text removal). Before: launching in
~printed "You are running Qwen Code in your home directory. It is recommended to run in a project-specific directory." After: no message is printed. N/A for screenshots.Tested on
Environment
Local unit tests + typecheck/lint only. No sandbox or runtime involved.
Risk & Scope
$HOMEand encounters slow file searches no longer gets a hint pointing them toward a project directory. Mitigated by the fact that the memory layer already special-cases$HOME, so search behavior is bounded.Linked Issues
N/A
中文说明
这个 PR 做了什么
移除了 "You are running Qwen Code in your home directory" 启动提醒。当工作区根目录等于用户 home 目录时,Qwen Code 不再在启动时打印这条提示。根目录和 ripgrep 可用性的提醒保持不变。
为什么需要
在
$HOME下运行已经由 memory 层正确处理——当cwd === home时,会传入空的 effective cwd 以跳过 workspace memory 搜索。也就是说,home 目录是完全支持的工作目录,不是降级状态。这条提醒纯属噪音:它从未告诉用户该怎么处理,而从 home 目录协同工作(如管理
~/.qwen配置、跨项目草稿)是合理的使用场景,同类编码 agent 如 Claude Code 在 home 下运行也不会报错。移除它消除了一个没有功能价值的误报提示。评审测试计划
如何验证
cd packages/cli && npx vitest run src/utils/userStartupWarnings.test.ts——3 个测试全部通过。npm run typecheck和npx eslint packages/cli/src/utils/userStartupWarnings.ts packages/cli/src/utils/userStartupWarnings.test.ts——均无报错。cd ~ && npm run dev,确认启动时不再出现 "home directory" 提醒;根目录下/仍会触发根目录提醒。证据(前后对比)
非 UI 改动(移除提示文字)。之前:在
~下启动会打印 "You are running Qwen Code in your home directory. It is recommended to run in a project-specific directory."。之后:不再打印。截图 N/A。测试环境
环境
仅本地单测 + typecheck/lint。未使用沙箱或运行时。
风险与范围
$HOME下启动并遇到慢速文件搜索的用户不再获得指向项目目录的提示。由于 memory 层已对$HOME做特殊处理,搜索行为是有边界的,风险可控。关联 Issue
无