Skip to content

[Bug]: AguiMessageConverter 转换 ToolResultBlock 状态为ToolResultState.ERROR 数据缺失 content #3925

Closed

Description

@joman-jiang
if (toolMessage && trb.getState() == ToolResultState.ERROR) {
                    error = toolResultText(trb);
                } else {
                    for (ContentBlock output : trb.getOutput()) {
                        if (output instanceof TextBlock tb) {
                            appendContent(content, tb.getText());
                        }
                    }
                }

Activity

  1. added
    bug
    on Nov 2, 2026
  2. iluv7 commented on Nov 2, 2026

    @iluv7
    Contributor

    看了下最新 main 的代码,确实有问题。ERROR 状态下输出文本只放进了 error,content 会变成空字符串,多个工具结果的转换分支也一样。

    顺着看了下示例用的 CopilotKit 1.69.3 渲染代码,它只拿 toolMessage.content 展示结果,不读 error,而且有工具结果消息就会标成 complete。所以用默认工具渲染器时,会显示绿色的 Done,展开后 Result 是空的,看不到实际的错误信息。

    我会开一个 fix PR。

  3. joman-jiang commented on Nov 2, 2026

    @joman-jiang
    Author

    2. 看了下最新 main 的代码,确实有问题。ERROR 状态下输出文本只放进了 error,content 会变成空字符串,多个工具结果的转换分支也一样。
    顺着看了下示例用的 CopilotKit 1.69.3 渲染代码,它只拿 toolMessage.content 展示结果,不读 error,而且有工具结果消息就会标成 complete。所以用默认工具渲染器时,会显示绿色的 Done,展开后 Result 是空的,看不到实际的错误信息。
    我会开一个 fix PR。

    感觉error字段有些多余了

  4. iluv7 commented on Nov 2, 2026

    @iluv7
    Contributor

    前端用 content 展示,后端用 error 转成内部的结构体,要是把 error 删了状态就是 success 了

  5. added a commit that references this issue on Nov 3, 2026
    3ed55c5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions