Skip to content

fix(runTools): sanitize replayed messages#1990

Open
HAYDEN-OAI wants to merge 1 commit into
mainfrom
dev/hayden/issue-1161-sanitize-run-tools-messages
Open

fix(runTools): sanitize replayed messages#1990
HAYDEN-OAI wants to merge 1 commit into
mainfrom
dev/hayden/issue-1161-sanitize-run-tools-messages

Conversation

@HAYDEN-OAI

Copy link
Copy Markdown
Contributor
  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

  • sanitize assistant messages before runTools replays them in follow-up requests
  • preserve enriched runner.messages, events, and parsed completions for callers while removing helper-only parsed and parsed_arguments, null refusal, and other response-only assistant fields from outbound payloads
  • update the streaming and non-streaming runner expectations so the regression stays covered

Additional context & links

Fixes #1161.

runTools currently stores parsed completion messages in its history and then sends that history back unchanged on the next tool-loop request. Azure and other strict-compatible endpoints reject the helper-only fields with errors such as Additional properties are not allowed (parsed, refusal were unexpected).

The fix sanitizes only the outbound copy, so existing parsed runner results remain available to users.

Verification:

  • pnpm test --runInBand tests/lib/ChatCompletionRunFunctions.test.ts
  • pnpm lint
  • pnpm test --runInBand

@HAYDEN-OAI HAYDEN-OAI marked this pull request as ready for review July 13, 2026 19:56
@HAYDEN-OAI HAYDEN-OAI requested a review from a team as a code owner July 13, 2026 19:56
@openai-sdks

openai-sdks Bot commented Jul 13, 2026

Copy link
Copy Markdown

OkTest Summary

Failed for Node SDK PR #1990.

View OkTest run #29280408657

SDK merge (2285fd79ad95) · head (b89ac7051e98) · base (ec2f57fd0d66) · OkTest (cb7f0514ccd2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant