zai-org / zai-org/feedback

[Bug] Responses API provider-executed image_generation is marked failed despite completed result

Open
#314 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2 status: 待评估 type: Bug
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · Pre-submission checklist
  • 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
  • 我已阅读 CONTRIBUTING.md / I've read CONTRIBUTING.md.
问题类别 · Category

工具调用 / MCP · Tool use / MCP

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

严重程度 · Severity

影响体验 · Major (功能可用但体验受损 / works but degraded)

复现频率 · Reproducibility

必现 · Always

问题描述 · Description

使用 OpenAI Responses API 兼容模型调用 image_generation 时,服务端已经成功完成图片生成,并返回完整的 provider-executed tool lifecycle 和图片结果。

ZCode 也已经解析到对应的 tool_calltool_result,但界面最终仍将工具调用标记为失败,并显示:

Tool call ended without a terminal event.

相同接口的原始 SSE 响应包含完整生命周期:

  • response.output_item.added
  • response.image_generation_call.in_progress
  • response.image_generation_call.generating
  • response.image_generation_call.completed
  • response.output_item.done
  • response.completed

通过其他标准 Responses API 客户端检查时,图片可以正常生成和读取,因此实际的图片生成并未失败。问题似乎发生在 ZCode 将 Responses API 的 provider-executed tool result 投影到内部工具生命周期的环节。

复现步骤 · Steps to reproduce
  1. 在 ZCode 中配置一个支持 OpenAI Responses API 的自定义模型。
  2. 该模型向客户端暴露 hosted tool:
    {"type":"image_generation"}
  3. 新建任务并输入:
    请画一只老虎在打太极拳,9:16 竖图。
  4. 等待模型调用 image_generation
  5. 服务端成功返回图片及完整的 image_generation_call.completedoutput_item.doneresponse.completed 事件。
  6. 查看 ZCode 中的工具调用结果。
  7. ZCode 将调用标记为失败,并显示:
    Tool call ended without a terminal event.
期望表现 · Expected behavior

当 Responses API 返回 provider-executed image_generation 的 completed event 和对应 tool result 后,ZCode 应将工具调用标记为成功,并正常显示或提供生成的图片。

ZCode 应保留 providerExecuted: true,并把已解析的 tool_result 转换为内部的终态工具结果事件。

实际表现 · Actual behavior

图片在上游已经生成成功,ZCode 的模型 I/O 日志中也能看到同一 tool call 的 toolCallstoolResults,两者均带有 providerExecuted: true

但界面仍将该工具调用标记为失败,并显示:

Tool call ended without a terminal event.

错误信息:

{
  "error": {
    "code": "fault.runtime.toolLifecycleIncomplete",
    "message": "Tool call ended without a terminal event."
  },
  "status": "failed",
  "toolName": "image_generation"
}

### ZCode 版本 · ZCode version

3.7.7 (Build 3.7.7.4926)

### 设备 / 系统 / 浏览器 · Device / OS / Browser

Mac / macOS / ZCode Desktop 3.7.7

### 截图 / 录屏 / 日志 · Screenshots / Recordings / Logs

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the raw Responses API SSE lifecycle listed in the report, then compare it with the parsed toolCalls and toolResults in the model I/O logs. Trace where provider-executed tool results are projected into the internal tool lifecycle. Done means completed image_generation calls produce a terminal success result, retain providerExecuted: true, and display the generated image.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.