Skip to content

[Bug] Agent 工具返回业务失败对象时仍被传输和持久化为 success #114

Description

@ShallM

版本

main 源码,commit 320c07f

平台 / 功能

macOS Apple Silicon;AI Agent 对话剪辑 / Server Run。代码路径跨平台。

严重性

高:会让 Agent 在明知工具失败的情况下继续工作并最终声称完成,直接破坏工程质量和审计可信度。

问题描述

OpenChatCut 工具有两种失败方式:抛异常,以及正常返回 { error }{ ok:false }{ aborted:true }。后者在浏览器桥、server store 和 runtime ledger 中会被当作成功结果:tool result HTTP 通道不带 error、运行记录写 success,completion gate 也看不到未解决失败。

复现步骤

  1. edit_item 返回原子校验失败,例如非法 easing。
  2. 或让 analyze_music 返回 { error: "clip is not linked..." }
  3. 检查 browser tool result、server run event、agent runtime ledger 和最终状态。
  4. 观察模型仍可能继续后续步骤并输出“完成”。

期望行为

所有业务失败形态在每一层都保持失败语义;没有成功重试前,run 不得以 completed 结束,也不得记录成功 outcome。

实际行为

只要没有 throw,失败对象就走 success 通道;模型和运行记录均可能把失败当成成功。

根因定位

浏览器执行器、server settlement、Codex bridge、runtime projection 和 completion gate 各自只检查异常或 transport error,没有共享业务失败判定。

建议修复

  • 提供共享 isFailedToolResult/toolFailureReason,识别 {error}{ok:false}{aborted:true} 等。
  • 浏览器桥以 error 通道提交业务失败。
  • store settlement 拒绝失败形状,并将 ledger 写为 terminal_failure
  • Codex settleToolResult.success=false
  • run 内追踪未解决失败;只有同工具后续成功才能清除。
  • completion gate 在仍有失败时将 run 标记 failed,并原样报告工具名和原因。

本地验证

覆盖 browser bridge、store、Codex turn、runtime ledger 和 completion gate 的回归测试均通过;失败操作不会再被记录为成功。

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions