feat(provider): Responses API driver — streaming text (#540) - #548
Merged
Conversation
Rewrite the resp_api driver's pump from a non-streaming Responses.New call to Responses.NewStreaming, consuming the SSE event union: text deltas emit cumulative StreamTextEvent partials, and the terminal message is built from the authoritative response.completed envelope via mapResponse so the final aggregation matches the non-streamed result by construction. Context cancellation and in-band/transport errors ride the stream as a terminal StreamErrorEvent (dual failure model). Driver tests converted to real text/event-stream stubs.
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.
Summary
resp_apidriverpumpfrom non-streamingResponses.NewtoResponses.NewStreaming, consuming the Responses SSE event union.StreamTextEventpartials (each carries the full accumulated text so the TUI renders a partial directly).response.completedenvelope via the existingmapResponse, guaranteeing streaming/non-streaming parity by construction (US-004).completedbuilds the terminal message from accumulated delta text withend_turn.errorevents, and transport/non-2xx failures ride the stream as a terminalStreamErrorEventwithStopReason=error; only a missing API key is an early returned error.text/event-streamstubs (sseResponse/deltaFrame/completedFrame).Closes #540
Test plan
go build ./...go vet ./internal/provider/go test ./internal/provider/(streaming incremental deltas, final aggregation == completed payload, context-cancel terminal error, in-band error event, upstream 401, missing-key early error)stream:true,instructions,model