Skip to content

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

Open
morgan-coded wants to merge 1 commit into
openai:mainfrom
morgan-coded:fix/run-tools-truncation-parity
Open

fix(runners): reject unfinished turns in streaming runTools#2716
morgan-coded wants to merge 1 commit into
openai:mainfrom
morgan-coded:fix/run-tools-truncation-parity

Conversation

@morgan-coded

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.

I used a protected flag on the stream to reject at the finish chunk, before history or tool execution; let me know if you prefer a shared post-check in _runTools, which would run after the completion enters history.

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

I added regressions for both finish reasons across streaming and non-streaming calls; the streaming cases fail before the fix, and the regressions and full tests/lib suite pass with it.

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
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.

1 participant