Skip to content

fix(cli): surface stacked-skill overflow in non-interactive and ACP runs - #16404

Merged
yiliang114 merged 6 commits into
mainfrom
fix/issue-16396-stacked-skill-overflow
Nov 7, 2026
Merged

yiliang114 merged 6 commits into
mainfrom
fix/issue-16396-stacked-skill-overflow

Conversation

@yiliang114

@yiliang114 yiliang114 commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does

Non-interactive runs now warn when a prompt stacks more than five skills. Headless runs write the warning to stderr, including when stdout uses JSON or stream-JSON. ACP clients receive a live notice before the model response. Channel bridges preserve the notice across tool boundaries and task-result selection.

Inbound channel chats deliver the warning as a separate message after completing the model reply. This also reaches QQ when its response has already streamed or an earlier turn still has a send in flight, without replaying model text. Completing the answer first preserves adapter-specific behavior such as DingTalk's @sender mention.

Why it's needed

Interactive surfaces already report the limit, but headless and ACP/channel users previously received no indication that an extra skill was not loaded. The first five skills still load, additional skill tokens remain literal prompt text, and the warning does not make the run fail.

Reviewer Test Plan

How to verify

  • Submit six leading skill commands in a headless run: expect an overflow warning on stderr and a successful result. Submit five as a control: expect no overflow warning. JSON stdout remains parseable; the warning is a stderr diagnostic, not a new structured event.
  • Submit the same prompt through ACP: expect the live notice before model output. Through a channel, expect a separate warning even if the model makes a tool call.
  • In QQ, check buffered output, an idle-flushed response, and a new turn while an earlier send is still pending. The warning and each model-text segment should be delivered once. Ordinary turns stay unchanged.

Evidence (Before & After)

At the incoming head, a real QQ adapter driven through the shared inbound-message path sent the model text but no warning in both buffered and idle-flushed cases. At the repaired head, the retained tests assert each outgoing warning and model-text segment appears once, including the previous-turn/deferred-send case. The bridge and QQ network API are scripted; this is adapter-level evidence, not live QQ acceptance.

Final validation at 129ed6d: 1,020 channel-base/bridge tests, 287 QQ tests, 116 skill-command tests, and the focused ACP notice-producer test. Full build, typecheck, bundle, changed-file ESLint and formatting passed; the final delivery-order adjustment also received a fresh channel-base build/typecheck and bundle.

Tested on

OS Status
macOS ✅ Local build, typecheck and targeted tests
Windows ⚠️ Not run locally
Linux ⚠️ Current-head CI pending

Environment

Node 22.22.3 on macOS. No live QQ account was configured. Earlier verification comments retain their original revision identifiers and do not certify this head.

Risk & Scope

  • The channel warning may arrive after already-streamed model output. It stays outside adapter text buffers to avoid loss or duplication.
  • The notice is transient and is not replayed from stored transcripts. Headless structured-output consumers must capture stderr.
  • This changes notification delivery only: no rejection of overflowing prompts, skill-limit change, new structured-output event, channel-buffer redesign, or migration.

Linked Issues

Refs #16396.

中文说明

这个 PR 做了什么

非交互运行现在会在提示词堆叠超过五个 skill 时发出警告。Headless 将警告写入 stderr,即使 stdout 使用 JSON 或 stream-JSON 格式也是如此。ACP 客户端在模型响应前收到实时通知。渠道 bridge 会在工具调用边界和任务结果选择过程中保留该通知。

渠道聊天在完成模型回复后,单独发送警告消息。即使 QQ 已流式发送正文,或者上一轮仍有消息正在发送,也能收到警告,且不会重发模型正文。先完成正文还会保留钉钉 @发送者等适配器行为。

为什么需要

交互界面已经会报告这个限制,但 headless 和 ACP/渠道用户此前无法知道额外的 skill 没有加载。前五个 skill 仍会加载,额外 token 仍作为普通提示词文本,警告不会导致运行失败。

评审测试计划

如何验证

  • Headless 输入六个前置 skill 命令:stderr 应出现超限警告,任务仍成功。用五个命令作对照:不应出现警告。JSON stdout 仍可解析;警告属于 stderr 诊断,不是新增结构化事件。
  • 通过 ACP 提交相同提示词:模型输出前应出现实时通知。通过渠道提交时,即使模型调用工具,也应收到独立警告。
  • QQ 分别检查正文仍在缓冲、已被 idle timer 发送、上一轮发送仍未结束三种情况。警告及每段模型正文应各投递一次,普通回合保持不变。

前后证据

接管时的提交中,通过共享入站消息路径驱动真实 QQ 适配器,在缓冲和提前发送两种场景都只能得到模型正文,没有警告。修复后的保留测试断言:每条警告与每段正文均恰好出现一次,也覆盖前一轮延迟发送场景。Bridge 和 QQ 网络 API 使用脚本替身;这是适配器级证据,不是真实 QQ 验收。

最终 129ed6d 验证:1,020 项渠道基础层/bridge 测试、287 项 QQ 测试、116 项 skill 命令测试及定向 ACP 通知生产端测试。完整构建、类型检查、打包、改动文件 ESLint 和格式检查通过;最后的投递顺序调整也重新构建并检查了渠道基础包类型,再次打包。

测试平台

系统 状态
macOS ✅ 本地构建、类型检查与定向测试
Windows ⚠️ 未在本地运行
Linux ⚠️ 当前提交 CI 待完成

环境

macOS,Node 22.22.3。未配置真实 QQ 账号。此前验证评论保留各自的提交标识,不代表本次提交的验证结果。

风险与范围

  • 渠道警告可能晚于已流式发送的正文。它不进入适配器的文本缓冲区,以免丢失或重复。
  • 通知是临时的,不会随历史记录回放;headless 结构化输出调用方需要同时捕获 stderr。
  • 仅调整通知投递:不拒绝超限提示词,不改变 skill 上限,不新增结构化输出事件,不重构渠道缓冲,也不需要迁移。

关联 Issue

Refs #16396。

`parseStackedSlashCommands` already reports `exceededMax`, and the two
interactive surfaces warn about it. The non-interactive path
(`handleSlashCommand`) ignored the flag, so headless (`-p`, JSON,
stream-JSON) and daemon/ACP runs silently dropped the extra `/skill`
tokens with no signal at all.

- carry the flag out of the stacked branch as `stackedSkillOverflow` on
  the `submit_prompt` result, using the same copy as the interactive
  surfaces;
- headless writes it to stderr, so it never becomes a `message` of type
  `error` and the run keeps its exit code;
- ACP emits it as a client-visible slash-command notice before the
  prompt runs.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Patrol-Run: qwen-issue-patrol/jmw3ofzhmya
@qwen-code-review-bot

qwen-code-review-bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Qwen Triage finished — view run. See the stage comments in this thread for the result.

✅ Qwen Triage 已完成 —— 查看运行。结果见本线程中的各阶段评论。

@qwen-code-review-bot

qwen-code-review-bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Re-run at 129ed6d. This gate last looked at the PR when it was 4 files / 26 production lines (e334e4d); it is now 14 files / 105 production lines, so this replaces that pass rather than repeating it.

Template ✓ — every required heading is filled in, the Tested-on table is honest about what was not run, and the Chinese half is a real translation rather than a stub.

Problem: observed, and now independently measured. #16396 is open with type/bug, and the gap is confirmable by reading the tree: both interactive surfaces already build this warning (ui/hooks/slashCommandProcessor.ts:1080, ui/opentui/commands-dispatch.ts:869) while the non-interactive producer had stackedResult.exceededMax in scope at its return site and never forwarded it. The deep-verification round at d8ac0449 settled it empirically on a real bundle: base emits no warning, head emits it exactly once on stderr, stdout still parses as JSON, exit code 0 in both arms, and the ACP arm goes from 0 notice frames to 1 _meta.turnNotice=true frame ahead of the first model text. Not theoretical hardening.

Direction: aligned. It makes headless, ACP and channel runs report what the TUI already reports — a consistency fix inside the CLI's own surface, no new configurability, no mission drift. There is no upstream CHANGELOG signal to weigh: MAX_STACKED_SKILLS is qwen-code-internal (ui/commands/commands.ts:10), so upstream silence means nothing here.

Duplicate check (1-pre): nothing to flag. The body says Refs #16396 with no closing keyword, GitHub's closing-reference parser returns zero linked issues, and #16396 is open — so there is no merged fix this could be a duplicate of.

Size: 105 production lines (100 added, 5 deleted) across 8 files, 706 test lines across 6 files, no generated or schema files. The change does span packages (channels/base, channels/qqbot, cli), which is the core-infrastructure gate's cross-package trigger — but you hold admin on this repo, so the two-tier external gate does not apply, and at 105 lines it is far under the 500-line threshold either way. No size escalation, no large-PR advisory.

Approach: the 3.6x growth is not scope creep, and I want to say that plainly because it is the first thing a reviewer will notice. The narrow CLI-only version was measured and found not to reach channel users — the audience #16396 actually names — because the notice landed in the slash-command slot that model text shadows, and then in a buffer that every response boundary wipes. The extra ~79 production lines are the delivery path, i.e. the part the issue complains about. One question I would still ask, non-blocking and already on round 6's deferred list: the notice is composed into prompt()'s return value and then stripped back out by length arithmetic in ChannelBase, which is a seam two packages have to agree on silently.

Risk: Stage 1e matches one high-risk path — packages/cli/src/acp-integration/session/Session.ts (acp-integration), which this repo's revert-history analysis correlates with post-merge reverts. The change there is 13 additive lines inside an existing case, no state, no control-flow change. The larger blast radius in this head is not the flagged file: the delivery half now sits in ChannelBase's inbound turn path, which all 11 channel adapters inherit, and only 3 of them (qqbot, dingtalk, feishu) override onResponseChunk. So: full Stage 2 enrichments, CI evidence required before approval, and a sandboxed lane named in Stage 2.

Moving on to code review. 🔍

中文说明

在 129ed6d 重跑。本门禁上次审查时该 PR 还是 4 个文件 / 26 行生产代码(e334e4d),现在是 14 个文件 / 105 行生产代码,因此本次是替代上一轮结论,而不是重复它。

模板完整 ✓ —— 所有必填小节都写了,测试平台表格如实标注了未运行的部分,中文部分是真正的翻译而非占位。

问题: 已观测到,并且已有独立实测。#16396 处于 open 且带 type/bug 标签;只读代码即可确认缺口:两个交互面早就在拼这条警告(ui/hooks/slashCommandProcessor.ts:1080、ui/opentui/commands-dispatch.ts:869),而非交互路径的生产端在 return 处明明拿得到 stackedResult.exceededMax,却一直没往下传。d8ac0449 上的深度验证已用真实 bundle 实测确认:base 无警告、head 恰好输出一次到 stderr,stdout 仍可解析为 JSON,两臂退出码都是 0;ACP 侧从 0 条通知帧变为 1 条 _meta.turnNotice=true,且早于首条模型正文。不是理论性加固。

方向: 对齐。它让 headless、ACP 与渠道运行报告 TUI 早就报告的信息——属于 CLI 自身界面内的一致性修复,没有新增可配置项,也没有偏离主线。上游 CHANGELOG 无信号可参考:MAX_STACKED_SKILLS 是 qwen-code 内部上限(ui/commands/commands.ts:10),上游沉默在此说明不了什么。

重复检查(1-pre): 无需标记。正文写的是 Refs #16396,没有关闭关键字,GitHub 的 closing-reference 解析返回零个关联 issue,且 #16396 仍处于 open——因此不存在「已被某个已合并修复覆盖」的问题。

规模: 生产代码 105 行(新增 100、删除 5),分布在 8 个文件;测试 706 行,分布在 6 个文件;无生成文件或 schema 文件。改动确实跨包(channels/base、channels/qqbot、cli),触发核心模块门禁的「跨包」条件——但你在本仓库持有 admin 权限,因此外部贡献者的两级门禁不适用;而且 105 行也远低于 500 行阈值。无需规模升级,也不触发大 PR 提示。

方案: 这次 3.6 倍的增长不是范围蔓延,我想明确说明,因为这是审查者第一眼会注意到的事。最初仅改 CLI 的版本经过实测,被发现根本触达不了渠道用户——也就是 #16396 真正点名的受众——因为通知落在了会被模型正文遮蔽的 slash-command 槽位,随后又被每次响应边界清空的缓冲区吃掉。多出的约 79 行生产代码正是投递路径,即 issue 抱怨的那部分。我仍想提一个问题(非阻塞,且已在第 6 轮的延后清单里):通知先被拼进 prompt() 的返回值,再在 ChannelBase 里按长度算术裁掉,这是两个包之间需要默默保持一致的接缝。

风险: Stage 1e 命中一个高风险路径——packages/cli/src/acp-integration/session/Session.ts(acp-integration),本仓库的 revert 历史分析显示该路径与合并后回滚相关。该处改动是在已有 case 内新增 13 行,不引入状态、不改变控制流。本版真正更大的影响面并不是这个被标记的文件:投递部分现在位于 ChannelBase 的入站轮次路径中,11 个渠道适配器全部继承它,而其中只有 3 个(qqbot、dingtalk、feishu)重写了 onResponseChunk。因此:Stage 2 的完整附加内容、批准前需要 CI 证据,并在 Stage 2 点名沙箱验证通道。

进入代码审查 🔍

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at 129ed6d671e6d778e93ceb91ec4f5706e4ce0dfd · re-run with @qwen-code /triage

@qwen-code-review-bot

qwen-code-review-bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Code review at 129ed6d, static only — I did not build or execute anything from this branch. My independent proposal before reading the diff was: forward exceededMax out of handleSlashCommand, write it to stderr in the headless sink, emit it as a tagged frame in the ACP sink, and give it a slot in the bridges that response boundaries cannot clear. That is what this does, so I have no simpler alternative to argue for. The one design choice I would question is the prefix-then-strip round trip between the bridges and ChannelBase, and that is finding 2 below.

Verified fixed since the last gate pass

