Skip to content

fix(gateway): tolerate malformed SSE chunks and fix Anthropic tool bl…#16

Open
ccbq2010 wants to merge 1 commit into
PeakCode-AI:mainfrom
ccbq2010:fix/gateway-sse-tool-index
Open

fix(gateway): tolerate malformed SSE chunks and fix Anthropic tool bl…#16
ccbq2010 wants to merge 1 commit into
PeakCode-AI:mainfrom
ccbq2010:fix/gateway-sse-tool-index

Conversation

@ccbq2010

Copy link
Copy Markdown
Contributor

…ock indices

  • gateway.ts: wrap SSE JSON.parse in try/catch so a single malformed chunk from the upstream no longer aborts the entire stream (matches mimoAdapter and anthropicAdapter behavior).
  • anthropicAdapter.ts: assign sequential content_block indices when emitting multiple tool_use blocks in the streaming response. Previously every tool call reused the same index because nextBlockIndex was never incremented, which caused the Claude SDK to drop all but the first tool call.

What Changed

Why

UI Changes

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

…ock indices

- gateway.ts: wrap SSE JSON.parse in try/catch so a single malformed chunk
  from the upstream no longer aborts the entire stream (matches mimoAdapter
  and anthropicAdapter behavior).
- anthropicAdapter.ts: assign sequential content_block indices when emitting
  multiple tool_use blocks in the streaming response. Previously every tool
  call reused the same index because nextBlockIndex was never incremented,
  which caused the Claude SDK to drop all but the first tool call.
@github-actions github-actions Bot added size:S vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant