Add gRPC server-side streaming response support#379
Merged
ryanfowler merged 1 commit intomainfrom Feb 1, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for gRPC server-side streaming responses by switching from buffered single-frame processing to an incremental frame reader. The implementation reads and formats each message as it arrives, following the same streaming pattern as SSE and NDJSON formatters. Additionally, it introduces gRPC trailer status reporting to print non-OK grpc-status trailers to stderr and set the exit code to 1.
Changes:
- Introduced
ReadFramefunction for incremental gRPC frame reading from io.Reader - Implemented
FormatGRPCStreamto handle both unary and server-streaming responses - Added gRPC trailer status checking and error reporting
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/grpc/framing.go | Added ReadFrame function to incrementally read gRPC frames and moved maxMessageSize constant to package level |
| internal/grpc/framing_test.go | Added comprehensive tests for ReadFrame covering single frames, multiple frames, edge cases, and round-trip validation |
| internal/format/grpc.go | New file implementing FormatGRPCStream for streaming gRPC response formatting |
| internal/format/grpc_test.go | New test file with coverage for various streaming scenarios including single/multiple frames and error handling |
| internal/fetch/proto.go | Added checkGRPCStatus function to parse and report gRPC trailer status codes |
| internal/fetch/fetch.go | Refactored to use streaming approach for gRPC responses and check trailer status after body consumption |
| internal/fetch/clipboard.go | Updated to exclude gRPC from clipboard copying alongside other streaming response types |
| integration/integration_test.go | Added integration tests for gRPC streaming responses and error status handling |
| docs/grpc.md | Updated documentation to describe server streaming support, gRPC status reporting, and revised limitations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Switch gRPC response handling from buffered single-frame processing to an incremental frame reader that reads and formats each message as it arrives. This uses the same streaming pattern as SSE and NDJSON formatters, and works for both unary (single frame) and server-streaming (multiple frames) responses. Also adds gRPC trailer status reporting: non-OK grpc-status trailers are now printed to stderr with the appropriate error message, and the exit code is set to 1.
f708cfe to
47861ce
Compare
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.
Switch gRPC response handling from buffered single-frame processing to an incremental frame reader that reads and formats each message as it arrives. This uses the same streaming pattern as SSE and NDJSON formatters, and works for both unary (single frame) and server-streaming (multiple frames) responses.
Also adds gRPC trailer status reporting: non-OK grpc-status trailers are now printed to stderr with the appropriate error message, and the exit code is set to 1.