Skip to content

fix(runtime-admin): swap dead agent.mcp_registry import for plugin helper (Phase 5) - #31

Merged
deestax merged 1 commit into
mainfrom
fix/runtime-admin-mcp-disconnect-import
May 11, 2026
Merged

fix(runtime-admin): swap dead agent.mcp_registry import for plugin helper (Phase 5)#31
deestax merged 1 commit into
mainfrom
fix/runtime-admin-mcp-disconnect-import

Conversation

@deestax

@deestax deestax commented May 11, 2026

Copy link
Copy Markdown
Member

The runtime-admin POST /myah/v1/admin/mcp/disconnect/{name} handler imported disconnect_mcp_server from agent.mcp_registry — a module that does not exist anywhere in the repo (or upstream). Every request hit the except Exception fallback and returned 500 "MCP registry module not available".

The dashboard's DELETE /mcp/<name> route (in myah_admin.dashboard._skills_plugins_mcp) delegates to this endpoint over HTTP. The dashboard captured the 500 and fell through to its own config.yaml mutation, so users saw "disconnect succeeded" while the gateway kept the stale reference in tools.mcp_tool._servers until process restart. Toolset cache + MCP-aware tool routing kept treating the server as connected until then.

The fix

Swap the import to the real plugin-side helper at myah_hermes_plugin.runtime_extensions.mcp_disconnect.disconnect_mcp_server. That module has shipped since PR NousResearch#106 (Phase E) — it uses upstream's tools.mcp_tool private state + the _run_on_mcp_loop cross-loop bridge, exactly the pattern upstream's "shutdown ALL servers" helper uses.

One-line swap + a longer comment block explaining the resolution chain so future maintainers don't undo it.

Regression test

tests/test_runtime_admin_mcp_disconnect.py drives the real handler from _make_handlers() against a mocked tools.mcp_tool state (servers dict + threading lock + _run_on_mcp_loop) and asserts:

  1. Endpoint returns 200 + {ok: True, name: "..."} (NOT the 500 import-error fallback)
  2. The plugin-side helper actually pops the server from tools.mcp_tool._servers (cross-checks the chain end-to-end)
  3. Idempotent: unknown server name → still 200 + ok=True (matches dashboard's evict-all chain pattern)

Pre-fix: both tests fail with ModuleNotFoundError: No module named 'agent.mcp_registry' (TDD).
Post-fix: both tests pass.

The existing test_mcp_disconnect.py covers the plugin helper in isolation; this new file covers the runtime-admin handler that calls into it — closes the integration gap.

Companion PR ordering

Parent-repo submodule bump PR follows on T3-Venture-Labs-Limited/myah. Merge this first.

Refs docs/superpowers/plans/2026-05-11-no-fork-vendoring-respec.md (Task 2: Phase 5 fix, ~0.5h estimate).

@github-actions

github-actions Bot commented May 11, 2026

Copy link
Copy Markdown

🔎 Lint report: fix/runtime-admin-mcp-disconnect-import vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 8004 on HEAD, 8003 on base (🆕 +1)

🆕 New issues (2):

Rule Count
unresolved-import 2
First entries
plugins/myah-hermes-plugin/tests/test_runtime_admin_mcp_disconnect.py:32: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`
plugins/myah-hermes-plugin/tests/test_runtime_admin_mcp_disconnect.py:33: [unresolved-import] unresolved-import: Cannot resolve imported module `aiohttp.test_utils`

✅ Fixed issues: none

Unchanged: 4193 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

…lper

The runtime-admin POST /myah/v1/admin/mcp/disconnect/{name} handler
imported disconnect_mcp_server from agent.mcp_registry — a module that
does not exist anywhere in the hermes-fork (or upstream). Every request
hit the 'except Exception' fallback and returned 500 with 'MCP registry
module not available', so the dashboard's DELETE /mcp/<name> chain
silently failed to actually disconnect MCP servers from
tools.mcp_tool._servers on the gateway side. The dashboard layer
captured the 500 and falls through to its own config-yaml mutation, so
the user saw 'success' while the gateway kept the stale reference until
the next process restart.

The correct module is myah_hermes_plugin.runtime_extensions.mcp_disconnect
(shipped in PR NousResearch#106, Phase E). It uses upstream's tools.mcp_tool
private state plus the _run_on_mcp_loop cross-loop bridge — exactly the
same pattern upstream's 'shutdown ALL servers' helper uses.

Tests in test_runtime_admin_mcp_disconnect.py drive the real handler
against a mocked tools.mcp_tool and assert the endpoint returns 200 +
ok=True (not the import-error 500 fallback). Pre-fix both tests fail
with ModuleNotFoundError: 'agent.mcp_registry'; post-fix both pass and
the fake server is actually popped from tools.mcp_tool._servers.

Related: docs/superpowers/plans/2026-05-11-no-fork-vendoring-respec.md (Phase 5)
@deestax
deestax force-pushed the fix/runtime-admin-mcp-disconnect-import branch from 9d53886 to 8c46217 Compare May 11, 2026 11:52
@deestax
deestax merged commit 969b987 into main May 11, 2026
6 of 7 checks passed
@deestax
deestax deleted the fix/runtime-admin-mcp-disconnect-import branch May 11, 2026 13:52
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.

1 participant