Skip to content

Conversation

@akitaSummer
Copy link
Contributor

@akitaSummer akitaSummer commented Jan 27, 2026

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change

Summary by CodeRabbit

  • Bug Fixes
    • Removed explicit transfer-encoding headers from Server-Sent Events (SSE) streaming responses to improve protocol compliance and stream reliability.
  • Tests
    • Added runtime checks validating header consistency (content-length vs transfer-encoding) and improved fetch handling for streaming transport tests to catch regressions earlier.

✏️ Tip: You can customize this high-level summary in your review settings.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @akitaSummer, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a potential compatibility issue with HTTP proxies by removing the explicit 'transfer-encoding: chunked' header from Server-Sent Events (SSE) responses. This ensures that SSE connections can reliably pass through various proxy configurations without encountering unexpected behavior or disconnections, thereby improving the robustness of real-time communication.

Highlights

  • HTTP Header Removal: The 'transfer-encoding: chunked' HTTP header has been removed from responses that serve 'text/event-stream' content across multiple files.
  • Proxy Compatibility Fix: This change aims to resolve potential issues with HTTP proxies that might misinterpret or interfere with the 'chunked' transfer encoding header, specifically for Server-Sent Events (SSE), improving reliability.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

Removed explicit transfer-encoding: 'chunked' headers from several SSE/streaming response setups and added a test-side fetch override for StreamableHTTPClientTransport to assert header exclusivity. No functional control flow or exported signatures were changed.

Changes

Cohort / File(s) Summary
MCP controller SSE/stream setup
plugin/controller/lib/impl/mcp/MCPControllerRegister.ts
Removed explicit transfer-encoding: 'chunked' headers where content-type is 'text/event-stream'
Hook SSE response
plugin/controller/test/fixtures/apps/mcp-app/hook-plugin/lib/MCPControllerHook.ts
Removed transfer-encoding: 'chunked' header in GetAlipayTeggHook response setup
MCP proxy test app (fixture)
plugin/mcp-proxy/test/fixtures/apps/mcp-proxy/app/controller/app.ts
Removed transfer-encoding: 'chunked' headers in App.init / App.allStream SSE flows
Stream transport test augmentation
plugin/mcp-proxy/test/proxy.test.ts
Added a fetch override (uses urllib.fetch) for StreamableHTTPClientTransport to validate that content-length and transfer-encoding are not both present

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • killagu
  • fengmk2

Poem

🐰 Soft paws tap on event-streams bright,

Chunked headers hop off into night.
Streams breathe easy, headers now slim,
A rabbit cheers with a little shimmy and grin. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: mcp proxy header' clearly identifies the main change: removing transfer-encoding headers from MCP proxy responses across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an issue with MCP proxy headers by removing the transfer-encoding: 'chunked' header from Server-Sent Event (SSE) responses. This is a correct and important fix, as manually setting this header can cause issues with proxies and is generally redundant. The change is applied consistently across all relevant files. I've included a few suggestions to further improve code quality by extracting duplicated header objects into constants, which will enhance maintainability.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@plugin/mcp-proxy/test/proxy.test.ts`:
- Around line 137-147: The assertion inside the fetch override for
StreamableHTTPClientTransport is too strict—replace the equality check on
res.headers.has('content-length') === !res.headers.has('transfer-encoding') with
a check that only verifies the two headers are not both present (i.e., allow
neither header), so update the assertion in the anonymous fetch override to
assert that !(res.headers.has('content-length') &&
res.headers.has('transfer-encoding')) using the same res.headers calls.

@akitaSummer akitaSummer merged commit d79cf73 into master Jan 27, 2026
12 checks passed
@akitaSummer akitaSummer deleted the fix/mcp_proxy_header branch January 27, 2026 13:44
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.

2 participants