MCP session expiry and auto-reconnect handling

NousResearch/hermes-agent · cluster 13383

Data as of

Nothing open on GitHub. Fix merged in #19380. Check it covers your case.

The short answer

0open issues
0open PRs
6items grouped
Known?
Yes. 6 related items grouped here, 2 issues already closed.
Fix event
A fix was merged to main in PR #19380. Check it covers your case. No release data is tracked.
Tracker
The maintainers' tracker marks this partially resolved, deciding PR #19380. That is separate from the fix event.
Still open
Nothing open on GitHub.

Multiple bug reports and fixes addressing MCP transport sessions that expire or terminate without automatic reconnection, particularly in gateway contexts. Work covers retry logic, circuit breaker behavior, and related OAuth session reconnect improvements.

Open issues0

No open issues.

Open PRs0

No open pull requests.

Fixes on record

Merged to main. A stamp counts the issues a fix is linked to.

  • #19380 fix(mcp): reconnect on terminated sessions

    merged to main

    files: tests/tools/test_mcp_tool_session_expired.py, tools/mcp_tool.py

    Show the diff
    • tests/tools/test_mcp_tool_session_expired.py
      @@ -46,6 +46,13 @@ def test_is_session_expired_detects_session_not_found():
           assert _is_session_expired_error(RuntimeError("Unknown session: abc123")) is True
       
       
      +def test_is_session_expired_detects_session_terminated():
      +    """Remote Playwright MCP reports transport loss as ``Session terminated``."""
      +    from tools.mcp_tool import _is_session_expired_error
      +
      +    assert _is_session_expired_error(RuntimeError("Session terminated")) is True
      +
      +
       def test_is_session_expired_is_case_insensitive():
           """Match uses lower-cased comparison so servers that emit the
           message in different cases (SDK formatter quirks) still trigger."""
    • tools/mcp_tool.py
      @@ -1667,6 +1667,7 @@ async def _recover():
           "session expired",
           "session not found",
           "unknown session",
      +    "session terminated",
       )
       
       

3 PRs closed without merging

From the close comments: done elsewhere 2 · merged via another change 1

  • #13402 fix(mcp): auto-reconnect on expired session during tool call · done elsewhere → e87a210, #13406, #13383
  • #13406 fix(mcp): auto-reconnect + retry once when the transport session expires (#13383) · done elsewhere → #13383
  • #19232 fix(mcp): reconnect on terminated sessions · merged via another change → #19380
Closed issues · 2
  • Closed#13383[Bug]: MCP server session expires during long-running gateway — no auto-reconnect
  • Closed#18790[Bug]: ERROR tools.mcp_tool: MCP tool playwright/browser_run_code call failed: Session terminated - From Gateway sessions
How this cluster was grouped
  • Link evidence (partly structural links): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
  • Members outside that structural core may belong to a different underlying problem.
  • Pairwise link density 0.29: the share of item pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. 1.00 means every pair is linked.

Pick up a Lab task

Check whether a fix covers the open issues here, with your own agent. Bring back evidence for maintainers.

Open the Lab

At a glance

Merged PRs
#19380
Closed issues
2
Attempts
3 PRs closed without merging
Fix link checked
3 May 2026

For your agent

The same facts, typed.