feat(cli): run safe slash commands during streaming - #8130
Conversation
E2E Test ReportTested the freshly built and bundled CLI in a real tmux interactive session against a deterministic local OpenAI-compatible SSE server. Each response streamed for 12 seconds so command timing could be observed reliably. Non-blocking allowlist
Serialized behavior
ResultPASS — the opted-in local commands run during streaming without interrupting the active response, while conversation-dependent work continues to use the existing queue. |
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. |
|
Thanks for the PR! Template looks good ✓ Problem: observed UX limitation with a linked feature request (#8101). During streaming, local-only commands like Direction: aligned — this is a straightforward interactive-mode UX improvement. The opt-in capability approach keeps the default serialized, which is the right conservative posture. CHANGELOG has no direct reference to non-blocking slash commands, but the area (interactive command UX during streaming) is clearly relevant. Size: not applicable — no core paths touched. 22 production lines across 5 files, 114 test lines, 55 lines of design doc. Approach: the scope feels right. An optional Risk: no elevated risk signals. Moving on to code review. 🔍 中文说明感谢贡献! 模板完整 ✓ 问题:已观测到的 UX 限制,关联功能请求 #8101。流式输出期间, 方向:对齐——这是一个直接的交互模式 UX 改进。opt-in 能力标记让默认行为保持串行,保守且合理。CHANGELOG 无直接引用,但该领域(流式输出期间的交互命令 UX)明显相关。 规模:不适用——未触及核心路径。5 个文件 22 行生产代码,114 行测试,55 行设计文档。 方案:范围合理。 风险:无升级风险信号。 进入代码审查 🔍 — Qwen Code · qwen3.8-max-preview Reviewed at |
Code ReviewIndependent proposal: I would add an optional capability flag to Comparison: the PR does exactly this. The implementation is clean and matches the minimal approach:
No critical blockers. No convention violations. Testing
Unit tests pass on Ubuntu. macOS/Windows and integration tests were skipped by CI configuration (not PR-caused). Sandboxed verification would settle the rendering claim: 中文说明代码审查独立方案: 在 对比: PR 的实现与此完全一致。新增的路由检查正确地放在 无关键阻塞项,无规范违反。 测试Ubuntu 单元测试通过。macOS/Windows 和集成测试被 CI 配置跳过(非 PR 导致)。 沙箱验证可以确认渲染行为: — Qwen Code · qwen3.8-max-preview Reviewed at |
|
Confidence: 5/5 — clean across every stage; would merge without hesitation. This is a textbook small feature PR. The problem is real and observable — waiting for a long stream to finish just to check The opt-in default-serialized design is the right call — it puts the burden on each command to prove it's safe, rather than trying to classify commands as safe/unsafe at the router level. The design doc makes the boundary explicit, which will help the next person who wants to add a command to the concurrent set. Tests pin both the routing behavior and the capability declarations, so regressions in either direction (a safe command getting queued, or an unsafe command getting opted in) will break the build. The The only thing I'd note for follow-up: the author tested on macOS only. The routing logic is platform-independent (it's pure React state), so the risk is low, but a 中文说明置信度:5/5——每个阶段都很干净,毫不犹豫地合并。 这是一个教科书级的小型功能 PR。问题是真实可观测的——等一个长流式输出结束才能查看 opt-in 默认串行的设计是正确的——它让每个命令自己证明安全性,而不是在路由层分类。设计文档明确了边界,有助于后续维护。 测试固定了路由行为和能力声明,两个方向的回归都会被构建捕获。 唯一需要跟进的:作者仅在 macOS 上测试。路由逻辑是平台无关的(纯 React 状态),风险很低,但在 Linux 上运行 — Qwen Code · qwen3.8-max-preview Reviewed at |
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! ✅
中文说明
未发现问题。LGTM!✅
— qwen3.8-max-preview via Qwen Code /review
Maintainer verification — real local build + runtime A/BI built this branch locally and drove the real bundled TUI in tmux against a deterministic OpenAI-compatible SSE mock, with a BASE arm built from the same pipeline with only the five production files reverted. Everything below is measured, not inferred. Verdict: the feature works exactly as described. ✅ No blocking defect found. Three behavioural notes at the end are worth a decision before merge, but none of them is a correctness bug. Harness (click to expand)
1. Opted-in commands run during streaming — A/B
All six entry points confirmed on the PR arm — 2. It also works during tool execution, not just text streaming
3. Serialization is preserved for everything elseTyped a plain follow-up and 4. Ctrl+Q still defers, end to endTyped 5. Dialogs do not corrupt the active turnOpened 6. Unit tests — 161 pass, and they have teeth
Notes for the merge decision (none blocking)N1 — Before this PR N2 — a short input-dead window while the concurrent command runs. N3 — spurious Also noticed (not a defect): the concurrent command's output is appended above the in-flight response block, so the finished transcript reads Scope not covered here: Windows rendering; 中文版报告维护者验证 —— 本地真实构建 + 运行时 A/B 对比我在本地构建了该分支,并在 tmux 中驱动真实的 bundle 后 TUI,配合一个确定性的 OpenAI 兼容 SSE mock 服务;同时用同一套构建流程、仅回退 5 个生产文件做了 BASE 对照组。以下结论全部来自实测。 结论:功能与描述完全一致 ✅,未发现阻塞性缺陷。 文末三点行为变化建议在合并前明确一下,但都不是正确性 bug。 测试环境
1. 白名单命令在流式响应期间即时执行(A/B)
PR 组六个入口全部即时渲染/弹窗—— 2. 工具执行阶段同样生效
3. 其余命令的串行化未被破坏流式响应期间输入普通追问和 4. Ctrl+Q 延迟路径端到端有效
5. 对话框不会破坏当前轮次响应中途打开 6. 单测 161 条通过,且具备"牙齿"
合并前建议确认的三点(均不阻塞)N1 —— 本 PR 之前 N2 —— 并发命令执行期间存在一个短暂的输入失效窗口。 N3 —— 若 Esc 恰好落在同一窗口内,会出现多余的 另外注意(非缺陷): 并发命令的输出会插入到进行中的响应块之上,因此最终记录读起来是 未覆盖范围: Windows 渲染; |
|
Released in v0.21.3. |
…M#9495) * feat(cli): extend non-blocking slash commands to more builtins QwenLM#8130 opted /about, /help, and /settings in to run immediately while a response streams. Apply the same criteria to eleven more builtins so local UI controls no longer wait for the active turn: - UI-preference commands whose saved changes apply through the existing settings hooks: /theme, /editor, /vim, /voice, and /terminal-setup. - Read-only status commands: /tools, /lsp, /tasks, /hooks, /docs, and /bug. Commands that submit model turns, mutate conversation state, or read state the active turn is writing remain serialized, as documented in the non-blocking slash commands design doc. Each opt-in is pinned by a unit test. * docs(cli): scope extended-command claim to the eleven opted-in builtins




What this PR does
This PR lets a small, explicitly opted-in set of local slash commands run immediately while the main model response is streaming. The initial set is
/status(including/aboutand/status paths),/settings, and/help(including/?). All commands remain serialized by default, Ctrl+Q still forces deferred execution, and the existing specialized behavior of/btwand/quitis unchanged.Why it's needed
Previously, nearly every slash command entered during a response was placed in the same queue as conversation turns, even when it only displayed local information or opened a UI dialog. Users therefore had to wait for a long-running response to finish before checking status, viewing paths, changing settings, or opening help. The explicit capability keeps the allowlist conservative and prevents turn-dependent, state-mutating, tool-running, and model-submitting commands from accidentally running concurrently.
Reviewer Test Plan
How to verify
/status,/status paths,/about,/settings,/help, and/?while it is still running. Each result or dialog should appear before the response finishes, and the original response should continue streaming after the command runs or the dialog closes./compress. Both should show as queued and should not start a new model request until the active response has ended.Evidence (Before & After)
Before: interactive testing against the released CLI showed
/status,/settings, and/helpas queued messages whose output appeared only after the active stream ended.After: interactive testing against the freshly bundled CLI used a deterministic 12-second SSE response. Every opted-in command displayed its result or dialog before
stream-end, no opted-in command showed a queued marker, and response ticks continued afterward. A normal follow-up remained queued./compresswas queued at 11:14:24.553 UTC, the active stream ended at 11:14:34.788, and the compression request began at 11:14:34.832.Tested on
Environment (optional)
Local bundled CLI with sandbox disabled and a deterministic OpenAI-compatible SSE test server. Validation also included the focused CLI unit tests, ESLint, Prettier, the full build, and TypeScript type checking.
Risk & Scope
Linked Issues
Closes #8101
中文说明
本 PR 做了什么
本 PR 允许一小组明确声明可并发的本地斜杠命令在主模型响应流式输出期间立即运行。首批命令包括
/status(含/about和/status paths)、/settings、/help(含/?)。所有命令默认仍保持串行,Ctrl+Q 仍会强制延迟执行,/btw和/quit的现有专用行为保持不变。为什么需要这个改动
此前,在响应期间输入的几乎所有斜杠命令都会和对话轮次进入同一个队列,即使该命令只是显示本地信息或打开 UI 对话框。用户因此必须等待长响应结束后,才能查看状态、路径、修改设置或打开帮助。显式能力标记让白名单保持保守,并避免依赖当前轮次、修改状态、运行工具或提交模型请求的命令意外并发执行。
Reviewer 测试计划
如何验证
/status、/status paths、/about、/settings、/help和/?。每个结果或对话框都应在响应完成前出现,并且命令运行后或关闭对话框后,原响应应继续流式输出。/compress。两者都应显示为排队状态,并且在当前响应结束前不应开始新的模型请求。证据(改动前后)
改动前:针对已发布 CLI 的交互测试显示,
/status、/settings和/help都会成为排队消息,其输出只在当前流结束后出现。改动后:针对最新 bundle 的交互测试使用了一个确定性的 12 秒 SSE 响应。每个白名单命令都在
stream-end前显示结果或对话框,没有白名单命令出现排队标记,之后响应 tick 仍继续输出。普通后续提示词仍会排队。/compress在 UTC 11:14:24.553 入队,当前流于 11:14:34.788 结束,压缩请求于 11:14:34.832 才开始。测试平台
环境(可选)
本地 bundle CLI,关闭 sandbox,并使用确定性的 OpenAI 兼容 SSE 测试服务器。验证还包括 CLI 定向单元测试、ESLint、Prettier、完整构建和 TypeScript 类型检查。
风险与范围
关联 Issue
Closes #8101