Skip to content

fix(proxy): include input in streamed tool starts#2557

Open
topjohncian wants to merge 4 commits intofarion1231:mainfrom
topjohncian:claude-fix
Open

fix(proxy): include input in streamed tool starts#2557
topjohncian wants to merge 4 commits intofarion1231:mainfrom
topjohncian:claude-fix

Conversation

@topjohncian
Copy link
Copy Markdown

Summary

  • Add empty input: {} objects to streamed Anthropic tool_use content_block_start events
  • Cover OpenAI-compatible streaming, Responses streaming, and Gemini streaming conversion paths
  • Prevent clients from receiving malformed streaming tool blocks before argument deltas arrive

Closes #2556

Test plan

  • GitHub Actions

🤖 Generated with Claude Code

topjohncian and others added 4 commits May 4, 2026 02:10
Ensure streamed Anthropic tool_use blocks are object-shaped from content_block_start so clients can render tools before argument deltas arrive.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Lock regression coverage for streamed tool_use starts so clients always receive an object-shaped input before argument deltas arrive.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Match rustfmt output for Responses regression tests and parse Gemini SSE events before checking the streamed tool input shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Match rustfmt wrapping for the Gemini streamed tool input regression assertion.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@farion1231
Copy link
Copy Markdown
Owner

@codex review
@claude review

@claude
Copy link
Copy Markdown

claude Bot commented May 4, 2026

Claude finished @farion1231's task in 1m 1s —— View job


Claude PR Review


LGTM.

The fix is correctly scoped and complete. Anthropic's streaming spec requires tool_use content_block_start events to carry an input field (the actual JSON arrives later via input_json_delta events). Without it, strict clients can choke on the initial block.

I verified all four content_block_start sites that emit "type": "tool_use" are updated:

  • streaming.rs:448 — OpenAI tool_calls path
  • streaming.rs:557 — OpenAI function_call fallback path
  • streaming_gemini.rs:528 — Gemini functionCall path
  • streaming_responses.rs:423 — Responses API output_item.added (normal path)
  • streaming_responses.rs:465 — Responses API function_call_arguments.delta (fallback path)

Other content_block_start emissions in these files are for text / thinking blocks, which don't take input, so the surface is fully covered.

Test coverage looks good:

  • Existing OpenAI tests tightened to assert input == {} on tool starts.
  • The Gemini test was rewritten to parse SSE and assert structurally rather than via output.contains(...) — a strict improvement.
  • New streaming_responses tests cover both the normal and fallback paths independently.

No blocking issues found. Leaving the merge call to the maintainer.
• Branch: claude-fix

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

Claude Code crashes on Windows when OpenAI Responses streaming tool_use starts without input

2 participants