fix(runners): reject unfinished turns in streaming runTools - #2716
Open
morgan-coded wants to merge 1 commit into
Open
fix(runners): reject unfinished turns in streaming runTools#2716morgan-coded wants to merge 1 commit into
morgan-coded wants to merge 1 commit into
Conversation
Streaming runTools only failed length and content_filter turns for auto-parseable input, so plain tools ran on truncated arguments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes being requested
Streaming
runToolsacceptedlengthandcontent_filterturns 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()andfromReadableStreamreplay 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/libsuite pass with it.