fix: preserve Claude tool block indexes - #5077
Conversation
WalkthroughThe PR fixes an off-by-one index calculation bug in Claude-to-OpenAI streaming response translation. The ChangesClaude tool call indexing fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
issue创建者提交的PR已经合并 #5095 |
Important
📝 变更描述 / Description
Anthropic content block indexes identify which stream block a
tool_useorinput_json_deltabelongs to. The OpenAI-compatible stream response previously subtracted one and clamped to zero, so Claude tool blocks with indexes0and1could both be emitted as OpenAI tool call index0. This keeps Claude's original block index when emitting tool calls and adds a regression test for two sequential tool blocks.🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
Result: