Skip to content

fix(mcp): handle empty 202 notification acknowledgements - #1539

Merged
ilblackdragon merged 3 commits into
nearai:stagingfrom
G7CNF:codex/issue-1436-mcp-202
Mar 22, 2026
Merged

ilblackdragon merged 3 commits into
nearai:stagingfrom
G7CNF:codex/issue-1436-mcp-202

Conversation

@G7CNF

@G7CNF G7CNF commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #1436.\n\nMCP Streamable HTTP notifications may legitimately return 202 Accepted with an empty body. The HTTP transport now treats that as an empty JSON-RPC acknowledgement instead of trying to parse JSON, which unblocks session initialization against servers such as kubernetes-mcp-server.\n\nValidation:\n- cargo test -p ironclaw --lib http_transport::tests::test_accepted_notification_returns_empty_response -- --nocapture\n- cargo clippy -p ironclaw --lib --all-features -- -D warnings

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@github-actions github-actions Bot added size: S 10-49 changed lines risk: medium Business logic, config, or moderate-risk modules scope: tool/mcp MCP client and removed size: S 10-49 changed lines risk: medium Business logic, config, or moderate-risk modules labels Mar 21, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 critical issue where the MCP Streamable HTTP notifications failed to process 202 Accepted responses when the response body was empty. The change ensures that such responses are now correctly treated as successful acknowledgements, thereby resolving a blocker for session initialization with certain MCP servers.

Highlights

  • HTTP Transport Handling: The HTTP transport for MCP notifications was updated to correctly interpret a 202 Accepted HTTP status code with an empty response body as a valid, empty JSON-RPC acknowledgement. Previously, this would cause parsing errors.
  • New Test Case: A new asynchronous test was added to validate the correct handling of 202 Accepted responses, ensuring that session initialization against servers like kubernetes-mcp-server is unblocked.
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.

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. ↩

@github-actions github-actions Bot added the contributor: core 20+ merged PRs label Mar 21, 2026

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

Copy link
Copy Markdown
Contributor

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 fixes an issue where the MCP HTTP transport would fail when a server returns a 202 Accepted response with an empty body, which is a valid acknowledgement for notifications. The change correctly handles this case by creating a default success response. A new test is added to verify this behavior.

My review includes suggestions to improve the new test code by using an existing helper function for creating requests and by consistently using expect() instead of unwrap() for better error reporting, in line with repository guidelines.

Comment thread src/tools/mcp/http_transport.rs Outdated
Comment thread src/tools/mcp/http_transport.rs Outdated
Comment thread src/tools/mcp/http_transport.rs Outdated
@github-actions github-actions Bot added size: S 10-49 changed lines risk: medium Business logic, config, or moderate-risk modules labels Mar 21, 2026
G7CNF and others added 2 commits March 21, 2026 15:52
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@G7CNF
G7CNF force-pushed the codex/issue-1436-mcp-202 branch from 9038672 to 2cc7bd8 Compare March 21, 2026 15:53
@github-actions github-actions Bot added size: M 50-199 changed lines and removed size: S 10-49 changed lines labels Mar 21, 2026
bkutasi pushed a commit to bkutasi/ironclaw that referenced this pull request Mar 28, 2026
* fix(mcp): handle empty 202 notification acknowledgements

* test(mcp): tighten accepted response regression coverage

* Update src/tools/mcp/http_transport.rs

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
drchirag1991 pushed a commit to drchirag1991/ironclaw that referenced this pull request Apr 8, 2026
* fix(mcp): handle empty 202 notification acknowledgements

* test(mcp): tighten accepted response regression coverage

* Update src/tools/mcp/http_transport.rs

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: medium Business logic, config, or moderate-risk modules scope: tool/mcp MCP client size: M 50-199 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP transport fails on 202 Accepted for MCP notifications

2 participants