Conversation
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.
OpenAI-compatible streams can return tool calls with
finish_reason: "stop". Previously, the adapter published completed tool calls followed by a normal stop. The streaming agent then recorded those calls without dispatching them or continuing. Malformed or empty arguments could also pass through this path as a successful stop.Validate all accumulated tool arguments before finalizing this response shape. Normalize valid calls to
FinishReasonToolCalls; reject malformed or empty arguments with the existing retryable incomplete-stream error before publishingToolInputEnd,ToolCall, or a successful finish. The existing guards for truncated and abnormal finishes remain in place.The new mock-stream regressions cover valid, malformed, and empty arguments, plus agent-level dispatch and continuation. Applying only these tests to the base commit reproduces the failures; all pass with this change.
Validation:
go test ./... -count=1 -timeout=10mgo build ./...golangci-lint runusing CI's v2.13.2: zero issuesgit diff --checkpassedAdditional check: standalone builds in
examplesandexamples/structured-outputsrequestgo mod tidybefore compilation. Both failures also reproduce on unchangedmain; this patch does not modify their module files.CONTRIBUTING.md.