Skip to content

fix(runners): reject unfinished turns in streaming runTools - #2716

Merged
HAYDEN-OAI merged 6 commits into
openai:mainfrom
morgan-coded:fix/run-tools-truncation-parity
Sep 16, 2026
Merged

HAYDEN-OAI merged 6 commits into
openai:mainfrom
morgan-coded:fix/run-tools-truncation-parity

Conversation

@morgan-coded

@morgan-coded morgan-coded commented Sep 10, 2026 •

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

Changes being requested

Streaming runTools accepted length and content_filter turns with plain runnable tools, allowing truncated arguments to reach a callback where the non-streaming runner rejects.

A JavaScript private field identifies live tool runs. The existing _runTools hook enables it before execution, so unfinished turns reject at the finish chunk, before history or tool callbacks. No mutable marker module or new subclass member is exposed.

Streaming callers now receive the same rejection as non-streaming callers, while plain chat.completions.stream() and fromReadableStream replay keep their existing behavior.

Additional context & links

Regressions cover both finish reasons across streaming and non-streaming calls, plain streaming, replay, consumer subclasses with their own private properties, and consumer field writes before execution. The _runTools override preserves its inherited signature. Packed-package checks verify that the old shared marker module is neither importable nor emitted. Focused tests pass on Node 22.0.0 and 24.19.0, along with lint, TypeScript, package build, and declaration compatibility checks.

Streaming runTools only failed length and content_filter turns for
auto-parseable input, so plain tools ran on truncated arguments.
@morgan-coded
morgan-coded requested a review from a team as a code owner September 10, 2026 05:52

@HAYDEN-OAI HAYDEN-OAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed with Codex at 784aa641e03294eeaa29716ff26a1e3c91c4817d. The streaming runTools rejection behavior now matches the non-streaming path before tool callbacks or history updates. Traced error propagation and cleanup, and checked ordinary streaming and replay behavior. No actionable findings. LGTM.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-16T17:23:02.853253Z 2b8a361 New commits
🔒 Security Review ✅ Completed 2026-09-16T17:22:27.648282Z 2b8a361 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

45 mixed files remain; 0 existing customizations changed.

Compared 58fa72a5a241 → 2b8a361500ce. Generated baselines verified.

45 existing customizations unchanged
  • api.md
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py
  • src/client.ts
  • src/resources/audio/transcriptions.ts
  • src/resources/audio/translations.ts
  • src/resources/beta/agents/environments/files.ts
  • src/resources/beta/agents/sessions/sessions.ts
  • src/resources/beta/assistants.ts
  • src/resources/beta/beta.ts
  • src/resources/beta/index.ts
  • src/resources/beta/responses/internal-base.ts
  • src/resources/beta/responses/responses.ts
  • src/resources/beta/responses/ws-base.ts
  • src/resources/beta/responses/ws.ts
  • src/resources/beta/threads/index.ts
  • src/resources/beta/threads/runs/index.ts
  • src/resources/beta/threads/runs/runs.ts
  • src/resources/beta/threads/threads.ts
  • src/resources/chat/completions/completions.ts
  • src/resources/chat/completions/index.ts
  • src/resources/conversations/index.ts
  • src/resources/embeddings.ts
  • src/resources/files.ts
  • src/resources/fine-tuning/checkpoints/permissions.ts
  • src/resources/images.ts
  • src/resources/live/forks/ws-base.ts
  • src/resources/live/forks/ws.ts
  • src/resources/live/sideband/ws-base.ts
  • src/resources/live/sideband/ws.ts
  • src/resources/live/ws-base.ts
  • src/resources/live/ws.ts
  • src/resources/responses/internal-base.ts
  • src/resources/responses/responses.ts
  • src/resources/responses/ws-base.ts
  • src/resources/responses/ws.ts
  • src/resources/skills/skills.ts
  • src/resources/skills/versions/versions.ts
  • src/resources/vector-stores/file-batches.ts

5 more in the full report.

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 35127591442 --repo openai/openai-node \
  --name castiron-custom-code-35127591442-1 --dir /tmp/castiron-custom-code-35127591442-1
git apply --stat /tmp/castiron-custom-code-35127591442-1/custom-code.patch
cat /tmp/castiron-custom-code-35127591442-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin 58fa72a5a241521412775e691e6a1331f89ee245 2b8a361500cedb5c137eee80e56118366de4a65b
python3 scripts/castiron/custom_code_report.py report \
  --base 58fa72a5a241521412775e691e6a1331f89ee245 \
  --head 2b8a361500cedb5c137eee80e56118366de4a65b --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-2b8a361500ce
cat /tmp/castiron-custom-code-2b8a361500ce/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ebdb31022f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/ChatCompletionStream.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23b759c4bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b8a361500

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/test-packed-package.ts Resolved
@HAYDEN-OAI
HAYDEN-OAI added this pull request to the merge queue Sep 16, 2026
Merged via the queue into openai:main with commit 937ed67 Sep 16, 2026
24 checks passed
@openai-sdks openai-sdks Bot mentioned this pull request Sep 16, 2026
HAYDEN-OAI pushed a commit that referenced this pull request Sep 16, 2026
Automated Release PR
---


##
[7.17.0](v7.16.0...v7.17.0)
(2026-09-16)


### Features

* **api:** add compaction progress events
([#2749](#2749))
([425502d](425502d))


### Bug Fixes

* **ci:** retry transient Deno download failures
([#2752](#2752))
([e39037b](e39037b))
* preserve chat runner abort reasons
([#2607](#2607))
([eda4d0c](eda4d0c))
* **realtime:** preserve native WebSocket error causes
([#2715](#2715))
([58fa72a](58fa72a))
* **responses:** reject function-based API keys in WebSocket
constructors
([#2586](#2586))
([eea7618](eea7618))
* **runners:** reject unfinished turns in streaming runTools
([#2716](#2716))
([937ed67](937ed67))
* **streaming:** emit terminal SSE events missing a trailing blank line
([#2726](#2726))
([94d6418](94d6418))
* **zod:** omit impossible optional branch in strict schemas
([#2751](#2751))
([2b4c2c7](2b4c2c7))


### Chores

* update lint tooling and tailor anti-slop for the SDK
([#2753](#2753))
([21a03c2](21a03c2))


### Documentation

* **examples:** preserve split UTF-8 in raw stream consumer
([#2714](#2714))
([f44152a](f44152a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: openai-sdks[bot] <284451331+openai-sdks[bot]@users.noreply.github.com>
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