[Bug] Responses API provider-executed image_generation is marked failed despite completed result
Nobody has claimed this yet.
- 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_call 和 tool_result,但界面最终仍将工具调用标记为失败,并显示:
Tool call ended without a terminal event.
相同接口的原始 SSE 响应包含完整生命周期:
response.output_item.addedresponse.image_generation_call.in_progressresponse.image_generation_call.generatingresponse.image_generation_call.completedresponse.output_item.doneresponse.completed
通过其他标准 Responses API 客户端检查时,图片可以正常生成和读取,因此实际的图片生成并未失败。问题似乎发生在 ZCode 将 Responses API 的 provider-executed tool result 投影到内部工具生命周期的环节。
复现步骤 · Steps to reproduce
- 在 ZCode 中配置一个支持 OpenAI Responses API 的自定义模型。
- 该模型向客户端暴露 hosted tool:
{"type":"image_generation"} - 新建任务并输入:
请画一只老虎在打太极拳,9:16 竖图。 - 等待模型调用
image_generation。 - 服务端成功返回图片及完整的
image_generation_call.completed、output_item.done和response.completed事件。 - 查看 ZCode 中的工具调用结果。
- 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 的 toolCalls 和 toolResults,两者均带有 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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