fix(responses): preserve streamed output items - #12048
Open
localai-org-maint-bot wants to merge 1 commit into
Open
localai-org-maint-bot wants to merge 1 commit into
localai-org-maint-bot wants to merge 1 commit into
Conversation
Keep each message and reasoning item at its announced output index. Include the answer in completed responses with reasoning or fallback function calls, and retain reasoning supplied through backend deltas. Add regression coverage for stream indices, final output, plain text, and automatic tool parsing. Assisted-by: Codex:GPT-6
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.
Description
Fixes #9658.
Responses streams without explicit tools reused the reasoning item's output index for later answer events. The completed response could then omit the answer. Preserve each item's announced index and include the answer, reasoning, and automatically parsed tool calls in matching order. Create a reasoning item for native backend reasoning deltas as well.
Notes for Reviewers
Five regression cases exercise the real handler and serialized SSE: tagged reasoning, native backend reasoning, plain text, automatic tool parsing, and reasoning with automatic tool parsing. Four cases failed before the fix; all five now pass. The explicit tool-call streaming path is unchanged.
Validation:
go test ./core/http/endpoints/openresponses -count=1passes (60 specs).golangci-lint run --new-from-merge-base=https-origin/master ./core/http/endpoints/openresponses/...reports zero issues.git diff --check HEAD^ HEADpasses.Repository-wide lint could not complete: CGO is unavailable in this environment, so the unrelated
backend/go/supertonicpackage cannot importonnxruntime_go. The linter ran through the available musl loader becausemakeis absent.Signed commits