I checked these against the head rather than taking the resolved threads on faith:

  • The Critical is gone. The deep-verification round reproduced the notice being dropped whenever a turn crossed a response boundary (tool_call pending/in_progress, plan, permission request) and in per_task mode. Both bridges now hold the notice in its own variable that clearChunks does not touch (AcpBridge.ts:463, DaemonChannelBridge.ts:672), and composition happens after the per_task substitution instead of being bypassed by it (AcpBridge.ts:520-531, DaemonChannelBridge.ts:871-873). Three new tests drive exactly the shapes that were failing: tool-call boundary in both bridges, per_task reply in AcpBridge, plus notice-only and cross-session cases. This is the independent notice buffer the verification round recommended and could not measure.
  • The ACP sink is now pinned. Session.test.ts asserts the emitted frame carries the turnNotice metadata, which kills both mutations that survived in that matrix (deleting the emit block, and dropping the metadata).
  • The wire key is a single exported constant (ChannelAgentBridge.ts:18), imported by the producer and both bridges and re-exported from the package index — the duplication finding from round 3 is properly closed, not just papered over.
  • All 9 review threads are resolved, and round 6 of /review posted 0 fresh findings.

Standing items — recorded, not requested

This PR is at review round 6, so under the repo's convergence posture I am listing these rather than asking for them. None blocks the merge.

  1. ChannelBase.ts:7644-7652 — a failed advisory send reclassifies a delivered turn as failed. The notice send sits inside the delivery try, unwrapped. If it throws after the answer already reached the user, the catch at :7676 emits a failed segment end and a failed lifecycle with phase: 'delivery' (:7708-7710) and rethrows. Before this change a turn whose answer was delivered could not subsequently fail. The throw is reachable, not hypothetical: QQ's send path raises DeliveryError('ACTIVE_MSG_DISABLED') when the reply anchor has expired and group active messages are off (QQChannel.ts:1405-1417). The cheap fix is a try/catch plus a stderr log, and this same file already establishes that pattern for onPromptEnd in its finally, with a comment explaining exactly why an unguarded throw there is dangerous.
  2. ChannelBase.ts:7627-7628 — the strip trusts the prefix by arithmetic. response.slice(turnNotice.length + 2) is correct today, and I verified that rather than assuming it: each bridge has exactly one successful return path and both always compose the notice first (AcpBridge.ts:529-531, DaemonChannelBridge.ts:871-879), every other exit throws. The residual risk is lifetime, not logic — ChannelBase keeps its own listener attached until :7729, slightly longer than the bridge keeps its own, so a notice delivered inside that window would set the local variable without being present in the returned text, and the slice would silently eat the first ~97 characters of a real answer. Round 6 listed precisely this question (can a stale notice frame reach a later prompt) as unexplored. I am reporting it as theoretical — I have no reproduction, and a startsWith guard would convert the worst case from "answer truncated" to "notice duplicated".
  3. The headless sink still has no committed test. nonInteractiveCli.ts:1346-1348 is the only production hunk with no test in this diff; the mutation matrix at d8ac0449 showed it surviving, and nothing at this head adds one. The behaviour itself was A/B-proven on a real bundle, so this is a pinning gap rather than a defect.
  4. The warning sentence now exists verbatim in three places — nonInteractiveCliCommands.ts:635, ui/hooks/slashCommandProcessor.ts:1080, ui/opentui/commands-dispatch.ts:869. Hoisting it beside MAX_STACKED_SKILLS in ui/commands/commands.ts collapses all three and puts it where a reader would look.
  5. nonInteractiveCli.ts:1346 writes stderr unconditionally, while this file's own convention splits TEXT from structured output, so a stream-json consumer reading only stdout still learns nothing. Carried forward from my last pass, unchanged, still a Suggestion.
  6. DingTalk, card path only. The mention target is single-use and consumed by the first sendResponseMessage (DingtalkAdapter.ts:3153-3160). The normal path does what the PR description claims — the answer takes the mention, the trailing notice goes out without it. But when onResponseComplete returns early through interactionPresenter.closeOutput (:3194-3206), the answer never calls sendResponseMessage, so the notice consumes the mention and the @ lands on the warning instead of the card. Cosmetic; I checked it rather than repeating round 6's version of the finding, which read as if the main path were affected.

Two smaller notes, no action needed: the loop/unattended turn path (runLoopBridgePrompt, ChannelBase.ts:2782) attaches no notice listener, so there the warning rides inline inside the answer text — different presentation, not a loss. And the new key's value is a bare turnNotice where its siblings on the same contract are namespaced qwen.channel.*; it is exported and documented now, but it is a client-visible wire value that gets awkward to rename later.

Flow

sequenceDiagram
    participant P0 as User
    participant P1 as nonInteractiveCliCommands
    participant P2 as nonInteractiveCli headless
    participant P3 as ACP Session
    participant P4 as Channel bridge Acp or Daemon
    participant P5 as ChannelBase inbound turn
    participant P6 as Adapter qqbot dingtalk etc
    P0->>P1: prompt stacking six skill tokens
    P1-->>P2: submit_prompt plus stackedSkillOverflow
    P2->>P2: write the warning to stderr
    P1-->>P3: submit_prompt plus stackedSkillOverflow
    P3->>P4: agent_message_chunk tagged as a turn notice
    P4->>P4: keep the notice in its own buffer
    Note over P4: response boundaries clear text chunks only
    P4-->>P5: prompt returns notice then blank line then body
    P5->>P6: answer first, via onResponseComplete
    P5->>P6: notice second, via sendResponseMessage
Loading
Files changed (14)
File What changed
packages/channels/base/src/AcpBridge.ts Own notice buffer that response boundaries do not clear, composition ahead of the per_task substitution, and a tagged frame routed to the new event instead of the text buffer.
packages/channels/base/src/AcpBridge.test.ts Five cases: notice ahead of model text, notice surviving a tool-call boundary, notice on the per_task reply, notice-only turn without a trailing blank paragraph, cross-session isolation.
packages/channels/base/src/ChannelAgentBridge.ts Exports the wire key and declares the event on the bridge event map, with the composition contract written into the doc comment.
packages/channels/base/src/ChannelBase.ts Listens for the notice per turn, strips the prefix off the answer, then sends the notice as its own message after the answer so adapters keep their reply metadata.
packages/channels/base/src/ChannelBase.test.ts Parameterised over an empty and a non-empty answer; asserts the notice goes out once and separately, streamed chunks stay clean, and the listener is removed.
packages/channels/base/src/DaemonChannelBridge.ts Same buffer, composition and emit changes on the daemon side.
packages/channels/base/src/DaemonChannelBridge.test.ts Five cases mirroring the ACP side, including a boundary driven from inside the turn and two session-isolation shapes.
packages/channels/base/src/index.ts Re-exports the new key so the CLI producer can import it across packages.
packages/channels/qqbot/src/turn-notice.test.ts New file; drives the real QQChannel and ChannelBase against a scripted bridge over four delivery shapes times overflow on and off, asserting each segment and the notice are delivered exactly once.
packages/cli/src/acp-integration/session/Session.ts Emits the notice as a tagged slash-command frame at the top of submit_prompt, ahead of the turn content.
packages/cli/src/acp-integration/session/Session.test.ts Pins the frame shape including the turnNotice metadata.
packages/cli/src/nonInteractiveCli.ts Writes the notice to stderr, leaving stdout and the exit code untouched.
packages/cli/src/nonInteractiveCliCommands.test.ts Producer tests for six skills, overflow reported and the sixth token left as prompt text, and five skills with no warning.
packages/cli/src/nonInteractiveCliCommands.ts Declares the optional result field and populates it from exceededMax.

Test evidence — this PR's own CI, read via the API

This is an unattended run (GITHUB_EVENT_NAME=issue_comment), so per the triage rules I never build or execute PR code. The evidence below is the PR's own CI at the reviewed commit, fetched once; nothing is pending and nothing is red. There is no tmux capture in this comment and that is deliberate, not an omission — real-scenario driving is local-invocation only, and the interactive TUI is untouched by this diff so there is no TUI surface to capture.

Every check on 129ed6d is settled: zero failures across all check-runs. The 8 Linux unit-test shards, Lint & Static, Build unit-test tree, Integration Tests (no-AK, No Sandbox), the 4 web-shell E2E smoke shards, TUI parity snapshots and the Managed Agent gate all report success; 0 pull_request workflow runs were still in flight when I wrote this.

One correction to earlier rounds: Integration Tests (CLI, No Sandbox) shows skipped by design, not as a gap in this PR — ci.yml:3153 gates that job on github.event_name == 'merge_group', so it only ever runs in the merge queue. Two prior review rounds listed it under "not reviewed: build-and-test", which made it sound like this head was missing coverage every PR equally lacks.

Check Conclusion
Linux unit tests (shard 1/8 … 8/8) success (8/8)
Test (ubuntu-latest, Node 22.x) success
Build unit-test tree (ubuntu-latest, Node 22.x) success
Lint & Static (ubuntu-latest, Node 22.x) success
Integration Tests (no-AK, No Sandbox) success
web-shell E2E Smoke (ubuntu-latest, Node 22.x) success
web-shell E2E Smoke (shard 1/4 … 4/4) success (4/4)
TUI parity snapshots (ink vs opentui) success
Managed Agent gate success
Classify PR / Check TUI impact / Select the Managed Agent tier success
Test (macos-latest, Node 22.x) skipped
Test (windows-latest, Node 22.x) skipped
macOS unit tests skipped
Integration Tests (CLI, No Sandbox) skipped — merge_group only
OpenTUI no-flicker gate / SDK Java skipped

What CI proves here is that the PR's tests pass. It cannot prove they pin the change, and on two points the behavioural claim currently rests on the author's word or on fakes. The author's local report claims 1,424 targeted tests at this head — that is the author's claim, attributed as such, not evidence I re-ran.

Sandboxed verification would settle this: @qwen-code /verify — the previous round A/B-proved the headless and ACP halves on a real bundle, but at d8ac0449, a head that predates the entire channel-delivery fix, and the run re-triggered at 129ed6d (run 42210646012) died on an infrastructure error and produced no report. Specifically unsubstantiated by anything independent right now: that the notice survives a real daemon turn crossing a tool-call boundary or using per_task (both are unit-tested through fake sessions only), and that a second per-turn sendResponseMessage is safe in the seven adapters that inherit the base no-op onResponseChunk — telegram, wecom, weixin, email, github, gitlab, dws — where only qqbot has a committed adapter-level test. You have write access, so this is an ordinary /verify, not a sponsored run. /tmux is not the lane here: no TUI surface changed.

中文说明

在 129ed6d 做的静态代码审查——我没有构建或执行本分支的任何代码。读 diff 之前我自己的方案是:把 exceededMax 从 handleSlashCommand 传出来,headless 侧写 stderr,ACP 侧发一条打了标记的帧,并在两个 bridge 里给它一个响应边界清不掉的槽位。这正是本 PR 的做法,所以我没有更简的替代方案可主张。唯一我会质疑的设计是 bridge 与 ChannelBase 之间「先拼接、再裁掉」的往返,见下面第 2 条。

已确认修复(对照当前提交核验,不是采信线程状态):

  • 那个 Critical 已经消失。 深度验证曾实测复现:只要轮次跨过响应边界(tool_call pending/in_progress、plan、权限请求)或处于 per_task 模式,通知就会丢失。现在两个 bridge 都把通知放在 clearChunks 不会触碰的独立变量里(AcpBridge.ts:463、DaemonChannelBridge.ts:672),并且拼接发生在 per_task 替换之后而不再被它绕过(AcpBridge.ts:520-531、DaemonChannelBridge.ts:871-873)。三个新测试正好驱动了此前失败的形状:两个 bridge 的工具调用边界、AcpBridge 的 per_task 回复,外加通知独占轮次与跨会话隔离。这正是验证轮建议但当时无法实测的「独立通知缓冲区」。
  • ACP 出口现在被钉住了。 Session.test.ts 断言发出的帧带有 turnNotice 元数据,这杀掉了变异矩阵中此前存活的两个变异(删除发射代码块、去掉元数据)。
  • 线缆键已是单一导出常量(ChannelAgentBridge.ts:18),生产端与两个 bridge 都导入它,并从包索引再导出——第 3 轮的重复问题是真正关闭的,不是掩盖。
  • 9 条审查线程全部 resolved,/review 第 6 轮新增发现为 0。

遗留项——仅记录,不要求修改(本 PR 已到第 6 轮,按仓库的收敛姿态只落地 Critical,以下均不阻塞合并):

  1. ChannelBase.ts:7644-7652:一次失败的附加通知发送,会把已投递成功的轮次重新判定为失败。 通知发送位于投递 try 内且未包裹。若它在答案已送达用户之后抛错,:7676 的 catch 会发出 failed 的 segment end 与 phase: 'delivery' 的 failed 生命周期事件(:7708-7710)并重新抛出。此改动之前,答案已投递的轮次不可能随后失败。抛错是可达的、并非假设:当回复锚点过期且群内主动消息被关闭时,QQ 的发送路径会抛出 DeliveryError('ACTIVE_MSG_DISABLED')(QQChannel.ts:1405-1417)。便宜的修法是 try/catch 加一条 stderr 日志,而本文件的 finally 里对 onPromptEnd 已经确立了这一模式,并附有注释说明为何那里的裸抛危险。
  2. ChannelBase.ts:7627-7628:裁剪是按算术信任前缀的。 response.slice(turnNotice.length + 2) 今天是正确的,这一点我做了核验而非假设:每个 bridge 只有一条成功返回路径,且都先拼接通知(AcpBridge.ts:529-531、DaemonChannelBridge.ts:871-879),其余出口全部抛错。残留风险在生命周期而非逻辑——ChannelBase 自己的监听器要到 :7729 才摘除,比 bridge 自己的稍晚,因此在这个窗口内送达的通知会让局部变量被赋值、却不在返回文本里,于是裁剪会静默吃掉真实答案开头约 97 个字符。第 6 轮正是把这个问题(陈旧通知帧是否会进入后续 prompt)列为未探索。我按理论性问题上报——我没有复现——而一个 startsWith 判断就能把最坏情况从「答案被截断」变成「通知重复一次」。
  3. headless 出口仍然没有提交的测试。 nonInteractiveCli.ts:1346-1348 是本 diff 中唯一没有测试的生产改动;d8ac0449 的变异矩阵显示该 hunk 存活,本提交也没有补上。行为本身已在真实 bundle 上做过 A/B 证明,所以这是「未钉住」而非缺陷。
  4. 同一条警告文案现在有三份逐字副本——nonInteractiveCliCommands.ts:635、ui/hooks/slashCommandProcessor.ts:1080、ui/opentui/commands-dispatch.ts:869。把它提到 ui/commands/commands.ts 中 MAX_STACKED_SKILLS 旁边即可三合一,也正是读者会去找的位置。
  5. nonInteractiveCli.ts:1346 无条件写 stderr,而本文件既有约定是区分 TEXT 与结构化输出,因此只读 stdout 的 stream-json 消费方依然一无所知。此条沿用上一轮结论,未变化,仍是 Suggestion。
  6. 仅钉钉卡片路径。 @目标是单次使用,由第一次 sendResponseMessage 消费(DingtalkAdapter.ts:3153-3160)。常规路径与 PR 描述一致——答案拿到 @,随后的通知不带 @。但当 onResponseComplete 经 interactionPresenter.closeOutput 提前返回时(:3194-3206),答案不会调用 sendResponseMessage,于是通知消费掉 @,@ 落在警告而不是卡片上。属于外观问题;我是自己核验过的,而不是照搬第 6 轮的表述——那条读起来像是主路径也受影响。

另两点小说明,无需处理:loop/无人值守轮次路径(runLoopBridgePrompt,ChannelBase.ts:2782)没有挂通知监听器,因此那里警告是随答案文本内联送达的——呈现方式不同,不是丢失。新键的取值是裸的 turnNotice,而同一契约上的兄弟键都在 qwen.channel.* 命名空间下;它现在已导出并有文档,但这是客户端可见的线缆取值,日后再改名会比较别扭。

测试证据(本节携带的是什么): 这是无人值守运行(GITHUB_EVENT_NAME=issue_comment),按 triage 规则我从不构建或执行 PR 代码;下面的证据是通过 API 一次性读取的、本 PR 自己在被审提交上的 CI 结果,无待完成项、无红灯。本评论没有 tmux 终端输出,这是刻意如此而非遗漏——真实场景驱动仅限本地调用,且本 diff 未触及交互式 TUI,没有可截取的 TUI 界面。Integration Tests (CLI, No Sandbox) 显示 skipped 是设计使然(ci.yml:3153 限定 merge_group,只在合并队列运行),此前两轮把它写进「未审查」容易让人误以为本提交缺了覆盖,其实所有 PR 都一样不跑。作者本地报告称本提交有 1,424 项定向测试通过——这是作者的说法,按此归属,不是我重跑的证据。

CI 能证明的是本 PR 的测试通过,不能证明这些测试钉住了改动。沙箱验证可以补上这一段:@qwen-code /verify。上一轮已在真实 bundle 上 A/B 证明了 headless 与 ACP 两半,但那是在 d8ac0449——早于整个渠道投递修复;而在 129ed6d 重新触发的那次(run 42210646012)因基础设施故障未产出报告。目前缺乏独立佐证的具体两点:通知能否在真实 daemon 的、跨工具调用边界或使用 per_task 的轮次中存活(现在只有用假会话做的单元测试);以及在 7 个继承 base 空实现 onResponseChunk 的适配器(telegram、wecom、weixin、email、github、gitlab、dws)中,每轮第二次 sendResponseMessage 是否安全——其中只有 qqbot 有提交的适配器级测试。你有写权限,因此这是普通 /verify,不是 sponsored run。/tmux 不适用于此处:没有 TUI 界面变化。

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at 129ed6d671e6d778e93ceb91ec4f5706e4ce0dfd · re-run with @qwen-code /triage

@qwen-code-review-bot

qwen-code-review-bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Confidence: 4/5 — the one Critical this PR ever had is verifiably fixed at this head, CI is fully green and settled, and everything still open is a Suggestion already recorded in round 6. Not 5/5 because two of those Suggestions sit on the seam I would eventually want hardened, and because the channel breadth is asserted by fakes rather than measured.

My independent proposal was the same shape as this change, so there is no simpler path I am withholding. What I want to be honest about is the growth, because it is the thing that should make a reviewer hesitate: 4 files and 26 production lines at the head I last gated, now 14 files and 105, across six review rounds. I checked whether that is the ratchet our convergence rule exists to stop, and it is not. Each expansion was driven by a measurement showing the previous scope did not reach the audience #16396 names — first the notice landing in a slot that model text shadows, then it being wiped by every response boundary, then QQ losing it once output had streamed or a previous send was still in flight. Shipping the original 26 lines would have made the issue's headline case (a channel user stacking six skills) still silent. That is scope following evidence, not scope drifting.

On the "am I being worn down by volume" question: I re-verified the Critical fix against the head instead of trusting the nine resolved threads, and I re-derived the deferred findings rather than repeating them. Two of them changed under inspection — round 6's DingTalk mention finding reads as if the main path were affected, and it is not (the answer consumes the single-use mention first; only the card early-return path leaves it for the notice), and the Integration Tests (CLI, No Sandbox) skip that two rounds listed as unreviewed coverage is merge_group-only by design, so it was never available to any PR.

If I had to maintain this in six months, the part I would want changed is finding 2. One buffer, one exported wire key, and a composition rule documented on the event itself is all fine; the strip in ChannelBase is the single place where two packages agree by length arithmetic instead of by check, and it is the only spot where a future bridge change can silently eat the beginning of a real answer. A startsWith guard is a one-liner and would make the failure mode benign. Finding 1 is the other one I would not mind seeing, since an advisory message should not be able to mark a delivered turn as failed — the pattern for guarding it already exists twenty lines below in the same function. Neither is worth another round on a PR that is already at round 6; both are fine as follow-ups.

Verdict: approve. Nothing is pending — 0 pull_request workflow runs in flight and zero red check-runs on 129ed6d — so I am approving in this run rather than deferring to the finalize job, pinned to the reviewed commit. The approval guardrail does not apply: this is a same-repo branch and a fix(cli) title, not a fork refactor, and Stage 0 raised no escalation (maintainer-authored, 105 production lines, far under the 500-line threshold).

One mechanical note for whoever merges: the PR's reviewDecision was CHANGES_REQUESTED coming into this run, from this bot's own /review submission at d8ac0449 — a Test-Plan-accuracy request-changes on a head three force-pushes back. This approval supersedes it as the bot's latest state-bearing review, but if the merge box still shows a stale request-changes after this, that is the review to dismiss.

中文说明

Confidence: 4/5 —— 本 PR 历史上唯一的 Critical 在当前提交上已被可核验地修复,CI 全绿且已跑完,剩下未结的全部是第 6 轮已记录在案的 Suggestion。没给到 5/5,是因为其中两条正落在我最终希望加固的那道接缝上,也是因为渠道覆盖面是靠替身断言的,而非实测。

我独立想到的方案与本次改动形态一致,所以我没有更简的路径藏着不说。我想坦诚讲的是它的体量增长,因为这才是让审查者应该犹豫的地方:我上次门禁时是 4 个文件、26 行生产代码,现在是 14 个文件、105 行,中间经过 6 轮审查。我核查过这是否正是收敛规则要阻止的滚雪球——不是。每一次扩张都由一次实测驱动,说明此前的范围没有触达 #16396 点名的受众:先是通知落在会被模型正文遮蔽的槽位,接着被每次响应边界清空,然后是 QQ 在正文已流式发出、或上一轮发送仍在途时丢掉它。若按最初那 26 行合并,issue 标题所述的场景(渠道用户堆叠六个 skill)仍然是静默的。这是范围跟随证据,不是范围漂移。

关于「我是不是被数量磨软了」:我是拿当前提交重新核验那个 Critical 的修复,而不是采信 9 条已 resolved 的线程;那些延后的发现我也是重新推导而非照搬。其中两条在核查后发生了变化——第 6 轮的钉钉 @ 发现读起来像主路径受影响,实际不是(单次使用的 @ 目标先被答案消费,只有卡片提前返回的路径才把它留给通知);另外两轮把 Integration Tests (CLI, No Sandbox) 的 skipped 当作未审查的覆盖,而它按设计只在 merge_group 运行,任何 PR 都拿不到。

如果六个月后由我维护,我最想改的是第 2 条。一个缓冲区、一个导出的线缆键、以及写在事件本身上的拼接规则,这些都没问题;ChannelBase 里的裁剪是唯一一处两个包靠长度算术而非显式检查达成一致的地方,也是未来某次 bridge 改动可能静默吃掉真实答案开头的唯一位置。加一个 startsWith 判断只是一行,就能把失败模式变成无害。第 1 条我也不介意看到——一条附加提示不应该有能力把已投递的轮次标记为失败,而守卫它的模式在同一函数下方二十行就已经存在。对一个已经到第 6 轮的 PR,两者都不值得再开一轮;作为后续跟进都合适。

结论:批准。没有待完成项——129ed6d 上在飞的 pull_request 工作流为 0,红灯 check-run 为 0——因此本轮直接批准,而不是交给 finalize 作业,并绑定到被审提交。批准护栏不适用:这是同仓库分支、标题为 fix(cli),不是 fork 的 refactor;Stage 0 也没有升级(维护者本人提交、105 行生产代码,远低于 500 行阈值)。

给合并者的一条机制性提示:本轮开始前 PR 的 reviewDecision 是 CHANGES_REQUESTED,来源是本 bot 自己在 d8ac0449 上提交的 /review——那是针对三个 force-push 之前的提交、关于 Test Plan 数字准确性的 request-changes。本次批准会取代它,成为本 bot 最新的带状态审查;但如果合并框在此之后仍显示陈旧的 request-changes,需要 dismiss 的就是那一条。

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at 129ed6d671e6d778e93ceb91ec4f5706e4ce0dfd · re-run with @qwen-code /triage

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, looks ready to ship — CI landed green after the review. ✅

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Plan (not a blocker): Tests 116 passed — this review observed 40998, 355 passed; 75 passed — this review observed 40998, 355 passed; 7 passed — this review observed 40998, 355 passed.

中文说明

Test Plan(非阻断):Tests 116 passed — this review observed 40998, 355 passed; 75 passed — this review observed 40998, 355 passed; 7 passed — this review observed 40998, 355 passed。

— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.7)

@yiliang114

yiliang114 commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator Author

Local verification: PASS

  • Mode: merge-reference (baseline = merge-base, not main tip)
  • Arms: before 7c6f93ca516e5501397b3ccd3c925aa362b0b702 → after e334e4d1618a64e50dce0870b9b3edddba7f924b
  • Runtime: freshly installed + built worktree per arm, bundle dist/cli.js, qwen-code 0.26.7 (node dist/cli.js --version returned 0.26.7 on the before arm)
  • Provider boundary: scripted OpenAI-compatible stub over loopback (/v1/chat/completions, SSE). The model boundary is recorded, not a real-model acceptance run.
  • Prompt shape under test: /sk1 /sk2 /sk3 /sk4 /sk5 /sk6 do it (six stacked skills, limit is five) and /sk1 … /sk5 do it (control)
# Surface Claim Before (7c6f93ca) After (e334e4d1) Result
1 headless -p six stacked skills warn on stderr no warning Only the first 5 skills were loaded. Additional /skill tokens were treated as prompt text. on stderr PASS
2 headless -p warning does not change exit code exit 0 exit 0 PASS
3 wire/payload only five skill bodies reach the model model request carries sk1..sk5, /sk6 stays in prompt text identical PASS (parity)
4 headless -p five skills stay warning-free (control) no warning no warning PASS
5 ACP (--acp) client-visible notice before the turn 0 session/update frames with _meta.source=slash_command 1 frame carrying the same text PASS
6 regression pin new test is load-bearing head's test file on merge-base source: 1 failed / 75 passed (stackedSkillOverflow received undefined) native run at head: 76 passed PASS

Causal evidence (headless, arm-by-arm):

before-six  exit=0  overflow-warning=absent   model markers=[sk1,sk2,sk3,sk4,sk5]  /sk6 as text=true
after-six   exit=0  overflow-warning=present  model markers=[sk1,sk2,sk3,sk4,sk5]  /sk6 as text=true
before-five exit=0  overflow-warning=absent   model markers=[sk1,sk2,sk3,sk4,sk5]
after-five  exit=0  overflow-warning=absent   model markers=[sk1,sk2,sk3,sk4,sk5]

ACP evidence: the after arm answered session/prompt with an agent_message_chunk whose _meta.source is slash_command and whose text is the overflow notice; the before arm produced no such frame for the same prompt in the same session shape (initialize → session/new → session/prompt, stdio JSON-RPC).

Controls and boundaries:

  • Control arm (five skills) is warning-free on both revisions, so the warning tracks the overflow predicate rather than "any stacked skill".
  • The sixth token staying prompt text is unchanged by this PR on both arms — the diff adds the notice, not different skill loading.
  • Verified scope is the headless -p path and the ACP session path. No TUI rendering, Web Shell component, or channel-adapter UI was exercised; the notice itself is emitted through the same emitSlashCommandOutput the ACP path already used.
  • Scripted provider limitation: this proves what the client receives and what the process writes, not model-quality acceptance.

Relevant gates: local runs only (npx vitest run packages/cli/src/nonInteractiveCliCommands.test.ts → 76 passed; same file against merge-base source → 1 failed / 75 passed). CI was green on this head at verification time; no CI was re-run or modified.

Local verdict is not a merge approval.

中文版(可展开)

本地验证:PASS(merge-reference,基线取 merge-base 7c6f93ca,不是 main tip)

  • 两臂均为独立重新安装并构建的 worktree,产物是仓库根 dist/cli.js bundle(0.26.7)。
  • 模型边界:本机回环上的 脚本化 OpenAI 兼容桩(SSE 流式),不是真模型验收。
  • 被测输入:/sk1 /sk2 /sk3 /sk4 /sk5 /sk6 do it(叠 6 个 skill,上限 5)与 /sk1 … /sk5 do it(对照)。

关键结论:

  1. headless -p:6 个 skill 时,旧head stderr 无任何提示;head 新增 Only the first 5 skills were loaded. Additional /skill tokens were treated as prompt text.,退出码两臂都是 0(提示不改变退出码)。
  2. 因果面:两臂发给模型的 payload 完全一致——只载入 sk1..sk5 五个 skill 正文,/sk6 留在提示文本里。这个 PR 加的是「提示」,不是「多载一个 skill」。
  3. 对照:5 个 skill 时两臂都无提示,说明提示跟的是「超限」这个判据。
  4. ACP(--acp,stdio JSON-RPC:initialize → session/new → session/prompt):head 回了 1 条 _meta.source=slash_command 的 agent_message_chunk 携带同一句提示;旧 head 同形状会话里 0 条。
  5. 回归钉双向成立:head 自己的测试文件跑在 merge-base 源码上 1 failed / 75 passed(失败点正是 stackedSkillOverflow 取到 undefined);跑在 head 上 76 passed。

边界:只覆盖 headless -p 与 ACP 会话两条路径;未跑 TUI/Web Shell/渠道 UI 渲染。本地 PASS 不等于合并批准。

Superseded for head d8ac04497cdc: this run predates the channels commit — current-head verification published at #16404 (comment)

…reply

Channel bridges deliver only prompt()'s resolved text, so the overflow notice
emitted on the slash-command channel was shadowed as soon as the turn produced
model text and channel users never saw the warning. Tag the notice in `_meta`
and route it into the turn's text in both bridges.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Patrol-Run: qwen-pr-closeout/jmw3tg0yrfb

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Plan (not a blocker): Tests 116 passed — this review observed 389, 41167, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 355, 14829 passed; 75 passed — this review observed 389, 41167, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 355, 14829 passed; 7 passed — this review observed 389, 41167, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 355, 14829 passed.

中文说明

Test Plan(非阻断):Tests 116 passed — this review observed 389, 41167, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 355, 14829 passed; 75 passed — this review observed 389, 41167, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 355, 14829 passed; 7 passed — this review observed 389, 41167, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 355, 14829 passed。

— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.8)

Comment thread packages/channels/base/src/AcpBridge.ts Resolved
@yiliang114

Copy link
Copy Markdown
Collaborator Author

Local verification: PASS

  • Mode: merge-reference (baseline = merge-base, not main tip)
  • Arms: before 7c6f93ca516e5501397b3ccd3c925aa362b0b702 → after d8ac04497cdc0d65ad3f1e47f746f2f3771d7668
  • Scope of this run: the head moved from e334e4d1 (previously reported) to d8ac0449, adding one commit that carries the overflow notice through the channel bridges. Both arms were rebuilt from scratch, so every row below is current-head evidence.
  • Runtime: freshly installed + built detached worktree per arm, bundle dist/cli.js; artifacts are distinguishable (before md5 1d60ad408f35, no file in dist mentions turnNotice; after md5 273ba057b07e, two chunks do)
  • Provider boundary: scripted OpenAI-compatible stub over loopback (/v1/chat/completions, SSE). The model boundary is recorded, not a real-model acceptance run.
  • Prompt shape under test: /sk1 /sk2 /sk3 /sk4 /sk5 /sk6 do it (six stacked skills, limit is five) and /sk1 … /sk5 do it (control)
# Surface Claim Before (7c6f93ca) After (d8ac0449) Result
1 headless -p six stacked skills warn on stderr no warning Only the first 5 skills were loaded. Additional /skill tokens were treated as prompt text. PASS
2 headless -p the notice does not change the exit code exit 0 exit 0 PASS
3 wire/payload only five skill bodies reach the model request carries sk1..sk5, /sk6 stays prompt text identical PASS (parity)
4 headless -p control five skills stay warning-free no warning no warning PASS
5 ACP (--acp) the notice frame is tagged so channels can carry it 0 session/update frames with _meta.source=slash_command 1 frame, _meta={"turnNotice":true,"source":"slash_command"}, same text PASS
6 channel consumer (AcpBridge.prompt(), the value a channel delivers) the notice rides the turn reply instead of being shadowed "STUB_OK" "Only the first 5 skills were loaded. …\n\nSTUB_OK" PASS
7 regression pin the new channel tests are load-bearing head's two new tests run against merge-base source: 2 failed (expected 'Model text' to be 'Only the first 5 skills were loaded.…') native run at head: 2 passed PASS

Causal evidence (headless, arm by arm, stderr of the real dist/cli.js):

before-six  exit=0  overflow-notice=absent   payload markers=[sk1..sk5]  /sk6 as text=true
after-six   exit=0  overflow-notice=present  payload markers=[sk1..sk5]  /sk6 as text=true
before-five exit=0  overflow-notice=absent
after-five  exit=0  overflow-notice=absent

Channel-consumer evidence (each arm's own built AcpBridge spawning that arm's own dist/cli.js, same prompt, same stub):

before  SESSION=<id>  PROMPT_RETURN="STUB_OK"
after   SESSION=<id>  PROMPT_RETURN="Only the first 5 skills were loaded. Additional /skill tokens were treated as prompt text.\n\nSTUB_OK"

That return value is what a channel adapter sends to the chat, so row 6 is observed at the consumer boundary rather than inferred from the ACP frame.

Controls and boundaries:

  • Five-skill control is warning-free on both arms, so the notice tracks the overflow predicate rather than "any stacked skill".
  • The sixth token staying prompt text is unchanged by this PR on both arms: the diff adds the notice, not different skill loading.
  • The ACP frame change is additive: still exactly one notice frame, still _meta.source=slash_command, now also _meta.turnNotice=true. The headless paths do not consume that meta.
  • Not exercised locally: the DaemonChannelBridge prompt path end-to-end (its new test is covered by the pin, not by a live consumer run), any channel adapter's rendered message (DingTalk/WeCom UI), and TUI / Web Shell surfaces.
  • Scripted provider limitation: this proves what the client receives and what the process writes, not model-quality acceptance.

Relevant gates: local runs only (npx vitest run packages/channels/base/src/{AcpBridge,DaemonChannelBridge}.test.ts -t 'turn notice'). CI on this head was fully green at verification time (Lint & Static, Classify PR, Test, Integration Tests (no-AK, No Sandbox) all success; no landed reds, nothing in flight); no CI was re-run or modified.

Local verdict is not a merge approval.

中文版(可展开)

本地验证:PASS(merge-reference,基线取 merge-base 7c6f93ca,不是 main tip)

本轮针对新 head d8ac0449(比上次报告的 e334e4d1 多一个「让渠道桥接把超限提示带在回复里」的提交)重验,两臂都是全新安装 + 构建,所以下面每一行都是当前 head 的证据。

  • 产物可区分:before dist/cli.js md5 1d60ad408f35,dist 里没有任何文件出现 turnNotice;after md5 273ba057b07e,有两个 chunk 含它。
  • 模型边界:本机回环上的 脚本化 OpenAI 兼容桩(SSE),不是真模型验收。
  • 被测输入:/sk1 … /sk6 do it(叠 6 个 skill,上限 5)与 /sk1 … /sk5 do it(对照)。

关键结论:

  1. headless -p:6 个 skill 时旧 head 无提示;head 在 stderr 打出 Only the first 5 skills were loaded. Additional /skill tokens were treated as prompt text.,两臂退出码都是 0(提示不改退出码)。
  2. payload 一致:两臂只载入 sk1..sk5 五个 skill 正文,/sk6 留在提示文本里。这个 PR 加的是「提示」,不是「多载一个 skill」。
  3. 对照:5 个 skill 时两臂都无提示,说明提示跟的是「超限」判据。
  4. ACP(--acp):head 的那条 notice 帧新增 _meta.turnNotice=true(source 仍是 slash_command),旧 head 同形状会话里 0 条。这是增量字段,不是替换。
  5. 渠道消费面(本轮重点):用各臂自己构建的 AcpBridge 拉起各臂自己的 CLI,同 prompt、同桩。旧 head 的 prompt() 只返回 "STUB_OK";head 返回「提示 + 空行 + STUB_OK」。也就是说提示不再被模型正文挤掉,真能随回复发给用户。
  6. 回归钉双向成立:head 的两个新测试跑在 merge-base 源码上 2 failed(失败点正是 expected 'Model text' to be 'Only the first 5 skills were loaded.…');跑在 head 上 2 passed。

边界:未在本机跑通 DaemonChannelBridge 的端到端消费路径(它的新测试由回归钉覆盖,但不是真实消费运行);未验证任何渠道 UI 的渲染(钉钉/企微消息展示面);未跑 TUI/Web Shell。本地 PASS 不等于合并批准。

@wenshao

wenshao commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Deep verification: PR #16404 — stacked-skill overflow

Verdict: findings — 110/113 scripted assertions passed; 3 failed, all attributed to the PR. Verified head d8ac04497cdc0d65ad3f1e47f746f2f3771d7668, base 7c6f93ca516e5501397b3ccd3c925aa362b0b702.

中文摘要(点击展开)

结论:findings。 中心主张(headless 与 ACP 报告堆叠 skill 溢出)已由真实 CLI bundle 的 A/B 证明:6 个 skill 时 base 无警告、head 有;两臂退出码均为 0;两臂都只加载前 5 个 skill 正文,第 6 个 token 留在 prompt 文本里;5 个 skill 的对照两臂都无警告。ACP 线缆上,head 在模型正文前发出 1 条 _meta.turnNotice=true 的 notice,base 为 0 条。

阻塞项(确认已有评审 R1-1,不是本轮新发现): 通知仍然被 responseBoundary 清掉。tool_call(pending/in_progress)、plan、权限请求都会触发边界,clearChunks 清空 chunks;per_task 模式则直接返回 taskResult / taskOutput.text。本轮实测:文本优先形状返回「通知 + 正文」(PR 自己的测试,通过);通知后先来一个 tool_call 时 prompt() 返回 Model text;per_task 返回 Task done;DaemonChannelBridge 同样返回 Model text。10 个生产渠道包里 7 个没有覆盖 onResponseChunk(默认 no-op),最终送达只走 onResponseComplete 的回复文本,因此这些渠道在这种形状下完全看不到通知。

作者当前 head 的 PASS 不能清除 R1-1: 评论 6667724564 的第 6 行只跑了「模型先返回文本」的形状,没有驱动工具调用;它证明的是文本优先形状,不是 tool_call/per_task 形状。

覆盖缺口(确认 R2-1): 变异矩阵中删除 Session.ts 的通知发射、删除 { turnNotice: true } 元数据、删除 headless stderr 写入,三个 hunk 都存活(对应套件仍全绿)。headless sink 与 ACP sink 都没有提交的测试钉住;PR 自己的新测试只钉住生产端字段和两个桥的文本优先分支。

未覆盖: 真实 qwen serve daemon 端到端、DaemonChannelBridge 的真实 daemon 消费路径、任何渠道 UI 渲染、Web Shell/TUI、真模型、Windows/macOS、全仓测试、逐提交变异枚举,以及 R1-1 建议的独立通知缓冲区修复(本轮未应用/未实测)。

Full verification report (English)

Carried-forward findings at this head

# Finding Severity Status at d8ac0449
R1-1 (round 1, e334e4d) The ACP notice went to the slash-command slot, which channel bridges shadow as soon as model text arrives. Critical Fixed by d8ac0449 for the text-first shape: the notice now carries _meta.turnNotice=true and both bridges route it to textChunk.
R1-1 (round 2, d8ac0449) The turnNotice branch still writes into chunks, which clearChunks empties on every responseBoundary; per_task returns the task result and never reads chunks. Critical Stands — independently reproduced below. The author's current-head PASS exercises only the text-first shape.
R2-1 The producer half of the turnNotice contract has no test; the Session.ts hunk survives mutation. Suggestion Stands — M3 and M6 below both survived; the same is true of the headless stderr sink (M2).

Central claim and A/B

The central claim: a non-interactive run that stacks more than five /skill tokens reports the overflow — headless writes it to stderr, ACP emits a client-visible notice — while exactly five skills load, the sixth token stays prompt text, and the exit code remains 0.

Both arms were built from the same lockfile (the PR changes no package.json or pnpm-lock.yaml) in detached worktrees; readlink -f on every internal @qwen-code/* link resolves into that arm's own packages/ (8/8 assertions), so neither arm can load the other's code. The model boundary is the repository's own scripted OpenAI-compatible server; the skills are six real skills (four repository-level copied into a neutral workspace, two bundled). Raw results: logs/headless-*.json, logs/acp-*.json.

Cell Oracle Base 7c6f93ca Head d8ac0449
headless -p, 6 skills, text exact warning on stderr absent present, exactly once
headless -p, 6 skills, json warning on stderr; stdout remains the JSON payload absent present; stdout parses as JSON
headless -p, 5 skills warning absent absent absent
model payload, 6 skills first five skill bodies present; sixth token remains prompt text 5 loaded, /structured-debugging do it in text identical
process exit code warning does not change it 0 0
ACP --acp, 6 skills session/update agent_message_chunk with _meta.turnNotice=true before the first model text 0 notice frames 1 frame, exact text, frame 1 < first model text frame 2
ACP --acp, 5 skills no notice 0 0

Witnesses: 01-headless-ab.png (six headless cells) and 02-acp-ab.png (three ACP cells). The full CLI bundle in each arm differs in the expected way: grep -rl turnNotice dist finds nothing on base and two chunks on head.

Corrections

  • The author's current-head verification (comment 6667724564) is accurate only for a text-first turn. Its row 6 says “the notice rides the turn reply” and quotes "Only the first 5 skills were loaded. …\n\nSTUB_OK". That is what a model which answers with text immediately produces. It does not exercise a tool call, a plan update, a permission request, or per_task. In those shapes the measured return value is Model text / Task done, not the notice — see F1.
  • The author's row 7 (the two new channel tests are load-bearing) is true but narrower than it reads. M4 and M5 are killed by exactly those two tests, so they do pin the text-first branch. They do not pin the tool-call or per_task shapes, which is why F1 is invisible to them.
  • The author's disclaimer that DaemonChannelBridge was not exercised end-to-end still holds for a live daemon. This round drives its real prompt() path through a fake session (notice → tool_call → text), not a live qwen serve.

Findings

F1 (Critical, confirms R1-1): the turn notice is still dropped whenever the turn crosses a response boundary, and in per_task mode

Measured on head d8ac0449. A tool_call frame with status: 'pending' or 'in_progress' calls emitResponseBoundary, whose clearChunks listener sets chunks.length = 0; the model text that follows refills the array, and prompt() returns chunks.join('') || slashCommandOutput — without the notice. plan updates and permission requests fire the same boundary. outputMode: 'per_task' is a second loss path: AcpBridge.prompt() returns taskResult and never reads chunks; DaemonChannelBridge.prompt() returns taskOutput?.text || chunks.join('') || slashCommandOutput.

Reproducing commands (the artifact's harness/run-channel-probe.sh appends the two .part files to the real test files, runs the selection, then restores both files byte-for-byte):

# tool-call boundary, AcpBridge
cd packages/channels/base
../../node_modules/.bin/vitest run src/AcpBridge.test.ts \
  -t 'probe: turn notice with a tool-call boundary' --coverage.enabled=false
# per_task, AcpBridge
../../node_modules/.bin/vitest run src/AcpBridge.test.ts \
  -t 'probe: turn notice with per_task output mode' --coverage.enabled=false
# tool-call boundary, DaemonChannelBridge
../../node_modules/.bin/vitest run src/DaemonChannelBridge.test.ts \
  -t 'probe: turn notice with a tool-call boundary' --coverage.enabled=false

Observed:

Shape Expected Measured
control: notice → model text (no boundary) Only the first 5 skills were loaded.\n\nModel text same — PASS (this is the PR's own added test)
AcpBridge: notice → tool_call(pending) → model text notice + Model text Model text
AcpBridge: notice → per_task result notice + Task done Task done
DaemonChannelBridge: notice → tool_call(pending) → model text notice + Model text Model text

Witness: 04-channel-boundary.png.

Blast radius: both bridges (AcpBridge.ts:681, DaemonChannelBridge.ts:1225) and every boundary source (tool_call pending/in_progress, plan, permission request). In the 10 production channel packages, only dingtalk, feishu, and qqbot override onResponseChunk; the other seven (telegram, wecom, weixin, email, github, gitlab, dws) inherit the no-op default and deliver only onResponseComplete's response text — for them the notice is completely absent in this shape. Adapters with a streaming hook may still show the notice in the transient segment; the final reply text still loses it.

This is not a new finding: review R1-1 at this head predicted the same mechanism and named the same two loss paths. The round's contribution is an independent reproduction with the two shapes the PR's tests omit, and the fact that the author's current-head PASS covers only the text-first shape. R1-1's suggested independent notice buffer was not applied or measured in this round.

F2 (Suggestion, confirms R2-1): the consumer sinks have no committed test

The mutation matrix below reverts one production hunk at a time in the head tree (byte backup, restore, clean-tree assertion) and runs the selected suite:

Row Hunk Suite Expected Observed
M1 remove the stackedSkillOverflow field from the producer nonInteractiveCliCommands.test.ts killed killed (1 failed / 75 passed)
M2 remove the headless stderr write nonInteractiveCli.test.ts survived survived (272 passed, 1 skipped)
M3 remove the ACP emitSlashCommandOutput block Session.test.ts -t 'slash' survived survived (11 passed, 1400 skipped)
M4 remove the turnNotice branch in AcpBridge AcpBridge.test.ts killed killed (1 failed / 91 passed)
M5 remove the turnNotice branch in DaemonChannelBridge DaemonChannelBridge.test.ts killed killed (1 failed / 130 passed)
M6 drop the { turnNotice: true } metadata Session.test.ts -t 'slash' survived survived (11 passed, 1400 skipped)

Witness: 03-mutation-matrix.png. The census agrees: grep over all test files finds stackedSkillOverflow only in the producer test, and turnNotice only in the two bridge tests; nonInteractiveCli.test.ts and Session.test.ts never mention the overflow. These are coverage gaps, not behavior defects — the A/B and ACP probes above prove the sinks work at head. Suggested fixtures: a nonInteractiveCli.test.ts case that stubs process.stderr.write and asserts the warning; a Session.test.ts case that drives a submit_prompt result carrying stackedSkillOverflow and asserts an agent_message_chunk with _meta.source === 'slash_command' and _meta.turnNotice === true before the turn's own chunks.

Not covered

  • A live qwen serve daemon and its HTTP/SSE path. The ACP probe uses --acp stdio JSON-RPC, which reaches the same Session code.
  • DaemonChannelBridge against a live daemon; its prompt() path is driven through a fake session only.
  • Any channel adapter's rendered message (Telegram/WeCom/Weixin/Feishu/DingTalk cards, email, GitHub/GitLab comments) and any platform-specific streaming UI.
  • Web Shell and TUI rendering of the notice; the Web Shell does not consume turnNotice, so it renders the frame as an ordinary slash-command block.
  • A real model; the model boundary is a scripted OpenAI-compatible stub.
  • per_task on DaemonChannelBridge (the AcpBridge per_task path is measured; the Daemon return expression is the same class, read from code).
  • Windows and macOS. Linux only.
  • The full monorepo test suite; the targeted CLI and channels suites only.
  • A per-commit mutation enumeration. The matrix is per-hunk over the two commits, not one row per commit.
  • R1-1's proposed independent notice buffer fix. It was not applied, so this round does not claim the fix works.

Methodology

Two detached worktrees — base 7c6f93ca and head d8ac0449 — installed offline from the host pnpm store (--frozen-lockfile --offline, reused 1923 packages, downloaded 0) and built with npm run build -- --cli-only && DEV=true npm run bundle (both exit 0). All execution ran in docker run node:22-bookworm --network none --init --user 54754:100 with env -i plus HOME and no credentials; verify-pr-prepare --require-isolation printed /.dockerenv; credential-free per attestation, no known credential signal and exit 0. The headless probe spawns each arm's own dist/cli.js with -p, points it at the repository's fake OpenAI server on loopback, and checks stderr, stdout, exit code, and the request body the model actually received. The ACP probe spawns dist/cli.js --acp --no-chat-recording, sends initialize → authenticate → session/new → session/prompt over stdio, and records every session/update frame. The channel probes append real vitest cases to the real test files, run them, and restore the files byte-for-byte. The mutation runner applies one production hunk at a time from an in-memory byte backup, runs the selected suite, restores, and asserts the tree is clean. Targeted gates: nonInteractiveCliCommands.test.ts + ui/commands/commands.test.ts → 116/116; AcpBridge.test.ts + DaemonChannelBridge.test.ts → 223/223; tsc --build --force packages/channels/base → exit 0. Raw logs are under logs/, harnesses and probe snippets under harness/, captures under evidence/. The head did not move during the round; CI at d8ac0449 is fully green.

Evidence

Headless A/B: base has no warning; head warns once; both exit 0

ACP wire A/B: one turnNotice frame before model text on head, none on base

Mutation matrix: producer and both bridge branches pinned; consumer sinks and meta not

Channel reply loses the notice at a tool-call boundary and in per_task mode

— DeepSeek-V4.1-Flash-1017@fda99a87 via Qwen Code /verify-pr (v0.26.8; skill c5273cc80df5)

The notice was pushed into `chunks`, which `clearChunks` empties on every
`responseBoundary`, and the `per_task` branch never read it at all, so the
stacked-skill warning still disappeared on any turn that made a tool call.

Give the notice its own buffer in both bridges that boundaries never clear,
and compose it into every return path (turn text and `per_task` result). The
slash-command slot keeps its existing precedence and the pinned
response-boundary tests stay unchanged.

Tests: tool-call-boundary and `per_task` arms for both bridges, plus a
Session-side test that the producer tags the overflow notice with
`turnNotice: true`; each new arm reds when the buffer is removed.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Patrol-Run: qwen-pr-closeout/jmw3zvicvfk

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partially reviewed — gaps disclosed. Suggestions are inline.

Not reviewed: build-and-test — Integration Tests (CLI, No Sandbox) was skipped in CI and its suite did not run locally.

Not explored to full depth (tool budget reached): "agent 3b": mutating DaemonChannelBridge.clearChunks and running npx vitest run src/DaemonChannelBridge.test.ts to witness finding 1 empirically (not run — the worktree….

Test Plan (not a blocker): src/nonInteractiveCliCommands.test.ts — no such file or directory; src/ui/commands/commands.test.ts — no such file or directory; Tests 116 passed — this review observed 392, 14566, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 14829 passed; 75 passed — this review observed 392, 14566, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 14829 passed; 7 passed — this review observed 392, 14566, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 14829 passed.

Convergence: round 3 posted 5 inline comment(s), 5 of them reported for the first time; the previous round posted 2 (1 new). Findings keep coming back to the same files: packages/channels/base/src/AcpBridge.ts (findings in round 1; 3 more now). The rate of new findings is not falling. A cluster that keeps producing siblings usually means the fixes are treating instances of a shared root cause — triaging that cause before the next round, or splitting an independent cluster into its own pull request, tends to end the loop faster than fixing them one at a time. Batching the remaining fixes and verifying them before the next push, or dropping this PR's reviews to --severity-floor critical, keeps the loop from re-deriving the same set. No Critical finding is open on this round, so merging and moving the remaining Suggestion threads to a follow-up issue is available as an ending — a merged pull request cannot diverge further. (Observation only — nothing was withheld from this review because of this observation.)

中文说明

仅完成部分审查,审查缺口已披露。 建议见行内评论。

未审查(原文为英文):build-and-test — Integration Tests (CLI, No Sandbox) was skipped in CI and its suite did not run locally.

未探索到全部深度(达到工具调用预算):"agent 3b":mutating DaemonChannelBridge.clearChunks and running npx vitest run src/DaemonChannelBridge.test.ts to witness finding 1 empirically (not run — the worktree…。

Test Plan(非阻断):src/nonInteractiveCliCommands.test.ts — no such file or directory; src/ui/commands/commands.test.ts — no such file or directory; Tests 116 passed — this review observed 392, 14566, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 14829 passed; 75 passed — this review observed 392, 14566, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 14829 passed; 7 passed — this review observed 392, 14566, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 14829 passed。

收敛情况:第 3 轮发布了 5 条行内评论,其中 5 条是首次提出;上一轮发布了 2 条(其中 1 条首次提出)。发现反复回到同一批文件:packages/channels/base/src/AcpBridge.ts(第 1 轮已出过发现,本轮又有 3 条)。新发现的产出速度没有下降。一个不断再生兄弟发现的簇,通常意味着逐条修复只在处理同一根因的实例——先定位并处理该根因,或把独立的簇拆成单独的 PR,通常比逐条修复更快结束循环。把剩余修复攒成一批、验证后再推送,或将本 PR 的评审降到 --severity-floor critical,可以避免循环反复推导同一组发现。本轮没有未决的 Critical,因此"合入后把剩余 Suggestion 线程转到后续 issue"是一个可选的结束方式——已合入的 PR 不会继续发散。(仅为观察——本轮评审未因此扣留任何内容。)

— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.8)

Comment thread packages/channels/base/src/AcpBridge.ts Resolved
Comment thread packages/channels/base/src/AcpBridge.ts Resolved
Comment thread packages/channels/base/src/AcpBridge.ts Resolved
…plies

Address the follow-up review on the turn-notice carry:

- R3-1: the daemon boundary test fired `responseBoundary` before the queued
  notice was consumed, so it cleared nothing; drive the boundary from an
  in-turn `tool_call` instead and assert it goes red when `clearChunks`
  regains `turnNotice = ''`.
- R3-3: the `turnNotice` wire key was a bare literal on every side; export
  `CHANNEL_TURN_NOTICE_META_KEY` beside the sibling keys and use it in the
  producer and both bridges.
- R3-4: a notice-only turn returned `"<notice>\n\n"`; drop the separator when
  the body is empty and cover the exact resolved string.
- R3-5: cover the per-session filter in both bridges so another session's
  notice cannot prefix this turn's reply.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Patrol-Run: qwen-pr-closeout/jmw445tvbfr

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partially reviewed — gaps disclosed. Suggestions are inline.

Not reviewed: build-and-test — Integration Tests (CLI, No Sandbox) was skipped in CI and its suite did not run locally.

Test Plan (not a blocker): src/nonInteractiveCliCommands.test.ts — no such file or directory; src/ui/commands/commands.test.ts — no such file or directory; Tests 116 passed — this review observed 1204, 41546, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 476, 14829 passed; 75 passed — this review observed 1204, 41546, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 476, 14829 passed; 7 passed — this review observed 1204, 41546, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 476, 14829 passed.

Deferred under the convergence posture (round 4, not a blocker) — recorded, not requested in this round:

  • packages/cli/src/acp-integration/session/Session.ts:19929 — [review] the overflow notice is emitted live but never recorded, so a restored transcript loses it

Convergence: round 4 posted 2 inline comment(s), 1 of them reported for the first time; the previous round posted 5 (5 new). Findings keep coming back to the same files: packages/channels/base/src/DaemonChannelBridge.test.ts (findings in round 3; 1 more now). A cluster that keeps producing siblings usually means the fixes are treating instances of a shared root cause — triaging that cause before the next round, or splitting an independent cluster into its own pull request, tends to end the loop faster than fixing them one at a time. (Observation only — nothing was withheld from this review because of this observation.)

中文说明

仅完成部分审查,审查缺口已披露。 建议见行内评论。

未审查(原文为英文):build-and-test — Integration Tests (CLI, No Sandbox) was skipped in CI and its suite did not run locally.

Test Plan(非阻断):src/nonInteractiveCliCommands.test.ts — no such file or directory; src/ui/commands/commands.test.ts — no such file or directory; Tests 116 passed — this review observed 1204, 41546, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 476, 14829 passed; 75 passed — this review observed 1204, 41546, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 476, 14829 passed; 7 passed — this review observed 1204, 41546, 539, 417, 82, 203, 530, 49, 4, 696, 41, 186, 47, 476, 14829 passed。

收敛姿态下延后(第 4 轮,非阻断)——已记录,本轮不要求修改:共 1 条(原文未翻译,列表见上方英文部分)。

收敛情况:第 4 轮发布了 2 条行内评论,其中 1 条是首次提出;上一轮发布了 5 条(其中 5 条首次提出)。发现反复回到同一批文件:packages/channels/base/src/DaemonChannelBridge.test.ts(第 3 轮已出过发现,本轮又有 1 条)。一个不断再生兄弟发现的簇,通常意味着逐条修复只在处理同一根因的实例——先定位并处理该根因,或把独立的簇拆成单独的 PR,通常比逐条修复更快结束循环。(仅为观察——本轮评审未因此扣留任何内容。)

— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.8)

@yiliang114

yiliang114 commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator Author

Local verification: PARTIAL — the overflow notice now reaches both headless stderr and channel replies; the notice-only (empty model reply) case is not reachable through the channel path at either revision, so it rests on the unit test alone.

  • Mode: merge-reference (merge-base 7c6f93ca vs head 706dbab0)
  • Runtime: each arm ran its own built CLI (dist/cli.js + 731 chunks) and its own packages/channels/base/dist; shared OpenAI-compatible stub provider on loopback, so the model boundary is scripted, not a real model.
  • Head 706dbab0 adds real source on top of c5982ce9, not just tests: AcpBridge/DaemonChannelBridge now join the notice only when a body exists, and both read the exported CHANNEL_TURN_NOTICE_META_KEY.
  • Refreshed after the empty-reply probe settled: the earlier wording said that probe "did not settle"; it does settle, and both arms reject the empty stream with the same error. See Are you interested in AI Terminal? #4 and Residuals.
# User-visible contract Before (7c6f93ca) After (706dbab0) Result
1 Six stacked /skill tokens in -p headless: warning on stderr, run still succeeds exit 0, stderr carries only the yolo banner exit 0, stderr carries Only the first 5 skills were loaded. Additional /skill tokens were treated as prompt text. PASS
2 Control: five stacked tokens stay quiet exit 0, no overflow line exit 0, no overflow line PASS
3 Channel delivery (real AcpBridge + real CLI child) returns the notice with the reply prompt() → "STUB_OK" (notice dropped) prompt() → "Only the first 5 skills were loaded. …\n\nSTUB_OK" PASS
4 Notice-only turn (model returns no text): reply should be the notice without a trailing blank paragraph prompt() rejected, rc=1, AcpBridge internal error Model stream ended with empty response text. same rc=1 and the same AcpBridge internal error — no notice delivered NOT VERIFIED (identical rejection at both arms, upstream of the join)

Causal evidence. Item 3 is the channel boundary that matters: the value printed is exactly what a chat adapter delivers, produced by the arm's own AcpBridge spawning the arm's own CLI. The notice arrives as agent_message_chunk carrying _meta.turnNotice, so the bridge routes it to its own buffer instead of the chunk list that a tool boundary clears.

Regression pin. At head, -t 'turn notice' over AcpBridge.test.ts + DaemonChannelBridge.test.ts gives 7 passed / 222 skipped, and the full pair gives 229 passed. Running the same test files against merge-base source gives 5 failed / 2 passed — every failure is the missing notice (expected 'Model text' to be 'Only the first 5 skills were loaded.…'). Pin holds.

Gates. Narrow only: the two touched channel suites plus the headless/ACP probes above. No repo-wide build/lint/typecheck was rerun locally; CI carries those.

Residuals.

  • Item 4 is not observable on the wire at this revision: an empty assistant stream is rejected by the CLI before any reply text is assembled, so both arms end in the same rc=1 + Model stream ended with empty response text. The head-side empty-body join (turnNotice && body ? … : turnNotice || body) therefore has unit-test evidence only; show it on the wire needs a model that emits a notice with an otherwise empty turn, which this probe cannot produce.
  • The tool-call-boundary survival of the notice (a clearChunks between notice and reply) is covered by the pinned daemon test, not by a runtime probe.
  • Local pass says nothing about merge approval; reviewer state and CI remain the merge gate.
中文版(点击展开)

本地验证结论:PARTIAL —— 溢出提示现在同时到达 headless stderr 与渠道回复;「只有 notice、模型无正文」在两条臂上都走不到渠道可见面,因此只有单测支撑。

  • 模式:merge-reference(merge-base 7c6f93ca 对比 head 706dbab0)
  • 运行时:两臂各用自己的构建产物(dist/cli.js + 731 个 chunk、各自的 packages/channels/base/dist),模型侧是 loopback 上的脚本化 stub,不是真模型。
  • 新 head 相对 c5982ce9 是真实源码改动而非只加测试:两个 bridge 改成「有正文才拼接」,并统一读导出的 CHANNEL_TURN_NOTICE_META_KEY。
  • 更正说明:先前版本把空回复探针写成「未落定」,实际它会落定,且两臂用同一个错误拒绝空流。下面第 4 项与缺口段已按实测定稿。
# 用户可见契约 基线(7c6f93ca) 现状(706dbab0) 结论
1 -p 下堆 6 个 /skill:stderr 出提示,运行仍成功 exit 0,stderr 只有 yolo 横幅 exit 0,stderr 出现 Only the first 5 skills were loaded. … PASS
2 对照:5 个 token 不出提示 exit 0,无提示行 exit 0,无提示行 PASS
3 渠道投递(真 AcpBridge + 真 CLI 子进程)把提示随回复带回 prompt() → "STUB_OK"(提示丢失) prompt() → "Only the first 5 skills were loaded. …\n\nSTUB_OK" PASS
4 只有提示、模型无正文时,回复应是提示本身且不带多余空段 prompt() 拒绝,rc=1,AcpBridge 内部错误 Model stream ended with empty response text. 同样是 rc=1 与同一条内部错误,没有交付任何提示 NOT VERIFIED(两臂在同一处、拼接之前就拒绝)

因果证据:第 3 条打在渠道边界上——打印出来的就是聊天适配器真正交付的文本,由该臂自己的 AcpBridge 拉起该臂自己的 CLI 产生。提示以 agent_message_chunk + _meta.turnNotice 到达,因此 bridge 把它放进独立缓冲区,而不是会被工具边界清空的 chunk 列表。

回归钉:head 上 -t 'turn notice' 为 7 passed / 222 skipped,两个套件全跑 229 passed;把同一批测试文件放到 merge-base 源码上跑则 5 failed / 2 passed,失败全是缺提示(expected 'Model text' to be 'Only the first 5 skills were loaded.…')。钉子成立。

门禁范围:只跑了受影响的 channel 两个套件与上面的 headless/ACP 探针,没有本地重跑全仓 build/lint/typecheck,那部分交给 CI。

残留缺口:

  • 第 4 条在这一版上不具备线上可观测性:空流在回复文本组装之前就被 CLI 拒绝,两臂都收在同一个 rc=1 + Model stream ended with empty response text。所以 head 侧那句「有正文才拼接」目前只有单测证据;要在线路上看到它,需要一个能产出「只有 notice、其余为空」的模型回合,这个探针造不出来。
  • 「工具调用边界清 chunk 后提示仍在」只有 daemon 单测覆盖,没有运行时探针。
  • 本地通过不代表合并批准;评审票与 CI 仍是合并门禁。

Superseded for head 129ed6d6: this report is bound to 706dbab0. Verification of the current head is published at #16404 (comment)

…only reply

The daemon twin of the ACP per-session filter could not be reached through a
session_update for another session, so it was unpinned: emit the turn notice
directly and assert it never lands on the pending prompt's reply. The
notice-only arm of the reply composition was likewise unexercised, so assert
the notice comes back without a trailing blank paragraph.

Also merges current main so the lint gate snapshot is fresh.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Patrol-Run: qwen-pr-closeout/jmw4h0sl6g9

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partially reviewed — gaps disclosed.

⚠️ Round 5, and the diff has grown 3.6x since this review first measured it (73 → 264 source diff lines). The findings below are anchored to the current patch, so they can only say where this approach leaks — never that a different approach would retire all of them at once. Before fixing them, a human should decide whether the shape of the change is still right. Advisory only: this does not affect the verdict, and nothing here is a blocker.

Not reviewed: build-and-test — Integration Tests (CLI, No Sandbox) was skipped in CI and its suite did not run locally.

Test Plan (not a blocker): src/nonInteractiveCliCommands.test.ts — no such file or directory; src/ui/commands/commands.test.ts — no such file or directory; Tests 116 passed — this review observed 1209, 41690, 539, 417, 82, 203, 531, 49, 4, 720, 41, 186, 47, 476, 14832 passed; 75 passed — this review observed 1209, 41690, 539, 417, 82, 203, 531, 49, 4, 720, 41, 186, 47, 476, 14832 passed; 7 passed — this review observed 1209, 41690, 539, 417, 82, 203, 531, 49, 4, 720, 41, 186, 47, 476, 14832 passed.

Deferred under the convergence posture (round 5, not a blocker) — recorded, not requested in this round:

  • packages/cli/src/nonInteractiveCli.ts:1346 — [review] the headless overflow notice bypasses this file's output-format split, so stream-json consumers never see it
  • packages/cli/src/nonInteractiveCli.ts:1344 — [review] the headless overflow notice has no test, so both of its claims are unpinned
  • packages/cli/src/acp-integration/session/Session.ts:19940 — [review] the ACP overflow notice is emitted live but never recorded, so a restored transcript loses it
  • packages/cli/src/nonInteractiveCliCommands.ts:633 — [review] the overflow warning is now a third verbatim copy of one user-facing sentence
中文说明

仅完成部分审查,审查缺口已披露。

⚠️ 第 5 轮,且自本审查首次测量以来 diff 已增长 3.6 倍(源码 diff 行数 73 → 264)。下方的发现都锚定在当前这版补丁上,因此它们只能指出这个方案在哪里漏了,而无法说明换一个方案就能一次性消除全部问题。在动手修复之前,应由人来判断这次改动的整体形态是否仍然正确。仅供参考:本段不影响判定结论,其中也没有任何阻断项。

未审查(原文为英文):build-and-test — Integration Tests (CLI, No Sandbox) was skipped in CI and its suite did not run locally.

Test Plan(非阻断):src/nonInteractiveCliCommands.test.ts — no such file or directory; src/ui/commands/commands.test.ts — no such file or directory; Tests 116 passed — this review observed 1209, 41690, 539, 417, 82, 203, 531, 49, 4, 720, 41, 186, 47, 476, 14832 passed; 75 passed — this review observed 1209, 41690, 539, 417, 82, 203, 531, 49, 4, 720, 41, 186, 47, 476, 14832 passed; 7 passed — this review observed 1209, 41690, 539, 417, 82, 203, 531, 49, 4, 720, 41, 186, 47, 476, 14832 passed。

收敛姿态下延后(第 5 轮,非阻断)——已记录,本轮不要求修改:共 4 条(原文未翻译,列表见上方英文部分)。

— deepseek-v4.1-flash-1017@1f214e4e via Qwen Code /review (v0.26.8)

@yiliang114

yiliang114 commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator Author

Delivered 129ed6d: QQ now receives the stacked-skill warning even after streamed output or a previous turn's deferred send. The notice is sent separately after model completion, preserving answer-specific adapter metadata. No QQ buffering changes, dependency, configuration, route, or persisted-format changes.

Feedback Disposition
R1-1: slash output shadowing; tool boundary/per-task loss Rechecked as fixed: independent bridge notice buffers remain intact; both complete suites pass.
R2-1: ACP producer metadata Rechecked as fixed: focused producer test passes.
R3-1, R3-4, R3-5, R4-1: boundary, empty-body and session isolation tests Existing fixes retained and revalidated in the full bridge suites.
R3-2: QQ loses notice after streaming Fixed in this commit; retained tests observe actual adapter send payloads, including deferred prior-turn delivery.
Structured stdout notice, headless sink coverage, transcript replay, wording consolidation Deferred to #16441. The PR description now states stderr and transient-notice semantics explicitly.

Scope: initial review had 3 production files / 26 changed lines and 1 test file / 67 lines. Incoming head had 7 production files / 84 lines and 4 test files / 500 lines. Final PR has 8 production files / 105 lines and 6 test files / 706 lines. The new production file is the shared delivery consumer needed for R3-2; the 206 added test lines protect real adapter delivery, a deferred-send regression, session isolation, completion order and notice-only formatting. Two existing bridge comments were corrected. The original warning contract remains the scope.

Final verification at 129ed6d:

Check Result
ChannelBase + ACP/daemon bridge suites 1,020 passed
QQ notice regression + streaming suite 287 passed
Skill-command/parser suites 116 passed
Focused ACP notice producer 1 passed; 1,413 unrelated tests skipped
Full build, typecheck, bundle Passed; final ordering adjustment also rebuilt/typechecked channel-base and regenerated the bundle
Changed-file ESLint, formatting, commit hooks Passed
Self-audit + independent final review Two clean final self-audit passes; no further actionable finding in the independent final review

Before the repair, buffered and idle-flushed QQ runs sent model text with no notice. The final tests require each model segment and warning exactly once, including an in-flight previous-turn send. Real QQ transport was not configured; bridge input and network sends are scripted around real channel code. Windows was not tested locally. Remote CI/re-review for the pushed SHA remains external verification; no automatic monitor was installed.

已完成本轮实际投递缺陷修复并推送;1,424 项定向测试通过。其余四项非阻断建议集中记录在 #16441,避免继续扩大这个 PR。真实 QQ 网络与新提交 CI 仍需外部验证。

@yiliang114

Copy link
Copy Markdown
Collaborator Author

Local verification report

Verified commit: 129ed6d671e6d778e93ceb91ec4f5706e4ce0dfd on macOS with Node.js 22.22.3. 1,424 targeted tests passed.

Before / after

Scenario Before Final commit
QQ response still buffered when the turn completes Incoming head 5bf0b0e delivered the model response but lost the overflow warning Model response and warning each delivered once
QQ response already sent by idle flush Incoming head delivered the model response but lost the overflow warning Model response and warning each delivered once
Tool boundary during the response Checked by the new QQ regression tests Every response segment and the warning delivered once
Previous turn's send pending, residual text, then a new turn with a tool boundary An unpublished streaming-forwarding candidate duplicated the warning Two actual receive calls complete with each response segment and the warning delivered once
Matching scenarios without overflow Control cases No warning delivered

The fix delivers the channel warning separately after the model response. It keeps the warning out of QQ's streaming buffers and preserves answer-before-notice ordering for adapters such as DingTalk. The base regression also checks session isolation, notice-only delivery without an empty answer message, and listener cleanup.

Test results

Tests Result
Channel base, ACP bridge, daemon bridge 1,020 passed
QQ notice regressions and existing stream tests 287 passed, including 8 new notice scenarios
Non-interactive and UI command handling 116 passed
Focused ACP overflow-notice producer test 1 passed; 1,413 unrelated tests skipped
Total executed 1,424 passed

Root build, typecheck, and bundle passed. After the final delivery-order adjustment, the affected channel-base build/typecheck and root bundle were rerun and passed. Changed-file ESLint, Prettier, and commit hooks also passed.

Commands used for the final committed test runs

Each command ran from the indicated package directory with the standard Vitest configuration and workspace build guards enabled.

# packages/channels/base
npx vitest run src/AcpBridge.test.ts src/DaemonChannelBridge.test.ts src/ChannelBase.test.ts

# packages/channels/qqbot
npx vitest run src/turn-notice.test.ts src/stream.test.ts

# packages/cli
npx vitest run --coverage.enabled=false src/nonInteractiveCliCommands.test.ts src/ui/commands/commands.test.ts
npx vitest run --coverage.enabled=false src/acp-integration/session/Session.test.ts -t 'tags the stacked-skill overflow notice'

Verification limits

The QQ tests run the real ChannelBase and QQChannel code with a scripted bridge and mocked transport/storage, and assert outgoing message payloads. No channel service or live QQ configuration was available locally, so this report does not include a live QQ screenshot or claim live transport verification. Windows and the full monorepo test suite were not run locally. These results are local evidence; CI for the pushed commit remains a separate check.

中文说明

最终提交的定向测试共 1,424 项通过。已覆盖 QQ 缓冲发送、空闲刷新、工具边界,以及上一轮发送未完成时连续接收两轮消息的场景;有溢出时提示只发送一次,无溢出时不发送提示,模型回复各片段也只发送一次。构建、类型检查、打包及相关格式检查通过,最后的发送顺序调整后也重新验证了受影响包。

本轮使用真实适配器代码配合模拟桥接和传输,核对实际传给发送接口的消息内容。由于本机没有运行中的 QQ 渠道服务,因此没有真实 QQ 界面截图;未将这些测试表述为线上端到端验证。

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partially reviewed — gaps disclosed.

Not reviewed: build-and-test — Integration Tests (CLI, No Sandbox) was skipped in CI and its suite did not run locally.

Not explored to full depth (tool budget reached): "agent 6a": verifying that a second sendResponseMessage per turn is safe in the remaining adapter overrides I did not open (email, github, gitlab, dws, feishu, wecom, wei…; "agent 6a": confirming whether the daemon's transcript replay can re-deliver a stale _meta.turnNotice frame into a later prompt's DaemonChannelBridge.handleSessionUpdate….

Deferred under the convergence posture (round 6, not a blocker) — recorded, not requested in this round:

  • packages/channels/base/src/ChannelBase.ts:7647 — [review] a failed advisory-notice send reclassifies an already-delivered turn as failed
  • packages/channels/base/src/ChannelBase.ts:7644 — [review] a <noreply>-suppressed turn still posts the overflow warning
  • packages/channels/base/src/ChannelBase.ts:7644 — [review] on the DingTalk card path the trailing notice consumes the single-use mention target
  • packages/cli/src/nonInteractiveCli.ts:1346 — [review] the headless overflow notice bypasses this file's output-format split, so stream-json consumers never see it
  • packages/cli/src/nonInteractiveCli.ts:1344 — [review] the headless overflow notice has no test, so both of its claims are unpinned
  • packages/cli/src/nonInteractiveCliCommands.ts:635 — [review] the overflow warning is now a third verbatim copy of one user-facing sentence
中文说明

仅完成部分审查,审查缺口已披露。

未审查(原文为英文):build-and-test — Integration Tests (CLI, No Sandbox) was skipped in CI and its suite did not run locally.

未探索到全部深度(达到工具调用预算):"agent 6a":verifying that a second sendResponseMessage per turn is safe in the remaining adapter overrides I did not open (email, github, gitlab, dws, feishu, wecom, wei…;"agent 6a":confirming whether the daemon's transcript replay can re-deliver a stale _meta.turnNotice frame into a later prompt's DaemonChannelBridge.handleSessionUpdate…。

收敛姿态下延后(第 6 轮,非阻断)——已记录,本轮不要求修改:共 6 条(原文未翻译,列表见上方英文部分)。

— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.8)

@yiliang114

Copy link
Copy Markdown
Collaborator Author

Local verification: PARTIAL — on head 129ed6d6 the stacked-skill overflow notice reaches both the headless -p stderr and the channel reply, and the PR's own turn-notice tests fail on merge-base source; the notice-only turn is still rejected upstream of the join, so that branch rests on unit evidence.

  • Mode: merge-reference (merge-base 16794c25 vs head 129ed6d6, each in its own detached worktree)
  • Runtime: each arm ran its own dist/cli.js and its own built packages/channels/base/dist; the model boundary is a scripted OpenAI-compatible stub on loopback, not a real model.
  • Runtime identity: relative to 5bf0b0e5 the new head only touches packages/channels/base plus one qqbot test, so the head arm's channels/base was rebuilt with tsc --build at this SHA, and its CLI dist stays equivalent because git diff 5bf0b0e5 129ed6d6 -- packages/cli is empty.
# User-visible contract Before (16794c25) After (129ed6d6) Result
1 Six stacked /skill tokens under -p: warning on stderr, run still succeeds exit 0, stderr carries only the yolo banner exit 0, stderr line 2 reads Only the first 5 skills were loaded. Additional /skill tokens were treated as prompt text. PASS
2 Control: five stacked tokens stay quiet exit 0, 0 overflow lines exit 0, 0 overflow lines PASS
3 Channel delivery: real AcpBridge + that arm's real CLI child, value returned by prompt() "STUB_OK" (notice dropped) "Only the first 5 skills were loaded. …\n\nSTUB_OK" PASS
4 Notice-only turn (model returns no text): reply should be the notice, without a trailing blank paragraph prompt() rejects: Internal error … Model stream ended with empty response text. identical rejection, no notice delivered NOT VERIFIED
5 Adapter-facing split (new in this head): ChannelBase sends the notice as its own message and strips it from the reply path absent covered by the PR's tests and the pin below; no runtime capture supporting only

Causal evidence. Item 3 is the channel boundary that matters: the printed value is what a chat adapter delivers, produced by the arm's own AcpBridge spawning the arm's own CLI. The notice arrives as agent_message_chunk carrying _meta.turnNotice, so it lands in its own buffer instead of the chunk list a tool boundary clears. Item 5 moves that split one layer down — ChannelBase strips the notice from the response and calls sendResponseMessage separately — and observing it on the wire needs a real chat adapter with credentials, so it stays unit-level here.

Regression pin. -t 'turn notice' over AcpBridge.test.ts, DaemonChannelBridge.test.ts and ChannelBase.test.ts: head gives 10 passed | 1010 skipped (exit 0). The same three files copied onto merge-base source give 6 failed | 4 passed (exit 1), e.g. expected 'Model text' to be 'Only the first 5 skills were loaded.…', including "keeps the turn notice across a response boundary". The pin holds.

Gates. Narrow only: npx tsc --build packages/channels/base plus the filtered vitest subsets above. No repo-wide build/lint/typecheck was rerun locally; CI carries those.

Discarded runs. None — every probe ran once per arm. The empty-reply probe issues 6 stub requests per arm because the CLI retries that turn.

Residuals.

  • Item 4 is not observable at this revision: an empty assistant stream is rejected before any reply text is assembled, so the head-side turnNotice || body join has unit evidence only.
  • Item 5 (separate notice message + strip) has no runtime capture; it needs a real adapter.
  • Local pass says nothing about merge approval; reviewer state and CI remain the merge gate.
中文版(点击展开)

本地验证结论:PARTIAL —— 在 head 129ed6d6 上,堆叠 /skill 的溢出提示已同时到达 headless -p 的 stderr 与渠道回复;PR 自带的 turn-notice 测试在 merge-base 源码上确实失败。但「只有提示、模型无正文」这一支仍在拼接之前就被拒绝,只有单测支撑。

  • 模式:merge-reference(merge-base 16794c25 对比 head 129ed6d6,两臂各自独立 detached worktree)
  • 运行时:两臂各用自己的 dist/cli.js 与各自构建的 packages/channels/base/dist;模型侧是 loopback 上脚本化的 OpenAI 兼容 stub,不是真模型。
  • 运行时身份:相对 5bf0b0e5,新 head 只改 packages/channels/base 加一个 qqbot 测试,因此 head 臂的 channels/base 在该 SHA 上用 tsc --build 重建,CLI 产物因为 git diff 5bf0b0e5 129ed6d6 -- packages/cli 为空而等价。
# 用户可见契约 基线(16794c25) 现状(129ed6d6) 结论
1 -p 下堆 6 个 /skill:stderr 出提示,运行仍成功 exit 0,stderr 只有 yolo 横幅 exit 0,stderr 第 2 行是 Only the first 5 skills were loaded. … PASS
2 对照:5 个 token 不出提示 exit 0,0 条提示行 exit 0,0 条提示行 PASS
3 渠道投递:真 AcpBridge + 该臂真 CLI 子进程,prompt() 的返回值 "STUB_OK"(提示丢失) "Only the first 5 skills were loaded. …\n\nSTUB_OK" PASS
4 只有提示、模型无正文:回复应是提示本身且不带多余空段 prompt() 拒绝:Internal error … Model stream ended with empty response text. 同一条拒绝,没有交付提示 NOT VERIFIED
5 适配器一侧的拆分(本版新增):ChannelBase 把提示单独发一条并从回复里剥掉 该路径不存在 由 PR 自带测试与下面的回归钉覆盖;无运行时抓取 仅作辅助证据

因果证据:第 3 条打在渠道边界上——打印出来的就是聊天适配器会交付的文本,由该臂自己的 AcpBridge 拉起该臂自己的 CLI 产生;提示以 agent_message_chunk + _meta.turnNotice 到达,因此进了独立缓冲区,而不是会被工具边界清空的 chunk 列表。第 5 条把这条拆分下移一层(ChannelBase 从回复里剥掉提示并单独调用 sendResponseMessage),要在线路上看到它需要带凭据的真适配器,所以这里只到单测层。

回归钉:对 AcpBridge.test.ts、DaemonChannelBridge.test.ts、ChannelBase.test.ts 跑 -t 'turn notice',head 为 10 passed | 1010 skipped(exit 0);把同样三个文件放到 merge-base 源码上为 6 failed | 4 passed(exit 1),例如 expected 'Model text' to be 'Only the first 5 skills were loaded.…',其中包含「工具调用清 chunk 后提示仍在」那条。钉子成立。

门禁范围:只跑了 npx tsc --build packages/channels/base 与上面过滤过的 vitest 子集,没有本地重跑全仓 build/lint/typecheck,那部分交给 CI。

丢弃的运行:无——每个探针每臂只跑一次。空回复探针每臂发 6 次 stub 请求,因为 CLI 会重试这一回合。

残留缺口:

  • 第 4 条在这一版仍不可观测:空流在回复文本组装之前就被拒绝,所以 head 侧 turnNotice || body 那句只有单测证据。
  • 第 5 条(提示单独成条 + 从回复剥离)没有运行时抓取,需要真适配器。
  • 本地通过不代表合并批准;评审票与 CI 仍是合并门禁。

@yiliang114

Copy link
Copy Markdown
Collaborator Author

@qwen-code /triage

@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Sandboxed verification: ⚠️ incomplete — infrastructure failure - workflow run

The verification job did not complete (checkout, runner, or setup error) and produced no report. See the workflow run for details.

中文 — 判定:⚠️ 未完成 · 基础设施故障

验证作业未完成(检出、runner 或初始化错误),未生成报告。详见工作流运行日志。

— Qwen Code · sandboxed verification

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, looks ready to ship. ✅

@qqqys qqqys left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — head 129ed6d6

Verdict: APPROVE. The one Critical this PR carried through six rounds is fixed at this head, and I verified the fix in the production code rather than accepting the ledger's empty findings list. CI is complete and green: 30 pass, 36 skipping, 0 fail, 0 pending.

The historical Critical, and why it is now closed

R1-1 was filed in round 1, re-filed in round 2, and independently reproduced with a real A/B harness by @wenshao at d8ac0449: the overflow notice was dropped whenever the turn crossed a response boundary, and in per_task mode; and because 7 of 10 production channel packages do not override onResponseChunk, those channels could never see it at all. Round 6 at this head reports findings: []. Three separate mechanisms were needed, and all three are present:

1. The notice no longer lives in the buffer that boundaries clear. Both bridges keep a dedicated variable and listener, and clearChunks — the responseBoundary handler — empties only chunks:

let turnNotice = '';
const onTurnNotice = (sid, notice) => { if (sid === sessionId) turnNotice = notice; };
const clearChunks = (sid) => { if (sid === sessionId) { chunks.length = 0; … } };
this.on('turnNotice', onTurnNotice);
this.on('responseBoundary', clearChunks);

So a tool_call, plan or permission request crossing the turn cannot discard it. The producer side routes it there deliberately: both bridges test meta?.[CHANNEL_TURN_NOTICE_META_KEY] === true before the source === 'slash_command' branch, emit turnNotice, and break — so the notice cannot also land in textChunk and be double-delivered.

2. per_task mode carries it. This was the second half of the round-2 finding: per_task returned taskResult and never read chunks. Both bridges now compose the notice onto whichever body wins, and the two implementations agree exactly:

// AcpBridge
const body = options?.outputMode === 'per_task' && … ? taskResult : chunks.join('') || slashCommandOutput;
return turnNotice && body ? `${turnNotice}\n\n${body}` : turnNotice || body;

// DaemonChannelBridge
const body = taskOutput?.text || chunks.join('') || slashCommandOutput;
const textResult = turnNotice && body ? `${turnNotice}\n\n${body}` : turnNotice || body;

That agreement matters, because ChannelBase strips the prefix with a hardcoded separator width — response = response.slice(turnNotice.length + 2) — and the + 2 is exactly the \n\n both bridges insert. I checked the degenerate case too: when turnNotice is set and body is empty the bridges return the notice alone with no separator, so the slice runs past the end, yields '', and the following if (!promptState.cancelled && response) correctly skips sending an empty reply while the separate notice send still happens. No truncation and no empty message.

3. Delivery no longer depends on onResponseChunk. The notice is sent from ChannelBase itself via sendResponseMessage, after onResponseComplete has delivered the answer — which is what makes it reach the seven channel packages that never implemented the chunk hook, and what lets adapter-specific reply metadata such as DingTalk's @sender mention be consumed by the answer first. The prefix is stripped from the response before delivery, so the notice is not replayed inside the model text.

The contract is pinned in one place rather than duplicated: CHANNEL_TURN_NOTICE_META_KEY = 'turnNotice' is declared in ChannelAgentBridge.ts with the event's semantics documented ("Also prefixes prompt()'s result, with a blank line before a non-empty body"), re-exported from index.ts, and imported by the producer in Session.ts from @qwen-code/channel-base. Producer and both bridges therefore cannot drift on the key, which was the round-1 failure mode of reusing the slash-command slot.

The round-5 residual (R3-2, QQ dropping the notice once a turn had streamed) is sev:"S" and non-blocking under this review's scope; the new 181-line turn-notice.test.ts in the qqbot package and the 251 lines added to DaemonChannelBridge.test.ts are what the description says cover the buffered, idle-flushed and previous-turn-still-pending shapes.

Producer side and headless path

Session.ts emits the notice on submit_prompt when result.stackedSkillOverflow is set, before the prompt is expanded, and the comment states the contract plainly: overflow is a warning, not a failure, so the turn continues. Nothing here rejects an overflowing prompt or changes the five-skill limit, which matches the stated scope — the first five skills still load, the sixth stays literal prompt text, and the exit code is unaffected. The headless path writes to stderr so that JSON and stream-JSON stdout stay parseable; I read that this is the intent and that nonInteractiveCli.ts and nonInteractiveCliCommands.ts gained 7 and 12 lines for it, but I did not read those two hunks in full, and the fully green lane set including lint, typecheck and the unit shards is my evidence there rather than a line-by-line reading.

CI and scope

30 pass, 36 skipping, 0 fail, 0 pending — every lane that ran is green and nothing is outstanding, which is unusual and worth stating because it means the assertions above have an observed result at this exact head. The prior bot approval at this head is a 28-character stub, so it carries no reasoning; my verdict rests on the code reading above, not on it.

I read every production hunk in AcpBridge.ts, DaemonChannelBridge.ts, ChannelBase.ts, ChannelAgentBridge.ts, index.ts and Session.ts, and traced the notice from producer through both bridges to channel delivery, including the slice arithmetic and its empty-body edge. I ran no test. I did not read the 620 lines of new tests beyond noting what they pin, did not read the headless hunks in full, and did not verify the QQ adapter against a live account — the description is explicit that the bridge and QQ network API were scripted, so this is adapter-level evidence rather than live acceptance.

@doudouOUC doudouOUC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

评审结论:通过(Approve)

评审基线

  • PR:#16404 fix(cli): surface stacked-skill overflow in non-interactive and ACP runs
  • head 129ed6d671e6d778e93ceb91ec4f5706e4ce0dfd,base 16794c25adcf2c6c922df954b6854ed3ceed259f,14 文件 +806/−5(生产 8 文件,测试 6 文件)
  • CI(按 head 汇总):30 pass / 36 skipped / 0 fail;Linux unit 8 分片、Build unit-test tree、Lint & Static、Integration (no-AK)、web-shell E2E 4 分片、TUI parity 均通过
  • 未解决 review thread:0

总体评价

修复链路完整,四个消费面都已对齐:

  • 生产端:packages/cli/src/nonInteractiveCliCommands.ts:630-636 只在 parseStackedSlashCommands 返回 exceededMax 时给出警告;消息里的 5 来自 MAX_STACKED_SKILLS,与解析器实际保留的前 5 个 skill 一致(commands.ts:134-190)。5 个 skill 的对照用例与 6 个 skill 的溢出用例分别钉住不误报/不漏报。
  • headless:packages/cli/src/nonInteractiveCli.ts:1344-1350 将警告写 stderr,不改变 stdout 的 JSON/stream-JSON 协议与退出码。这修正了此前 headless 用户完全无感知的缺口。
  • ACP:packages/cli/src/acp-integration/session/Session.ts:19937-19948 在模型响应前用 _meta.turnNotice=true 发出通知;emitters/MessageEmitter.ts:214-240 先展开 extra 再写 source: 'slash_command',因此通知不会覆盖/被覆盖来源标记。
  • 渠道:AcpBridge.ts:458-530, 694-699 与 DaemonChannelBridge.ts:667-713, 871-873, 1237-1242 为通知单独开缓冲,不受 responseBoundary 清空影响;ChannelBase.ts:7589-7654 先交付正文,再单独发送通知,并在 finally 移除监听。QQ 的 buffered / flushed / boundary / deferred 与普通回合共 8 个参数化用例断言每段文本与通知各出现一次。

历史缺口复核:交互 TUI 早已有该警告(ui/hooks/slashCommandProcessor.ts:1080)、非交互路径此前在 return 点拿得到 exceededMax 却未透传,该 PR 补齐的是一致性,不是新增可配置项或行为拒绝。

建议项(非阻塞)

  1. 通知前缀的剥离依赖长度算术:packages/channels/base/src/ChannelBase.ts:7624-7629 用 response.slice(turnNotice.length + 2) 把 prompt() 返回的前缀剥掉,契约只靠 AcpBridge/DaemonChannelBridge 与 ChannelBase 三方隐式约定。一旦事件与返回值不同步,或返回体不以 notice + "\n\n" 开头,就会截断正文开头 N+2 个字符。建议改为显式判断:if (turnNotice && response.startsWith(${turnNotice}\n\n)) { response = response.slice(...) }。
  2. 通知发送失败会把已成功的回合改判为失败:ChannelBase.ts:7644-7654 的通知发送位于主 try 块内;若 sendResponseMessage 抛错,catch 分支会以 phase: 'delivery' 标记 failed 并向上抛(正文此时已成功交付)。通知是附加诊断,建议单独 try/catch 记录日志,不改变回合终态;至少不要因通知失败向用户再发一条错误提示。
  3. QQ deferred 场景缺少顺序断言:packages/channels/qqbot/src/turn-notice.test.ts 的 deferred 用例只断言各出现一次。QQChannel.onResponseComplete 在 flushingSessions 时是 park 后立即返回(QQChannel.ts:3396-3403),随后 ChannelBase 直接发送通知,理论上通知可能先于被挂起的正文到达。如果「正文之后再发警告」是承诺语义,建议补顺序断言(或在 flush 完成后再发通知);如果允许乱序,请在 PR 描述里注明。
  4. headless 的 stderr 输出没有直接单测:nonInteractiveCli.ts:1344-1350 这 7 行目前只由 producer(nonInteractiveCliCommands.test.ts)与 ACP(Session.test.ts)用例间接覆盖。packages/cli/src/nonInteractiveCli.test.ts 已存在,建议补一条:6 个前置 skill 时 stderr 含警告、stdout JSON 仍可解析、退出码 0;5 个时无警告。

安全审查结论

未发现硬编码密钥/Token、敏感信息、命令注入、SQL 注入、路径穿越或权限/认证变更。通知文本只由常量与 MAX_STACKED_SKILLS 组成,不拼接用户输入;新增 turnNotice 事件不进入模型上下文。上述两条投递健壮性建议属可用性/错误语义层面,非安全漏洞。置信度:基于当前 head 源码与全部新增测试通读,未在本地执行 bundle 级回放(CI 与该 PR 的验证评论提供了运行证据)。

结论

通过。未发现阻塞问题;建议项 1、2 建议在后续小改中处理,3、4 可跟进。

@yiliang114

Copy link
Copy Markdown
Collaborator Author

Held at the merge gate on head 129ed6d6 — not a code objection, and the three approvals on this head stand.

Closeout item (b) is only partly covered. The pr-ui-verify report bound to this head (10:22Z) is PARTIAL:

  • PASS: six stacked /skill tokens under -p (stderr warning, exit 0), the five-token control, and channel delivery through a real AcpBridge + CLI child.
  • NOT VERIFIED — row 4, notice-only turn (model returns no text): prompt() still rejects upstream with Model stream ended with empty response text, so the turnNotice || body join on this head has unit evidence only.
  • supporting only — row 5, the new ChannelBase split (notice as its own message, stripped from the reply): covered by tests, no runtime capture.

The earlier PASS reports in this thread are bound to older heads (e334e4d1, d8ac0449), so they do not cover 129ed6d6. Clearing it needs one of: a runtime capture of the notice-only reply at this head, or an adapter-level capture that shows the split message on the wire.

@yiliang114

Copy link
Copy Markdown
Collaborator Author

Held at the merge gate on head 129ed6d6 — approvals respected, no code objection.

Closeout (b) is unmet. The report bound to this head is PARTIAL: claims 1-3 (headless -p stacked-skill warning, the five-token control, and real AcpBridge channel delivery) are PASS with runtime observations, but claim 4 — the notice-only turn, where the model returns empty text and the reply should be the notice — is NOT VERIFIED. That branch is one of this PR's visible notice paths, so the diff's surface is not fully covered by a PASS at this head.

Clearing it needs either a real pr-ui-verify observation of the notice-only turn (the upstream empty-response rejection currently masks it) or an explicit statement in the PR that this branch is out of scope and tracked separately.

@yiliang114
yiliang114 merged commit 3d9988a into main Nov 7, 2026
173 checks passed
@chiga0

chiga0 commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

审查结论(post-merge,不 approve)

  • 审查端点:head 129ed6d671e6d778e93ceb91ec4f5706e4ce0dfd / base 16794c25adcf2c6c922df954b6854ed3ceed259f
  • 结论:无阻塞性发现(Blocker/Major/Minor 均无)。PR 已 MERGED,本次不 approve。

本次实际检查的内容

  • _meta.turnNotice 的生产端:Session.ts 只发 notice 文本,不混入正文;nonInteractiveCliCommands.ts 的 MAX_STACKED_SKILLS 溢出文案只生成一次。
  • 两个消费端:AcpBridge.ts 与 DaemonChannelBridge.ts 各自维护独立的 turnNotice 缓冲,responseBoundary 只清 chunks,不清 notice;notice-only 回合走 turnNotice || body 组合。已枚举 packages/channels 下的桥实现,仅这两个。
  • ChannelBase.ts:从 response 中剥离 notice 前缀后单独发送一次,正文不会重复携带告警;turnNotice 事件按 sessionId 过滤。
  • _meta 透传链路上没有会丢弃 turnNotice 的白名单清洗。

执行

  • packages/channels/base:1020 tests passed
  • packages/channels/qqbot src/turn-notice.test.ts:8 passed
  • packages/cli src/nonInteractiveCliCommands.test.ts:76 passed
  • 环境:linux, Node v22, 源码 alias 的工作区快照(非已构建 workspace)

未覆盖

  • packages/cli/src/acp-integration/session/Session.test.ts 在该快照中 >500s 未跑完,Session.ts 的 notice 发射仅做了静态检查。
  • 未做真实渠道端到端(DingTalk/QQ 实际推送)。

已有评审的交叉核对

  • 机器人 R1-1 的两条 Critical(notice 走 slash_command 通道被模型正文覆盖;notice 仍进 chunks 被 responseBoundary 清空)在 head 上均不再成立:独立 notice 缓冲与 notice-only 组合分支已在代码和上述测试中覆盖。
  • R3-2(QQ 完成路径丢弃 notice)已由 qqbot/src/turn-notice.test.ts 覆盖。
  • 其余 R3-3/R3-4/R3-5 为建议级,未改代码不构成阻塞。
  • 我未能独立复核“真实渠道账号推送”这一维度,标为未覆盖。

Reviewed with AI assistance.

wenshao added a commit that referenced this pull request Nov 7, 2026
…n-hook

main advanced 11 commits (stacked-skill overflow #16404, workflow agent
approvals #16432, daemon UI tool blocks #16306, sibling model settings
#15829, late snapshot publication claim #16489, inline FQN imports in
runtime modules #16504, cancelled shell as interrupted #15836, CSI statement
helper fold #16503, Maven suite cache write-back #15274, sed char match
#15701, Ink TUI tool-batch round #16428). One conflict, the workflow size
ratchet:

- .size-baseline: sdk-java.yml auto-merged to 167124 bytes (HEAD recorded
  161927 / main 165241, both below the combined actual), so record the actual
  merged size 167124 per the ratchet's "record the real size in the same PR"
  rule. The absolute gate (470000) and the 4096-byte baseline allowance both
  pass.

No source conflict: main's commits did not touch this branch's A3 source
files, so RuntimeBrokerService / RuntimeExecutionRecovery (R18-1/R19-1
observe-only mount-handback guard) and the cli serve fence are unchanged.

Verification: check-workflow-size.sh green (bash5); workflow meta tests
(workflow-size + sdk-java-workflow + hosted-process-ci) 428 green; workspace
build and ClassSizeRatchetTest re-run after the merge.
@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Released in v0.27.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants