fix(cli): Allow ACP local fallback reads from /tmp - #6370
Conversation
Add POSIX /tmp to ACP local read fallback roots without changing read_file's default permission behavior. Also add QWEN_ACP_LOCAL_READ_ROOTS as an append-only absolute-path override for ACP fallback reads. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
|
Thanks for the PR! Template looks good ✓ Problem: No linked issue, but the scenario is concrete — ACP clients with strict workspace boundaries reject Direction: Aligned. ACP fallback read behavior is core to the product, and broadening it to cover Approach: The scope feels right — extract inline roots into Moving on to code review. 🔍 中文说明感谢贡献! 模板完整 ✓ 问题:没有关联 issue,但场景是具体的——ACP 客户端因 workspace 边界限制拒绝了 daemon 本地可读的 方向:对齐。ACP fallback 读取行为是产品核心功能,扩展覆盖 方案:范围合理——将内联 roots 提取为 进入代码审查 🔍 — Qwen Code · qwen3.7-max |
There was a problem hiding this comment.
Pull request overview
Expands ACP file-system local read fallback roots on POSIX to include /tmp, enabling ACP sessions to recover from client-side workspace-boundary rejections for temporary files while keeping the read_file tool’s default permission policy unchanged.
Changes:
- Centralized ACP local fallback root construction in
buildAcpLocalReadRoots, mirroringread_file’s default local roots and then appending ACP-only roots (/tmpon POSIX) plusQWEN_ACP_LOCAL_READ_ROOTS. - Updated ACP agent wiring to use the new builder for
AcpFileSystemServiceoptions. - Refactored/expanded tests to validate default
/tmpinclusion (POSIX-only) and env-root appending behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/core/src/tools/read-file.ts | Updates cross-component sync comment for local roots vs ACP fallback roots. |
| packages/cli/src/acp-integration/acpAgent.ts | Adds /tmp (POSIX) + QWEN_ACP_LOCAL_READ_ROOTS support via buildAcpLocalReadRoots and uses it when creating AcpFileSystemService. |
| packages/cli/src/acp-integration/acpAgent.test.ts | Adds assertions for /tmp default (POSIX) and env var appends; refactors setup into helpers for reuse. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // SYNC: Keep these base roots and the auto-memory check below aligned with | ||
| // AcpAgent.buildAcpLocalReadRoots' mirrored ReadFileTool group. ACP may | ||
| // append fallback-only roots after that group. |
Code ReviewThe implementation is clean and correct:
No blockers, no reuse issues, no security concerns. Existing realpath/subpath validation in TestingNon-UI internal configuration change — tmux real-scenario testing not applicable (ACP fallback behavior is only exercised within ACP sessions, not through direct CLI invocations). Unit test results below serve as verification. Unit TestsLintBuild + TypecheckAll green. 221 tests passing, lint clean, build and typecheck clean across all 5 workspace packages. — Qwen Code · qwen3.7-max |
|
This is a clean, well-scoped fix. The problem is real — ACP clients enforcing workspace boundaries will naturally reject The extraction of 221 tests passing, lint clean, build and typecheck clean across all workspace packages. No correctness, security, or convention concerns. Approving. ✅ 中文说明这是一个干净、范围合理的修复。问题是真实存在的——ACP 客户端执行 workspace 边界限制时会自然地拒绝 将 221 个测试通过,lint 干净,所有 workspace 包的 build 和 typecheck 干净。无正确性、安全性或规范问题。 批准 ✅ — 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 issues found. LGTM! ✅
Downgraded from Approve to Comment: CI still running (30 checks pending). Will approve once CI passes.
— qwen3.7-max via Qwen Code /review
What this PR does
This PR expands only ACP local read fallback roots so ACP sessions can recover from client-side workspace-boundary rejections for POSIX
/tmppaths. It keeps the existing read-file default permission policy unchanged, adds an append-onlyQWEN_ACP_LOCAL_READ_ROOTSescape hatch for extra absolute fallback roots, and keeps fallback path safety delegated to the existing realpath/subpath checks.Why it's needed
ACP clients can reject generated local files under paths such as
/tmp/datastudio_cli_extract/...as outside the workspace, even though the daemon process can read them locally. The change lets ACP fallback handle that narrow case without turning/tmpinto a general auto-allowedread_filelocation for every mode.Reviewer Test Plan
Reviewers should confirm that ACP sessions include
/tmpin local fallback roots on POSIX platforms, thatQWEN_ACP_LOCAL_READ_ROOTSappends only absolute entries after defaults, and that regularread_filedefault permissions still ask for external/tmpreads.How to verify
Run
cd packages/cli && npx vitest run src/acp-integration/acpAgent.test.ts src/acp-integration/service/filesystem.test.tsand expect both ACP agent root configuration tests and filesystem fallback safety tests to pass. Runnpx eslint packages/cli/src/acp-integration/acpAgent.ts packages/cli/src/acp-integration/acpAgent.test.ts packages/core/src/tools/read-file.tsand expect no lint findings. Runnpm run build && npm run typecheckfrom the repository root and expect build plus workspace typecheck to complete successfully.Evidence (Before & After)
N/A — non-UI ACP fallback behavior.
Tested on
Environment (optional)
macOS local workspace with Node.js v22.22.3, npm 10.9.8, and qwen 0.19.6 available.
Risk & Scope
/tmpafter specific ACP boundary errors, so this intentionally broadens only that fallback surface while preserving realpath/subpath validation./tmproot and must use explicit absolute env roots.QWEN_ACP_LOCAL_READ_ROOTSis additive and optional.Linked Issues
N/A
中文说明
What this PR does
本 PR 只扩大 ACP 本地读取 fallback roots,让 ACP 会话在客户端因 workspace 边界拒绝 POSIX
/tmp路径时,可以由 daemon 本地 fallback 读取。它保持现有read_file默认权限策略不变,新增追加式QWEN_ACP_LOCAL_READ_ROOTS作为额外绝对 fallback root 的低层开关,并继续复用现有 realpath/subpath 校验保证路径安全。Why it's needed
ACP 客户端可能会把
/tmp/datastudio_cli_extract/...这类生成文件判定为 workspace 外路径并拒绝读取,即使 daemon 进程本地有能力读取。该改动让 ACP fallback 覆盖这个窄场景,同时避免把/tmp变成所有模式下通用自动允许的read_file位置。Reviewer Test Plan
评审者应确认 POSIX 平台的 ACP 会话会把
/tmp放入本地 fallback roots,QWEN_ACP_LOCAL_READ_ROOTS只会在默认 roots 后追加绝对路径,并且普通read_file对外部/tmp路径的默认权限仍然是 ask。How to verify
运行
cd packages/cli && npx vitest run src/acp-integration/acpAgent.test.ts src/acp-integration/service/filesystem.test.ts,应看到 ACP agent roots 配置测试和 filesystem fallback 安全测试都通过。运行npx eslint packages/cli/src/acp-integration/acpAgent.ts packages/cli/src/acp-integration/acpAgent.test.ts packages/core/src/tools/read-file.ts,应无 lint 问题。最后在仓库根目录运行npm run build && npm run typecheck,应成功完成构建和 workspace typecheck。Evidence (Before & After)
N/A — 非 UI 的 ACP fallback 行为改动。
Tested on
Environment (optional)
macOS 本地工作区,Node.js v22.22.3、npm 10.9.8、qwen 0.19.6 可用。
Risk & Scope
/tmp下文件;这有意只扩大 fallback 面,同时保留 realpath/subpath 校验。/tmproot,需要通过环境变量显式配置绝对路径。QWEN_ACP_LOCAL_READ_ROOTS是可选的追加配置。Linked Issues
N/A