Fix shell permission parsing and test-created debug artifacts#2536
Fix shell permission parsing and test-created debug artifacts#2536LaZzyMan wants to merge 3 commits intoQwenLM:mainfrom
Conversation
📋 Review SummaryThis PR addresses three related test and shell-permission issues: fixing shell command splitting for redirections, updating the ACP connection test for proper connectivity mocking, and disabling debug log file output in CLI tests. The changes are well-targeted, include appropriate test coverage, and follow existing code patterns. 🔍 General Feedback
🎯 Specific Feedback🟡 High
🟢 Medium
🔵 Low
✅ Highlights
|
TLDR
This PR fixes three related test and shell-permission issues:
2>&1and>|are not incorrectly treated as standalone commands.sendPrompt()correctly.test:cifrom leaving behind runtime debug artifacts such asdebug/latestand per-session.txtfiles.Dive Deeper
The shell permission confirmation flow was incorrectly splitting commands like
npm run build 2>&1 | head -100, which caused bogus permission suggestions such asBash(1)and incorrect confirmation labels. This happened because the shell command splitter treated redirection operators as command separators. The fix makes the splitter aware of file-descriptor and redirection syntax, while preserving normal handling for&&,||,|,;, and newlines.To guard against regressions, this PR adds focused tests covering:
>|redirection handlingThis PR also fixes a failing VS Code companion test. The structured ACP prompt-block test only mocked
sdkConnection, butsendPrompt()first validates connectivity throughensureConnection(), which also requires a livechild. The test now provides that mock explicitly.Finally, this PR prevents CLI test runs from creating runtime debug artifacts. Some CLI config tests intentionally switch the runtime output directory, and because CLI tests did not disable debug log files by default, later config/session initialization could create
debug/latestsymlinks and session log files in those temporary runtime locations. The CLI test setup now matches the core test setup by defaultingQWEN_DEBUG_LOG_FILE=0during tests.Reviewer Test Plan
Run the targeted test suites:
packages/vscode-ide-companion/src/services/acpConnection.test.tspackages/cli/src/config/config.test.tspackages/core/src/utils/shell-utils.test.tspackages/core/src/tools/shell.test.tsVerify shell parsing behavior:
npm run build 2>&1 | head -100no longer produces an extra command/rule like1orBash(1).echo hello >| out.txtis treated as a single command.Verify the ACP test behavior:
prompt()and no longer fails withNot connected to ACP agent.Verify CLI test artifact cleanup:
custom/runtime/debug/latestfrom-env/debug/latestfirst/runtime/debug/latest.qwen/debug/latest.txtfilesTesting Matrix
Targeted Vitest suites only; full CI matrix was not run.
Linked issues / bugs
None.