Skip to content

fix(relay): dedupe terminal Responses tool replay - #33

Merged
lingozhi merged 4 commits into
mainfrom
codex/luna-responses-tool-dedupe
Aug 1, 2026
Merged

fix(relay): dedupe terminal Responses tool replay#33
lingozhi merged 4 commits into
mainfrom
codex/luna-responses-tool-dedupe

Conversation

@lingozhi

@lingozhi lingozhi commented Aug 1, 2026

Copy link
Copy Markdown
Owner

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

Responses 流在增量阶段已经输出 function call 后,终态 response.completed.response.output 还会携带同一个 call。旧状态机先按 output_index 建键,终态再按 item_id 建第二个键,导致同一 call_id 被转成两次 Claude tool_use。

本改动优先用 output_index、item_id、call_id 的既有映射找回同一工具,仅在全部未命中时新建状态。终态因此只补齐尚未发送的参数后缀,不再重放调用;不同 call_id 的并行工具仍保持独立。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

  • 仓库未启用 Issues;对应生产回归为同一 tool_use_id 被执行两次,第二次拒绝后冲掉首次成功证据。

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。(本仓库 Issues 已禁用)
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

  • RED:同一终态调用测试稳定观察到工具名 2 次、参数重复 2 份。
  • GREEN:go test ./service/relayconvert/... ./relay/channel/openai -count=1
  • 静态检查:go vet ./service/relayconvert/... ./relay/channel/openai
  • 独立审查:无 CRITICAL / HIGH / MEDIUM 问题;不同 call_id、名称与参数均按各自 index 保持隔离。

@lingozhi
lingozhi merged commit 0d54c63 into main Aug 1, 2026
1 check passed
@lingozhi
lingozhi deleted the codex/luna-responses-tool-dedupe branch August 1, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant