# NousResearch/hermes-agent · MCP session expiry and auto-reconnect handling

## Open now

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

## TL;DR

- 6 member(s): 0 open issue(s), 2 closed issue(s), 0 open PR(s), 1 merged PR(s), 3 PR(s) closed without merging.
- A fix was merged to main in PR #19380. Verify it addresses your case.
- **Recommended:** read PR #19380 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `partially_resolved` · deciding PR(s): `pr-19380`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_PARTIAL`): 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 member 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.

## Closed / duplicate issues

- #13383: \[Bug\]: MCP server session expires during long-running gateway — no auto-reconnect
- #18790: \[Bug\]: ERROR tools.mcp_tool: MCP tool playwright/browser_run_code call failed: Session terminated - From Gateway sessions

## Prior & competing PRs

- **#19380: fix(mcp): reconnect on terminated sessions**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `tests/tools/test_mcp_tool_session_expired.py`, `tools/mcp_tool.py`
  - fix hunks:
  - `tests/tools/test_mcp_tool_session_expired.py`

    ```diff
    @@ -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`

    ```diff
    @@ -1667,6 +1667,7 @@ async def _recover():
         "session expired",
         "session not found",
         "unknown session",
    +    "session terminated",
     )
     
     
    ```
- **#13402: fix(mcp): auto-reconnect on expired session during tool call**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `e87a2100f`, `#13406`, `#13383`, `#13383`
- **#13406: fix(mcp): auto-reconnect + retry once when the transport session expires (#13383)**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `#13383`
- **#19232: fix(mcp): reconnect on terminated sessions**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#19380`

## Fix status

- Merged to main in PR #19380 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-05-03`.
