Skip to content

fix(mcp): attach session manager for non-OAuth HTTP clients (#793)#986

Merged
zmanian merged 2 commits intonearai:stagingfrom
zmanian:fix/pr793-session-manager-rebased
Mar 12, 2026
Merged

fix(mcp): attach session manager for non-OAuth HTTP clients (#793)#986
zmanian merged 2 commits intonearai:stagingfrom
zmanian:fix/pr793-session-manager-rebased

Conversation

@zmanian
Copy link
Copy Markdown
Collaborator

@zmanian zmanian commented Mar 12, 2026

Summary

  • rebase the approved #793 MCP session-manager fix onto current staging
  • attach the MCP session manager for non-OAuth HTTP clients in the centralized factory path
  • add focused regression coverage for the rebased code path

Why this replacement exists

Original PR #793 is approved but dirty after subsequent MCP refactors landed on staging. In current staging, the CLI path already routes through create_client_from_config, so this replacement preserves the original intent in the remaining live code path.

Supersedes approved PR #793.

Validation

  • cargo test session_manager -- --nocapture
  • targeted regression passed:
    • tools::mcp::client::tests::test_with_session_manager
    • tools::mcp::factory::tests::test_factory_non_oauth_http_has_session_manager

@github-actions github-actions Bot added scope: tool/mcp MCP client size: M 50-199 changed lines risk: medium Business logic, config, or moderate-risk modules labels Mar 12, 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 re-implements an approved fix to ensure that non-OAuth HTTP clients are properly configured with a session manager. The original PR became outdated due to recent refactoring, so this update integrates the necessary logic into the current codebase and includes dedicated tests to prevent future regressions, thereby maintaining consistent session tracking across client types.

Highlights

  • Rebased Approved Fix: The previously approved fix from PR fix(mcp): set session manager on non-OAuth HTTP MCP clients #793, which had become dirty due to subsequent MCP refactors, has been rebased onto the current staging branch.
  • Session Manager Attachment: The MCP session manager is now correctly attached to non-OAuth HTTP clients within the centralized client factory path, ensuring proper session tracking.
  • Regression Coverage: New focused regression tests have been added to validate the rebased code path and confirm that non-OAuth HTTP clients correctly receive a session manager.
Changelog
  • src/tools/mcp/client.rs
    • Added with_session_manager method to McpClient for attaching a session manager.
    • Added has_session_manager method to McpClient to check for session manager presence.
    • Included a new test case test_with_session_manager to validate the session manager attachment.
  • src/tools/mcp/factory.rs
    • Modified create_client_from_config to ensure non-OAuth HTTP clients are initialized with an McpSessionManager.
    • Added a new test test_factory_non_oauth_http_has_session_manager to verify that non-OAuth HTTP clients created by the factory have a session manager.
Activity
  • The pull request re-implements and supersedes an approved fix from PR fix(mcp): set session manager on non-OAuth HTTP MCP clients #793, which was previously approved but became stale due to staging branch changes.
  • The author validated the changes by running cargo test session_manager -- --nocapture.
  • Specific regression tests tools::mcp::client::tests::test_with_session_manager and tools::mcp::factory::tests::test_factory_non_oauth_http_has_session_manager were targeted and passed.
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.

@github-actions github-actions Bot added the contributor: core 20+ merged PRs label Mar 12, 2026
@zmanian zmanian enabled auto-merge (squash) March 12, 2026 00:10
Copy link
Copy Markdown
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 correctly attaches the MCP session manager to non-OAuth HTTP clients, ensuring consistent session handling across all HTTP-based clients created by the factory. The change is straightforward and is accompanied by a focused regression test.

@zmanian zmanian merged commit f31cd13 into nearai:staging Mar 12, 2026
9 checks passed
@ironclaw-ci ironclaw-ci Bot mentioned this pull request Mar 12, 2026
bkutasi pushed a commit to bkutasi/ironclaw that referenced this pull request Mar 28, 2026
…) (nearai#986)

* fix(mcp): attach session manager for non-OAuth HTTP clients (nearai#793)

* style(mcp): format factory regression test (nearai#986)
drchirag1991 pushed a commit to drchirag1991/ironclaw that referenced this pull request Apr 8, 2026
…) (nearai#986)

* fix(mcp): attach session manager for non-OAuth HTTP clients (nearai#793)

* style(mcp): format factory regression test (nearai#986)
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.

2 participants