Repository navigation
fix(chat): separate Responses commentary from final answers - #2445
Merged
Merged
Conversation
Keep provider-labelled progress inside the turn process while streaming and after reopening a session. Preserve the original assistant content and provider replay so context and stored transcripts do not change.
Record block positions before flattening a Responses message so searches and reasoning stay in order as text streams and when a session reopens. Keep the layout separate from model replay. Older transcripts still use known commentary phases without guessing missing positions.
Validate the transcript changes against the current PR base without rewriting the published fix branch.
Owner
|
commentary 混入正文的现象在 main 上成立(
另外 #2454 已合入并修改了 建议拆分:只针对 commentary 分流提交最小修复并关联 issue;持久化或契约层面的改动需维护者先确认方向。 |
Contributor
Author
|
收到,我会把 #2445 收窄为 commentary 分流的最小修复。 |
Keep signed progress available for transcript replay without treating it as an answer in Copy, subagent reports, or one-shot completions. Limit the fix to phase separation rather than storing response order.
Keep the published branch history intact while validating commentary separation against the current runtime and transcript changes.
Contributor
Author
Two consumers still read the stored content, which keeps the signed commentary for replay: the live session result reported to voice callers, and the radial menu's Copy latest answer. Both now take the answer only. The split moves into a shared splitResponsesCommentary helper so the renderer projection and Electron main use one rule instead of two copies of the replay-length walk. refs vastsa#2461
Owner
|
复审完成,方向和运行时部分没问题:子代理、one-shot、流式首块分流和 pi-ai 补丁都已验证,没有新增持久化字段或契约字段。 我直接在分支上补了最后两处泄漏(3cf4c6935):
同时把按 replay 长度切分的逻辑收进 shared 的 还有一点麻烦补进 PR 描述: CI 通过后合入。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2461
Summary / 概要
同一次 Codex / Responses 响应可以先返回
commentary(进度播报),再返回final_answer(最终答案)。修复前,运行时把两者都当作回答文本拼接:用户在正文中看到播报,点击「复制」也会把播报一起带走。子代理返回给父代理的报告和 one-shot 调用同样受影响。本 PR 在运行时区分播报和答案。提供方明确标记为
commentary的文本,从可识别的第一个流式片段起就显示在可折叠的过程区;最终答案仍在正文中流式显示。复制回答、读取子代理报告或获取 one-shot 结果时,只得到答案。整次调用如果只有播报,子代理和 one-shot 不会把它当作成功返回的答案。本 PR 只修复播报分流,不调整思考摘要与原生搜索的排列顺序,也不改变活动组的标题或折叠规则。
Before / After · 实际表现
以 #2461 中的真实 Codex 会话为例:
原始 Codex 会话:脱敏摘录和修复前截图
以下三项来自同一次响应。已省略消息 ID,最终答案仅保留开头。
{ "output": [ { "type": "message", "role": "assistant", "phase": "commentary", "content": [ { "type": "output_text", "text": "我查一下官方文档,确认两种模式各自接管哪些流量,以及什么时候需要开虚拟网卡。" } ] }, { "type": "message", "role": "assistant", "phase": "commentary", "content": [ { "type": "output_text", "text": "系统代理依赖应用主动使用设置。我再核对 TUN 的路由行为,区分「接管流量」和「让流量走代理节点」。" } ] }, { "type": "message", "role": "assistant", "phase": "final_answer", "content": [ { "type": "output_text", "text": "**系统代理靠应用主动走代理;虚拟网卡模式(TUN)靠系统路由把流量交给代理客户端。** 所以 TUN 能覆盖更多应用。" } ] } ] }实现与兼容性
assistantContent()不再把明确标记为commentary的文本拼入答案。子代理报告、one-shot 返回值和回合完成判定共用这一规则,不依赖渲染器事后过滤。没有阶段标记的普通文本仍按原有方式处理,不根据措辞猜测。content保存原文、providerReplay保存块长度和签名。重开旧会话时,只在阶段标记明确且文本长度匹配时分流;信息不足则维持原有显示。不新增UiMessage字段或 Host 持久化字段,也不需要数据库迁移。strict: false的行为。Verification / 验证
以下检查已在提交
7153d88e0上通过:node scripts/e2e-transcript-render.mjs验证了流式播报只出现在过程区;回合完成和重开会话后,实际点击「复制」均只写出最终答案。无阶段标记的历史文本仍完整显示和复制。strict: false保持生效,Host 工具只执行一次。