fix: address PR #587 REQUEST_CHANGES for MCP namespace health (#543)

- Distinguish client_namespace vs offline_spawn probe sources; only IDE
  client probes prove namespace health and feed mutation gates.
- Record assessments in session; gate gitea_submit_pr_review and
  gitea_merge_pr when client-namespace health is unhealthy/non-proven.
- Mark test_mcp_conn.py offline-only; align recovery docs to client
  reconnect (no PID-kill/config-touch as canonical recovery).
- Rebase onto current master so #590 ledger isolation keeps
  TestMergePR.test_unknown_profile_blocks green.
This commit is contained in:
2026-07-09 18:44:04 -04:00
parent af9f1c5944
commit ebd06b73c9
7 changed files with 341 additions and 94 deletions
+18 -5
View File
@@ -1,10 +1,15 @@
#!/usr/bin/env python3
"""Live health-check script to verify Gitea MCP namespace connections.
"""Offline-only MCP namespace spawn probe (NOT IDE-namespace proof).
Spawns MCP server processes from the IDE config, performs the JSON-RPC
handshake, verifies the required tool is registered, and invokes that tool.
The final invocation is what catches client/namespace EOF failures that a
static FastMCP registration check cannot see.
Spawns a *separate* MCP server process from config via subprocess.Popen,
performs the JSON-RPC handshake, verifies the required tool is registered,
and invokes that tool. Results are classified with
``probe_source=offline_spawn``.
This path is useful for offline launch/registration debugging. It does
**not** prove the IDE-managed MCP client namespace is healthy (#543). For
workflow gates, pass live IDE call evidence with
``probe_source=client_namespace`` to ``gitea_assess_mcp_namespace_health``.
"""
import argparse
@@ -59,6 +64,7 @@ def run_connection_test(name, config, *, required_tool=None, config_path=None):
probe_result={"success": False, "error": str(exc)},
process={"profile": env.get("GITEA_MCP_PROFILE"), "env": env},
config_path=config_path,
probe_source="offline_spawn",
)
print(f" diagnostics: {json.dumps(assessment['diagnostics'], sort_keys=True)}")
return False
@@ -92,6 +98,7 @@ def run_connection_test(name, config, *, required_tool=None, config_path=None):
"env": env,
},
config_path=config_path,
probe_source="offline_spawn",
)
print(f" remediation: {' '.join(assessment['remediation'])}")
proc.terminate()
@@ -128,6 +135,7 @@ def run_connection_test(name, config, *, required_tool=None, config_path=None):
"env": env,
},
config_path=config_path,
probe_source="offline_spawn",
)
print(f" remediation: {' '.join(assessment['remediation'])}")
proc.terminate()
@@ -153,6 +161,7 @@ def run_connection_test(name, config, *, required_tool=None, config_path=None):
"env": env,
},
config_path=config_path,
probe_source="offline_spawn",
)
print(f" [FAIL] Required tool '{tool_name}' is not registered.")
print(f" remediation: {' '.join(assessment['remediation'])}")
@@ -180,6 +189,7 @@ def run_connection_test(name, config, *, required_tool=None, config_path=None):
"env": env,
},
config_path=config_path,
probe_source="offline_spawn",
)
print(f" [FAIL] Received EOF on {tool_name} invocation.")
print(f" diagnostics: {json.dumps(assessment['diagnostics'], sort_keys=True)}")
@@ -198,6 +208,7 @@ def run_connection_test(name, config, *, required_tool=None, config_path=None):
"env": env,
},
config_path=config_path,
probe_source="offline_spawn",
)
print(f" [FAIL] {tool_name} invocation returned error: {call_res['error']}")
print(f" remediation: {' '.join(assessment['remediation'])}")
@@ -215,6 +226,7 @@ def run_connection_test(name, config, *, required_tool=None, config_path=None):
"env": env,
},
config_path=config_path,
probe_source="offline_spawn",
)
print(f" [OK] Successfully invoked required tool '{tool_name}'.")
print(f" diagnostics: {json.dumps(assessment['diagnostics'], sort_keys=True)}")
@@ -263,6 +275,7 @@ def main():
servers[name],
required_tool=REQUIRED_NAMESPACE_TOOLS.get(name),
config_path=config_path,
probe_source="offline_spawn",
):
failed = True
else: