fix(cli): align OpenTUI output-style behavior - #10806
Conversation
|
✅ Qwen Triage finished — CI landed green on ✅ Qwen Triage 已完成 —— |
|
@qwen-code /takeover from 2 |
|
🤝 Takeover engaged: the autofix loop now manages this PR — it will address new review feedback and resolve base conflicts until the label is removed or the round cap is reached. This is a fork PR, so the first round comes from the next scheduled scan (usually within minutes). This window's round counter starts at 2 (the rounds this PR spent in review before takeover), so the Critical-only brake engages after 3 more change-producing round(s) instead of a full fresh 5. Remove the 中文说明🤝 已接管:autofix 循环现在管理此 PR —— 将持续处理新的评审反馈与 base 冲突,直到移除标签或达到轮次上限。本 PR 来自 fork,首轮处理将由下一次定时扫描执行(通常几分钟内)。本窗口轮次计数从 2 起算(即本 PR 托管前已进行的评审轮数),因此再经过 3 个产生改动的轮次即进入 Critical-only,而非重新计满 5 轮。移除 |
|
Thanks for the PR! Template looks good ✓ Problem: observed bug with evidence. Linked issue #10767 describes the picker preselecting Direction: aligned — this is OpenTUI/Ink parity for an established feature area. Output styles have sustained upstream investment (the claude-code CHANGELOG carries several output-style behavior fixes), and qwen-code's Ink picker already behaves exactly the way this PR makes OpenTUI behave. Size: not applicable — 4 files under Approach: scope feels right and minimal. A one-line selection-source change mirroring Ink's Risk: no elevated risk signals. Moving on to code review. 🔍 中文说明感谢贡献! 模板完整 ✓ 问题:已观测到的 bug,有证据。关联 issue #10767 描述了在 方向:对齐——这是既有功能领域的 OpenTUI/Ink 行为对齐。output style 在上游持续有投入(claude-code CHANGELOG 中有多条 output-style 行为修复),且 qwen-code 的 Ink 选择器本来就是本 PR 让 OpenTUI 达到的行为。 规模:不适用——仅 方案:范围恰当且最小化。一行选择源改动对齐 Ink 的 风险:无升级风险信号。 进入代码审查 🔍 — Qwen Code · qwen3.8-max Reviewed at |
Code reviewThe production change is exactly two lines, and it matches what I would have done independently:
No critical issues, no convention problems. The new Not verified statically: nothing material — the logic is small enough to read end to end. Test evidence — the PR's own CI on
|
| Check | Conclusion |
|---|---|
Classify PR |
✅ success |
Dependency CVE audit |
✅ success |
Desktop Shell (ubuntu-22.04) |
✅ success |
Desktop Shell (windows-2022) |
✅ success |
Integration Tests (no-AK, No Sandbox) |
✅ success |
OpenTUI no-flicker gate |
✅ success |
route |
✅ success |
Secret scan (TruffleHog) |
✅ success |
Test (ubuntu-latest, Node 22.x) |
✅ success |
TUI parity snapshots (ink vs opentui) |
✅ success |
web-shell E2E Smoke (ubuntu-latest, Node 22.x) |
✅ success |
One row per check name (latest run); skipped checks omitted; failures sort first. / 每个检查名一行(取最新一次运行),省略 skipped,失败项排在最前。
Sandboxed verification would settle this: @qwen-code /verify (sponsored run — the author lacks write access, so a maintainer triggers it; it carries a pre-execution risk screen and a full workspace wipe) — the new component tests mock the OpenTUI runtime, so they pin the selection and transcript logic but not live terminal behavior; the author's native-OpenTUI exercise under Bun is their claim (macOS only), not independently re-run here. Read the resulting report with the same skepticism as the fork's own CI logs.
中文说明
代码审查
生产代码改动只有两行,与我独立想到的方案一致:
dialogs-modes.tsx的选择器初始选中项改为读取config.getOutputStyle()?.name(已配置样式),不再用resolveMainSessionOutputStyle(config)?.name(临时生效样式)。这与 Ink 完全一致——DialogManager.tsx传给 InkOutputStyleDialog的就是config.getOutputStyle()?.name。持久化路径(applyOutputStyleSelection)未改动且本就正确:先以throwOnWriteFailure写设置,成功后才应用到会话,覆盖生效时还会追加"已保存但本会话不生效"的提示。commands-dispatch.ts将output-style加入BARE_SLASH_COMMANDS_HIDE_INVOCATION——main上 Ink 的slashCommandProcessor.ts已有此项,这里补上的是真实的行为差距。语义沿用共享逻辑:裸命令隐藏、带参数命令可见。
无关键问题,无规范问题。新增的 dialogs-modes.test.tsx 沿用同目录测试(如 dialogs-confirm.test.tsx)的 @opentui/react mock 骨架,正确使用 vi.hoisted,并逐条固定 issue 的验收标准:两种覆盖(--system-prompt 与 QWEN_SYSTEM_MD)下的选中、导航 + Enter、显式选 default 才清除、Esc 关闭不生效、写入失败路径(报错且不改变会话)。命令分发测试覆盖裸命令与带参数命令的可见性。
静态审查没有遗漏实质性内容——逻辑足够小,可以完整读完。
测试证据——本 PR 在 7530079f1362db2a41bc3ddb15c55feb1c79a63c 上的 CI
通过 API 一次性读取;此处不重跑(分诊从不执行 PR 代码)。目前无失败。与本 PR 最相关的两个 OpenTUI 门禁已绿:OpenTUI no-flicker gate 与 TUI parity snapshots (ink vs opentui)。ubuntu 单测与 no-AK 集成测试仍在运行;macOS/Windows 单测与带 AK 的集成任务被跳过,这对 fork PR 属正常现象。CI 结束后由 finalize 工作流更新下表。
沙箱验证可以一锤定音:@qwen-code /verify(赞助运行——作者无写权限,需维护者触发;运行前有前置风险筛查与完整工作区清理)——新组件测试 mock 了 OpenTUI 运行时,固定的是选中与转写逻辑而非真实终端行为;作者在 Bun 下的原生 OpenTUI 验证是其自述(仅 macOS),未在此独立复跑。请对验证报告保持与 fork CI 日志同样的审慎。
— Qwen Code · qwen3.8-max
Reviewed at 7530079f1362db2a41bc3ddb15c55feb1c79a63c · re-run with @qwen-code /triage
|
Confidence: 5/5 — clean across every stage: observed bug, minimal parity fix, tests that pin the issue's acceptance criteria. My independent proposal before reading the diff was exactly what this PR does — source the initial selection from the configured style (as Ink does), add the missing hide-invocation entry (as Ink has), and add the direct component tests the issue asked for. The PR matches that proposal with nothing extra: no drive-by changes, no scope creep, and the piece that genuinely belongs elsewhere (style catalog integration, issue criterion 5) is explicitly deferred to #10761, which is still open. The bug is real and well-evidenced: under a system-prompt override the picker highlighted 中文说明置信度:5/5 —— 各阶段都干净:已观测到的 bug、最小的对齐修复、逐条固定 issue 验收标准的测试。 我在看 diff 之前独立想到的方案与本 PR 完全一致——初始选中项读取已配置样式(与 Ink 一致)、补上缺失的隐藏调用项(与 Ink 一致)、补充 issue 要求的组件级测试。PR 与这个方案一致且没有任何多余内容:没有顺手改动、没有范围扩张,真正属于别处的部分(样式目录集成,即 issue 验收标准第 5 条)明确留给仍未合入的 #10761。 bug 真实且证据充分:系统提示词覆盖生效时选择器高亮 — Qwen Code · qwen3.8-max Reviewed at |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
LGTM, looks ready to ship — CI landed green after the review. ✅
|
Released in v0.23.0. |
What this PR does
This aligns the OpenTUI
/output-styleexperience with Ink by keeping the configured style selected even when a system-prompt override temporarily makes it ineffective. It also hides bare picker invocations from the transcript while keeping argument-bearing invocations visible, and adds direct component coverage for selection, navigation, Enter, Esc, persistence, runtime application, and persistence failures.Why it's needed
With
--system-promptorQWEN_SYSTEM_MDactive, the picker previously derived its selection from the temporarily effective style. That made a configured style appear asdefault, so pressing Enter without moving could overwrite the saved selection. OpenTUI also echoed the bare picker command even though Ink suppresses it.Reviewer Test Plan
How to verify
Conciseoutput style, start OpenTUI with either--system-promptorQWEN_SYSTEM_MD, and open/output-style. Confirm thatConciseis selected and pressing Enter preservesConcisein settings while reporting that the override makes it ineffective for the current session.default, move toConciseand press Enter. Confirm that the setting is persisted, applied to the running session, and the system instruction is refreshed. Move back todefaultand confirm that only this explicit selection clears the configured style./output-styleand confirm that no user invocation is added to the transcript. Invoke/output-style Conciseand confirm that the argument-bearing invocation remains visible.Evidence (Before & After)
Concisewith a system-prompt overridedefault; pressing Enter could persistdefaultConcise; pressing Enter preservesConciseand explains that the override makes it ineffective for this session/output-styleNative OpenTUI was exercised under Bun with an isolated settings directory:
Conciseremained selected and persisted while a system-prompt override was active. The focused regression suite passed 109 tests.Tested on
Environment (optional)
macOS local validation used Node.js 25.9.0 for focused tests, lint, the full build, and typecheck, plus Bun 1.3.13 for native OpenTUI interaction.
Risk & Scope
/output-style; direct component and dispatcher tests pin both behaviors.Linked Issues
Fixes #10767.
中文说明
本 PR 做了什么
本 PR 让 OpenTUI 的
/output-style体验与 Ink 对齐:即使系统提示词覆盖暂时让已配置样式不生效,选择器仍会保持选中该配置。它还会从转写记录中隐藏只用于打开选择器的裸命令,同时保留带参数命令,并新增直接组件测试,覆盖初始选中、导航、Enter、Esc、持久化、运行时应用和持久化失败。为什么需要
启用
--system-prompt或QWEN_SYSTEM_MD时,选择器此前根据当前临时生效的样式推导选中项。这会让已配置样式显示成default,因此用户不移动选项直接按 Enter 时可能覆盖已保存的选择。OpenTUI 还会回显裸选择器命令,而 Ink 会隐藏它。Reviewer 测试计划
如何验证
Concise输出样式,使用--system-prompt或QWEN_SYSTEM_MD启动 OpenTUI,然后打开/output-style。确认Concise已选中,按 Enter 后设置仍为Concise,同时提示该覆盖使它在当前会话不生效。default开始移动到Concise并按 Enter。确认设置被持久化、应用到当前会话并刷新系统指令。再移回default,确认只有明确选择default才会清除已配置样式。/output-style,确认转写记录中不会新增用户调用项。调用/output-style Concise,确认带参数的调用仍然可见。证据(Before 与 After)
Concise且系统提示词被覆盖default;按 Enter 可能持久化defaultConcise;按 Enter 保留Concise,并解释覆盖使其在本会话不生效/output-style在隔离设置目录下使用 Bun 执行了原生 OpenTUI 交互验证:系统提示词覆盖生效时,
Concise仍保持选中并持久化。聚焦回归测试共 109 个,全部通过。测试平台
环境(可选)
macOS 本地验证使用 Node.js 25.9.0 运行聚焦测试、lint、完整 build 和 typecheck,并使用 Bun 1.3.13 做原生 OpenTUI 交互验证。
风险与范围
/output-style的转写记录管理;直接组件测试和命令分发器测试固定了这两个行为。关联 Issue
修复 #10767。