Skip to content

Conversation

@ryanfowler
Copy link
Owner

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.

@ryanfowler ryanfowler requested a review from Copilot February 1, 2026 19:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ReadFrame function for incremental gRPC frame reading from io.Reader
  • Implemented FormatGRPCStream to 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.
@ryanfowler ryanfowler force-pushed the grpc-streaming-response branch from f708cfe to 47861ce Compare February 1, 2026 19:12
@ryanfowler ryanfowler merged commit f625eaf into main Feb 1, 2026
10 checks passed
@ryanfowler ryanfowler deleted the grpc-streaming-response branch February 1, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant