9router/open-sse/translator/response
Liam 01e4a28f0a
fix: normalize finish_reason to 'tool_calls' when tool calls are present (#379)
Some upstream providers (e.g. Antigravity) return non-standard finish_reason
values like 'other' instead of the OpenAI-standard 'tool_calls' when the
model invokes tools. This causes downstream consumers (e.g. OpenClaw) to
fail to execute tool calls, breaking agentic sub-agent workflows.

Changes:
- nonStreamingHandler: post-translation guard that normalizes finish_reason
  to 'tool_calls' when message.tool_calls is present
- sseToJsonHandler: accumulate tool_calls from streaming deltas in
  parseSSEToOpenAIResponse; extract function_call items from Responses API
  output in handleForcedSSEToJson
- openai-responses translator: use toolCallIndex to choose between
  'tool_calls' and 'stop' in flush and response.completed events

Tested: 7 scenarios (non-stream text, single/multiple tool calls, stream
text/tool calls, multi-turn tool conversation, tools present but unused)
2026-03-23 09:35:25 +07:00
..
claude-to-openai.js refactor(claude-to-openai): simplify usage token calculation and final chunk assembly 2026-03-09 17:18:49 +07:00
cursor-to-openai.js feat(cursor): Add cursor Provider 2026-02-05 11:06:20 +07:00
gemini-to-openai.js feat: Enhance usage tracking across response handlers 2026-02-03 00:29:22 +07:00
kiro-to-openai.js feat: Update response handling and logging for improved usage tracking 2026-02-03 10:22:43 +07:00
ollama-to-openai.js feat(ollama): Enhance Ollama support by adding new models, updating API format handling, and integrating translation functionality. 2026-03-12 15:24:10 +07:00
openai-responses.js fix: normalize finish_reason to 'tool_calls' when tool calls are present (#379) 2026-03-23 09:35:25 +07:00
openai-to-antigravity.js feat(antigravity): integrate Antigravity tool with MITM support and update CLI tools 2026-02-08 16:28:13 +07:00
openai-to-claude.js feat: Update response handling and logging for improved usage tracking 2026-02-03 10:22:43 +07:00