Skip to content

fix(reply): restore configurable block streaming - #95

Merged
NewFuture merged 1 commit into
mainfrom
newfuture-analyze-pr-251
Sep 4, 2026
Merged

NewFuture merged 1 commit into
mainfrom
newfuture-analyze-pr-251

Conversation

@NewFuture

Copy link
Copy Markdown
Owner

变更说明

当前插件声明支持 block streaming,但入站回复链路始终硬编码 disableBlockStreaming: true,导致模型在多步工具调用之间完成的文本块不会发送,只剩最终回复。

本 PR 以最小改动恢复分块回复:

  • 默认按顺序发送已完成文本块和最终回复;
  • 支持频道级 blockStreaming: false 仅发送最终回复;
  • 支持账号级覆盖,并按稳定别名优先、主账号 ID 回退;
  • 保留现有 dispatcher、消息钩子、队列 admission 和最低宿主版本;
  • 更新静态/运行时配置 schema、兼容性 smoke 及中英文文档。

相关背景:Tencent/openclaw-weixin#251openclaw/openclaw#92199

验收标准

  • 默认配置下,中间文本块按顺序发送,随后发送一次最终回复。
  • 频道级关闭后只发送最终回复。
  • 主账号和稳定别名下的账号级配置均能覆盖频道设置。
  • 每次实际发送只执行一次现有 message_sending / message_sent 钩子路径。
  • OpenClaw 最低宿主 2026.6.1、当前版本 2026.8.2 和当前 beta 保持可加载、可构建和可注册。

非目标与替代方案

不迁移公共 channel-turn SDK,不重构消息钩子、配置写入、dispatcher 或 admission 生命周期,不提高最低宿主版本,也不修改发布版本。完整移植 Tencent/openclaw-weixin#251 会扩大兼容性与生命周期变更范围,因此本 PR 只修复当前社区版的可观察故障。

关联任务与风险

未关联社区 issue:这是范围明确、具有直接回归测试的小型 bug 修复。

最高风险是多账号配置使用稳定别名而 monitor 使用主账号 ID;实现采用现有路由语义的别名优先、主 ID 回退,并覆盖两种路径。剩余不确定性是实际微信端的分块展示及 OpenClaw 的短文本合并效果,等待人工整机实测。

风险与不变量

  • 保持 openclaw-weixin 插件和 Channel ID 不变。
  • 不修改账号凭据、context token、轮询游标或其他持久状态。
  • 不改变鉴权、路由、消息 admission、停止/重载或主动发送行为。
  • replyProgressMessages 继续独立控制工具调用进度消息。
  • 分块回复不是逐 token streaming;较短文本仍可能由宿主按现有 Channel 合并策略组合。

自动化测试用例

用例 覆盖边界 预期结果 命令与结果
原始故障 默认入站回复 两个中间块和最终回复依次发送 focused Vitest:通过
反例 频道级 blockStreaming: false 仅发送最终回复 focused Vitest:通过
账号覆盖 账号开启覆盖频道关闭 中间块恢复发送 focused Vitest:通过
别名覆盖 稳定别名关闭、主 ID 回退 别名优先,缺失时回退主 ID focused Vitest:通过
配置边界 默认值、继承、无效类型 顶层默认开启;账号不产生默认覆盖;无效值拒绝 schema tests:通过
钩子边界 多次实际 transport send 每次发送各执行一次现有钩子路径 process-message tests:通过

兼容性验证

  • 最低宿主 OpenClaw 2026.6.1:安装精确版本后 typecheck、build、fresh-process import、配置 schema、插件注册和 Channel 能力 smoke 通过。
  • 当前宿主 OpenClaw 2026.8.2:同上,通过。
  • 当前 beta OpenClaw 2026.9.1-beta.1:typecheck、build、fresh-process import、配置 schema 和插件注册 smoke 通过;Windows 上完整 CLI Channel 能力探测曾超时,等待 PR 的 Ubuntu beta CI 完成该项。
  • Node.js:24.19.0
  • 未改变最低宿主声明 >=2026.6.1

整机实测结果

  • 状态:等待人工实测
  • 测试人员:待指定
  • 操作系统与架构:待补充
  • Node.js:待补充
  • OpenClaw:待补充
  • 插件版本或 commit:a99f2863ca359de8f1f4e671ecaee36c773c8a83
  • 安装方式:待补充
场景 预期结果 实际结果
一次回复包含多次工具调用及中间直接文本 中间文本不丢失、顺序正确,最终回复不重复 等待人工实测
关闭频道级 block streaming 只发送最终回复 等待人工实测
稳定别名配置账号级覆盖 仅目标账号采用覆盖值 等待人工实测

脱敏关键日志

无。

其他验证命令

  • npm run check:通过,46 个测试文件、734 个测试。
  • npm run pack:check:通过,发布包 96 个文件。
  • npm test --prefix docs/site:通过,40 个测试。
  • npm run build --prefix docs/site:通过。
  • git diff --check:通过。
  • 独立代码审查:无剩余高置信度问题。

检查清单

  • 已在本地或 CI 中通过 npm run check
  • 已运行并列出完整的受影响测试矩阵。
  • 行为变更包含原始故障回归测试和能够区分真实修复的反例。
  • 兼容性修复保留了旧版本和当前版本测试,或已说明不适用。
  • 运行时行为改动包含人工整机实测结果;不影响运行时行为的改动已说明不适用。
  • 必要时已更新文档及中英文变更日志。
  • Issue、PR、测试和脱敏日志均未包含凭据、账号标识、二维码或私聊内容等敏感信息。
  • 已关联包含可验证验收标准的 issue,或说明为何不需要。
  • 我已审阅并对全部提交内容负责,包括 AI 辅助生成的内容。

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@NewFuture NewFuture added the risk:privileged Touches authentication, state, workflows, release, security, or package metadata label Sep 3, 2026
@NewFuture
NewFuture requested a balanced review from Copilot September 3, 2026 16:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

User-visible multi-message behavior and the beta CLI smoke still await human end-to-end validation.

Pull request overview

Restores configurable block streaming for inbound replies while preserving existing dispatch and account-routing behavior.

Changes:

  • Enables ordered intermediate blocks by default with channel/account opt-outs.
  • Adds schema, regression, hook, and host-compatibility coverage.
  • Documents behavior in both languages and changelogs.
File summaries
File Description
src/messaging/process-message.ts Applies resolved streaming configuration.
src/messaging/process-message.test.ts Tests delivery order, overrides, and hooks.
src/config/config-schema.ts Adds runtime schema fields.
src/config/config-schema.test.ts Tests defaults and validation.
src/config/block-streaming.ts Resolves account and channel precedence.
src/config/block-streaming.test.ts Tests resolver behavior.
scripts/check-host-compatibility.mjs Extends schema compatibility checks.
README.md Documents Chinese configuration.
README_EN.md Documents English configuration.
openclaw.plugin.json Exposes the static schema option.
CHANGELOG.md Records the Chinese fix.
CHANGELOG_EN.md Records the English fix.
Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Runtime delivery behavior still awaits the required human whole-system validation.

Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@NewFuture
NewFuture merged commit 5258f4a into main Sep 4, 2026
19 checks passed
@NewFuture
NewFuture deleted the newfuture-analyze-pr-251 branch September 4, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:privileged Touches authentication, state, workflows, release, security, or package metadata

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants