Skip to content

Fix gateway passthrough issue - #266

Merged
bettercallsaulj merged 15 commits into
mainfrom
fix_gateway_passthrough
Jul 23, 2026
Merged

Fix gateway passthrough issue#266
bettercallsaulj merged 15 commits into
mainfrom
fix_gateway_passthrough

Conversation

@bettercallsaulj

Copy link
Copy Markdown
Collaborator

No description provided.

RahulHere added 4 commits July 16, 2026 15:01
Summary:
- Capture Mcp-Session-Id from Streamable HTTP requests, including case-insensitive header matches.
- Store the session id on the HTTP/SSE protocol filter for request-session association.
Summary:
- Treat end-of-stream HTTP JSON-RPC bodies as a single JSON document before falling back to newline-delimited parsing.
- Extend reconnect readiness wait for remote HTTPS/SSE backends using the configured request timeout.
- Add low-noise MCP flow logs around HTTP/SSE body forwarding, JSON-RPC parsing, and server dispatch.

@dIvYaNshhh dIvYaNshhh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Went through this one carefully. The end_stream parsing fast-path looks logically sound (I checked the NDJSON fallback — parseMessages appends to partial_message_, so newline splitting still works as the comment claims).

Two things I'd want resolved before this goes in: the captured session id isn't wired to anything, and the new parsing branch has no test coverage. Rest are smaller notes inline.

Comment thread src/filter/http_sse_filter_chain_factory.cc
Comment thread src/filter/http_sse_filter_chain_factory.cc Outdated
Comment thread src/client/mcp_client.cc Outdated
Comment thread src/client/mcp_client.cc Outdated
Comment thread src/filter/json_rpc_protocol_filter.cc
Comment thread src/filter/json_rpc_protocol_filter.cc Outdated
Comment thread src/filter/json_rpc_protocol_filter.cc Outdated
Comment thread CHANGELOG.md
Comment thread CMakeLists.txt
Comment thread src/filter/request_logger_filter.cc
RahulHere added 11 commits July 23, 2026 08:00
Summary:
- Return Mcp-Session-Id from HTTP/SSE dispatch contexts when no SSE callback session is active.
- Add a real-IO server-mode regression test for Streamable HTTP POST /mcp session binding.

Verification:
- cmake --build build --target test_http_sse_filter_server_mode
- ./build/tests/test_http_sse_filter_server_mode --gtest_filter='ServerModeFilterTest.*'
Summary:
- Drop the unreachable case-insensitive Mcp-Session-Id scan because HTTP codec callbacks already receive lowercase header names.
- Remove the now-unused cctype include.

Verification:
- ./build/tests/test_http_sse_filter_server_mode --gtest_filter='ServerModeFilterTest.StreamablePost_AnnouncesMcpSessionIdBinding:ServerModeFilterTest.PlainPost_AnnouncesEmptyBinding'
- git diff --check
Summary:
- Derive reconnect readiness wait from a bounded fraction of request_timeout so polling cannot consume the full request deadline.
- Add deterministic client reconnection tests for default, medium, short, and very small request timeouts.

Verification:
- cmake --build build --target test_client_reconnection_and_logging
- ./build/tests/test_client_reconnection_and_logging --gtest_filter='ClientReconnectionTest.*'
- git diff --check
Summary:
- Rename the runtime-derived reconnect retry count from kMaxReconnectRetries to max_reconnect_retries.
- Update stale test commentary that referenced the old constant-style name.

Verification:
- cmake --build build --target test_client_reconnection_and_logging
- ./build/tests/test_client_reconnection_and_logging --gtest_filter='ClientReconnectionTest.*'
- git diff --check
Summary:
- Add parser coverage for pretty-printed complete HTTP bodies, NDJSON fallback, and malformed end-stream input.
- Exercise the end_stream non-framed branch used by Streamable HTTP request bodies.

Verification:
- cmake --build build --target test_json_rpc_protocol_filter
- ./build/tests/test_json_rpc_protocol_filter --gtest_filter='JsonRpcProtocolFilterTest.EndStreamParsesPrettyPrintedBodyAsOneJson:JsonRpcProtocolFilterTest.EndStreamFallsBackToNdjsonBodies:JsonRpcProtocolFilterTest.EndStreamMalformedBodyReportsParseError'
- git diff --check

Note:
- Full JsonRpcProtocolFilterTest.* run hit existing unrelated bind failure in SendResponseFailsOnClosedConnection.
Summary:
- Add a parsed-message dispatch helper so parseMessage and complete HTTP body parsing share dispatch logic.
- Dispatch end-stream single-document bodies from the parsed JsonValue instead of parsing the same payload twice.
- Preserve JSON parse and internal error mapping for existing parser paths.

Verification:
- cmake --build build --target test_json_rpc_protocol_filter
- ./build/tests/test_json_rpc_protocol_filter --gtest_filter='JsonRpcProtocolFilterTest.ParseRequest:JsonRpcProtocolFilterTest.ParseNotification:JsonRpcProtocolFilterTest.ParseResponse:JsonRpcProtocolFilterTest.ParseErrorResponse:JsonRpcProtocolFilterTest.InvalidJson:JsonRpcProtocolFilterTest.EndStreamParsesPrettyPrintedBodyAsOneJson:JsonRpcProtocolFilterTest.EndStreamFallsBackToNdjsonBodies:JsonRpcProtocolFilterTest.EndStreamMalformedBodyReportsParseError'
- git diff --check
Summary:
- Validate end-stream bodies as NDJSON before falling back from single-document parsing.
- Report one PARSE_ERROR for malformed multi-line bodies instead of parsing each line fragment independently.
- Add regression coverage for malformed pretty-printed JSON bodies.

Verification:
- cmake --build build --target test_json_rpc_protocol_filter
- ./build/tests/test_json_rpc_protocol_filter --gtest_filter='JsonRpcProtocolFilterTest.ParseRequest:JsonRpcProtocolFilterTest.ParseNotification:JsonRpcProtocolFilterTest.ParseResponse:JsonRpcProtocolFilterTest.ParseErrorResponse:JsonRpcProtocolFilterTest.InvalidJson:JsonRpcProtocolFilterTest.EndStreamParsesPrettyPrintedBodyAsOneJson:JsonRpcProtocolFilterTest.EndStreamFallsBackToNdjsonBodies:JsonRpcProtocolFilterTest.EndStreamMalformedBodyReportsParseError:JsonRpcProtocolFilterTest.EndStreamMalformedPrettyBodyReportsOneParseError'
- git diff --check
Summary:

- Align changelog history with published gopher-mcp release notes.

- Keep 0.1.14 focused on Streamable HTTP parsing, session id propagation, and reconnect timeout fixes.

- Remove generated release bookkeeping and duplicated historical entries.
Summary:

- Restore unchanged RequestLogger no-handler log lines to their original layout.

- Keep the passthrough bugfix PR focused on behavior changes.
Summary:

- Invoke the HTTP routing default handler before forwarding unmatched requests to protocol handling.

- Return immediate JSON 404 responses for unknown HTTP/SSE server paths while preserving MCP, SSE, and callback transport pass-through.

- Add routing unit tests and a server-mode integration regression test for unknown discovery paths.

@dIvYaNshhh dIvYaNshhh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@bettercallsaulj
bettercallsaulj merged commit af22cc6 into main Jul 23, 2026
1 check passed
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