[PR #4011] [MERGED] Fix empty tool-call parameters with GPT-5.6 on the Responses API #6200

Closed
opened 2026-10-23 04:08:05 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4011
Author: @SpicyMarinara
Created: 7/23/2026
Status: ✅ Merged
Merged: 7/23/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/4010-gpt56-websearch-tools


📝 Commits (2)

  • 44bb617 Accumulate Responses-API tool-call arguments by item id
  • d4c8fa7 Merge branch 'staging' into fix/4010-gpt56-websearch-tools

📊 Changes

3 files changed (+87 additions, -14 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/services/llm/providers/openai.provider.ts (+18 -14)
📝 scripts/regressions/provider-compat.regression.ts (+68 -0)

📄 Description

Linked issue

Fixes #4010

Why this change

Web Search (and any tool) fails with GPT-5.6 (Sol) in Roleplay mode: the model reports the tool-call JSON parameters are empty/blank/malformed, then loops indefinitely without answering. Reproduced by reasoning through the Responses-API streaming path.

Root cause: GPT-5.6/5.5/5.4 and Codex models use the OpenAI Responses API, which streams function-call arguments in response.function_call_arguments.delta / .done events that reference the output item by item_id (the fc_… item id) — not call_id. The streaming parser accumulated arguments in a map keyed by call_id (the call_… id) and read parsed.call_id from the delta events, a field those events don't carry. So the if (callId && delta) guard was always false, arguments never accumulated, and the tool call surfaced with empty arguments. This affected both OpenAI and OpenRouter because gpt-5.6 routes through the Responses API by model name (streaming only — Roleplay streams).

What changed

  • Key the argument accumulator by the output item id (item.id), and read the delta/done events by item_id (with call_id as a fallback for robustness).
  • Preserve call_id as the surfaced tool-call id, so the follow-up function_call_output still references the call correctly.
  • Regression: provider-compat now streams a Responses-API function call (output_item.added → two function_call_arguments.delta → .done → output_item.done) and asserts the query is reassembled ({"query":"latest marinara news"}) and the call_id is preserved. Pre-fix this asserts empty arguments and fails.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated: pnpm check and pnpm regression:providers (with the new Responses-API function-call test) pass.

Manual verification notes

  • Manually run Web Search in Roleplay with GPT-5.6 on a real OpenAI key and confirm the query fires and the model answers.
  • Manually repeat via OpenRouter with a gpt-5.6 route.
  • Manually confirm non-Responses models (e.g. GPT-4o, Claude) still call tools correctly (Chat Completions path unchanged).

Docs and release impact

  • Updated CHANGELOG.md
  • Version/release files updated (only if this PR includes a version bump)

UI evidence

No UI changes — tool-call streaming fix.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4011 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/23/2026 **Status:** ✅ Merged **Merged:** 7/23/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/4010-gpt56-websearch-tools` --- ### 📝 Commits (2) - [`44bb617`](https://github.com/Pasta-Devs/Marinara-Engine/commit/44bb617e0120e58d56a393f08f62c8dda14f3d01) Accumulate Responses-API tool-call arguments by item id - [`d4c8fa7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d4c8fa7dc7e559e9e6a25421f9d876e0f5cee6d2) Merge branch 'staging' into fix/4010-gpt56-websearch-tools ### 📊 Changes **3 files changed** (+87 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/services/llm/providers/openai.provider.ts` (+18 -14) 📝 `scripts/regressions/provider-compat.regression.ts` (+68 -0) </details> ### 📄 Description ## Linked issue Fixes #4010 ## Why this change Web Search (and any tool) fails with GPT-5.6 (Sol) in Roleplay mode: the model reports the tool-call JSON parameters are empty/blank/malformed, then loops indefinitely without answering. Reproduced by reasoning through the Responses-API streaming path. **Root cause:** GPT-5.6/5.5/5.4 and Codex models use the OpenAI **Responses API**, which streams function-call arguments in `response.function_call_arguments.delta` / `.done` events that reference the output item by **`item_id`** (the `fc_…` item id) — not `call_id`. The streaming parser accumulated arguments in a map keyed by `call_id` (the `call_…` id) and read `parsed.call_id` from the delta events, a field those events don't carry. So the `if (callId && delta)` guard was always false, arguments never accumulated, and the tool call surfaced with empty arguments. This affected both OpenAI and OpenRouter because gpt-5.6 routes through the Responses API by model name (streaming only — Roleplay streams). ## What changed - Key the argument accumulator by the **output item id** (`item.id`), and read the `delta`/`done` events by `item_id` (with `call_id` as a fallback for robustness). - Preserve `call_id` as the surfaced tool-call `id`, so the follow-up `function_call_output` still references the call correctly. - Regression: `provider-compat` now streams a Responses-API function call (`output_item.added` → two `function_call_arguments.delta` → `.done` → `output_item.done`) and asserts the query is reassembled (`{"query":"latest marinara news"}`) and the `call_id` is preserved. Pre-fix this asserts empty arguments and fails. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Automated: `pnpm check` and `pnpm regression:providers` (with the new Responses-API function-call test) pass. ### Manual verification notes - Manually run Web Search in Roleplay with GPT-5.6 on a real OpenAI key and confirm the query fires and the model answers. - Manually repeat via OpenRouter with a gpt-5.6 route. - Manually confirm non-Responses models (e.g. GPT-4o, Claude) still call tools correctly (Chat Completions path unchanged). ## Docs and release impact - [x] Updated CHANGELOG.md - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence No UI changes — tool-call streaming fix. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:08:05 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6200
No description provided.