Skip to content

fix(openai-responses): trim tool_call_id and function name so padded call ids stay paired - #14093

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
pacocartones:fix/openai-responses-callid-trim-pairing
Sep 22, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
pacocartones:fix/openai-responses-callid-trim-pairing

Conversation

@pacocartones

Copy link
Copy Markdown
Contributor

Summary

openaiToOpenAIResponsesRequest trimmed the call id on the function_call side (assistant tool_calls -> function_call) but not on the function_call_output side (tool/function role). clampCallId only length-clamps, so a whitespace-padded id a client echoes on both sides was keyed trimmed on one side and untrimmed on the other; the orphaned-output filter then dropped the tool result and the model answered as if the tool never ran. This trims tool_call_id and the deprecated function name so the pairing invariant clampCallId exists to protect holds.

Related Issues

  • Closes #
  • Related to #

(No tracking issue — bounded translator fix; opening directly per the golden path for a small, tested correctness fix.)

Validation

Choose the change type and focused loop from the
Contribution Golden Path. The full unit suite,
Vitest, the 60% coverage gate, and the production build all run in CI on this PR (#8329):

  • Change type: other (translator / request: openai-responses)
  • Focused tests and category gates from the golden path
  • npm run lint
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR

Tests Added Or Updated

  • tests/unit/translator-request-openai-responses.test.ts — adds a case with whitespace-padded matching ids asserting the function_call_output survives the orphan filter and shares the paired function_call id.

Coverage Notes

  • Touches open-sse/; the new case in translator-request-openai-responses.test.ts covers the change (red before, green after).

Reviewer Notes

  • Two-line change (add .trim() at the two output-side call_id sites). No new function, no complexity-ratchet impact.

…call ids stay paired

openaiToOpenAIResponsesRequest trimmed the id on the function_call side (assistant
tool_calls -> function_call) but not on the function_call_output side (tool/function
role). clampCallId only length-clamps, so a whitespace-padded id that a client echoes
on both sides was keyed trimmed on one side and untrimmed on the other; the
orphaned-output filter then dropped the tool result and the model answered as if the
tool never ran. Trim both sides to preserve the pairing invariant clampCallId exists
to protect. Adds a regression test with padded matching ids.
@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks @pacocartones — merging via the release merge-train. Validated in local merge-train (mt-train10c) on the devbox @ train tip 4d841aa1c740bbaa03868dc0a403c62099a99a42 with the 72 sibling PRs of this batch: typecheck:core, file-size, complexity, cognitive-complexity, changelog-integrity green; changed-area node:test 831/831 (0 failing) and vitest 480/482 — the two reds are autoCombo/provider-family-combos.test.ts timing out at 20s, which reproduces on the PURE release tip under the full vitest suite (and is already tracked by the Release-Green issue #13866), so it is inherited, not this batch's. Merged --admin per merge-gates §3/§4/§7.

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.

2 participants