DSH / Atlas
2026-09-18implementedbug-fixarchived 2026-09-30

Replay assistant blocks in Messages user input

回放 Messages 用户输入中的助手块

Saved subagent settlement notices can contain child reasoning and tool calls in parent user messages. Chat Completions and pi-ai omit these blocks from user input, while rejecting them in Messages prevents every later request containing the same history. The [text-only settlement producer](../feature/2026-08-06-manager-owned-subagent-settlement-delivery.md) prevents new notices from carrying these blocks but cannot r

English

Problem

Saved subagent settlement notices can contain child reasoning and tool calls in parent user messages. Chat Completions and pi-ai omit these blocks from user input, while rejecting them in Messages prevents every later request containing the same history. The text-only settlement producer prevents new notices from carrying these blocks but cannot repair already recorded messages.

Decision

The Messages serializer omits reasoning and tool-call blocks from user and tool-result input. This matches Chat Completions and pi-ai for these two block types, without changing Session records or converting child reasoning into parent user text. The provider README owns the input rules, including empty user messages, empty tool results, and rejection of other unsupported blocks.

This partially supersedes the settlement decision's rejection of serializer tolerance and the Messages adapter decision's input rejection. Notice construction still projects nonempty child text for every parent provider. Canonical child output and ordinary assistant reasoning and tool calls remain available to their existing consumers. The omission is based on input role and block type, not the notice source or creation date, so it also applies to newly supplied user and tool-result content.

Alternatives considered

Fix only the producer. New notices are representable, but saved notices still block protocol switching and continuation.

Rewrite Session history or flatten reasoning into user text. Rewriting removes original evidence; flattening sends child reasoning as parent input. Request-only omission preserves the durable record and existing input semantics.

Ignore every unsupported block. Unknown plugin content has no Messages representation defined here. Compatibility for two known assistant block types does not establish one.

Move a system update to an earlier retained user turn. When the corresponding user input is omitted, moving the update before an earlier assistant changes its position in the conversation and rewrites a previously sent prefix. The documented in-history limitation remains explicit rather than inventing a user message or relocating the update.

Consequences

Saved notices with retained text can continue through Messages. The provider no longer diagnoses these two block types as user-input producer errors; the settlement producer remains responsible for text-only notices. This does not promise lossless provider input or compatibility for every historical message sequence.

Verification covers user and tool-result filtering, unchanged durable content, HTTP continuation, and a headless Session replay. Serialization tests pin rejection of an in-history update when its user input is entirely omitted, both before another assistant and at request end, and acceptance when text or a tool result retains the corresponding turn.

中文

问题

已保存的子 Agent 结算通知可能在父级用户消息中包含子级推理和工具调用。Chat Completions 与 pi-ai 会在用户输入中省略这些块,而 Messages 拒绝它们会阻断包含相同历史的所有后续请求。仅生成文本的结算通知生产方可以避免新通知携带这些块,但无法修复已经记录的消息。

决策

Messages 序列化器省略用户与工具结果输入中的 reasoning 和 tool-call 块。这两类块的处理与 Chat Completions、pi-ai 一致,不改变 Session 记录,也不把子级推理转换成父级用户文本。提供方 README统一说明输入规则,包括空用户消息、空工具结果,以及对其他不支持块的拒绝。

这部分取代了结算决策对序列化器容错的拒绝,以及 Messages 适配器决策中的输入拒绝规则。通知构建仍为每种父级提供方投影子级的非空文本。子级的规范输出以及普通助手推理和工具调用仍可供现有消费者使用。省略依据是输入角色和块类型,而不是通知来源或创建日期,因此也适用于新提供的用户和工具结果内容。

考虑过的替代方案

只修复生产方。 新通知可以表示,但已保存的通知仍会阻断协议切换和会话续接。

改写 Session 历史或把推理压平为用户文本。 改写会移除原始证据;压平会把子级推理作为父级输入发送。只在请求中省略可以保留持久化记录和现有输入语义。

忽略所有不支持的块。 此处没有定义未知插件内容的 Messages 表示方式。兼容两种已知助手块类型并不意味着其他类型也有对应表示。

把 system 更新移到更早保留的用户轮次。 对应用户输入被省略时,将更新移到更早的 assistant 之前,会改变它在对话中的位置,并改写已发送的前缀。保留明确记录的历史内更新限制,不编造用户消息或移动更新位置。

后果

保留文本的已保存通知可以通过 Messages 继续会话。提供方不再将这两种块类型诊断为用户输入生产方错误;结算通知生产方仍负责仅生成文本通知。这不保证提供方输入无损,也不保证兼容所有历史消息序列。

验证覆盖用户与工具结果过滤、持久化内容不变、HTTP 续接,以及 headless Session 回放。序列化测试固定了历史内更新在对应用户输入被完全省略时的拒绝行为,覆盖下一个 assistant 之前和请求结束两种位置;文本或工具结果保留对应轮次时则可以通过。