Skip to content

fix(runTools): sanitize replayed messages#1990

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

fix(runTools): sanitize replayed messages#1990
HAYDEN-OAI wants to merge 2 commits 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

237/237 SDK tests passed in 10.238s for Node SDK PR #1990.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 182ms
tests/chat-completions-create.test.ts ✅ Passed 211ms
tests/chat-completions-stream.test.ts ✅ Passed 230ms
tests/files-content-binary.test.ts ✅ Passed 125ms
tests/files-create-multipart.test.ts ✅ Passed 167ms
tests/files-list-pagination.test.ts ✅ Passed 157ms
tests/initialize-config.test.ts ✅ Passed 141ms
tests/instance-isolation.test.ts ✅ Passed 126ms
tests/models-list.test.ts ✅ Passed 127ms
tests/responses-background-lifecycle.test.ts ✅ Passed 217ms
tests/responses-body-method-errors.test.ts ✅ Passed 296ms
tests/responses-cancel-timeout.test.ts ✅ Passed 183ms
tests/responses-cancel.test.ts ✅ Passed 232ms
tests/responses-compact-retries.test.ts ✅ Passed 229ms
tests/responses-compact.test.ts ✅ Passed 210ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 118ms
tests/responses-create-advanced.test.ts ✅ Passed 168ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.106s
tests/responses-create-errors.test.ts ✅ Passed 208ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 139ms
tests/responses-create-retries.test.ts ✅ Passed 244ms
tests/responses-create-stream-failures.test.ts ✅ Passed 198ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 2.171s
tests/responses-create-stream-wire.test.ts ✅ Passed 2.646s
tests/responses-create-stream.test.ts ✅ Passed 85ms
tests/responses-create-terminal-states.test.ts ✅ Passed 223ms
tests/responses-create-timeout.test.ts ✅ Passed 203ms
tests/responses-create.test.ts ✅ Passed 151ms
tests/responses-delete.test.ts ✅ Passed 163ms
tests/responses-input-items-errors.test.ts ✅ Passed 308ms
tests/responses-input-items-list.test.ts ✅ Passed 210ms
tests/responses-input-items-options.test.ts ✅ Passed 140ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 223ms
tests/responses-input-tokens-count.test.ts ✅ Passed 305ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.239s
tests/responses-not-found-errors.test.ts ✅ Passed 240ms
tests/responses-parse.test.ts ✅ Passed 196ms
tests/responses-retrieve-retries.test.ts ✅ Passed 226ms
tests/responses-retrieve.test.ts ✅ Passed 220ms
tests/responses-stored-method-errors.test.ts ✅ Passed 521ms
tests/retry-behavior.test.ts ✅ Passed 2.829s
tests/sdk-error-shape.test.ts ✅ Passed 272ms

View OkTest run #29772240777

SDK merge (1b63f0d72fce) · head (8d65f09240f0) · base (39a15b412fc1) · OkTest (fd7a761c81c1)

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