fix: resolve stale MCP runtime EOF follow-ups (#531)

- fail closed when runtime diagnostics fail unexpectedly
- move MCP connection healthcheck under scripts/
- document #543 as the remaining IDE namespace proof
- keep namespace binding test isolated from mocked git metadata
This commit is contained in:
2026-07-09 08:06:54 -04:00
parent c64809134f
commit be0123c6dd
5 changed files with 84 additions and 35 deletions
+14 -4
View File
@@ -694,8 +694,13 @@ def _verify_role_mutation_workspace(
raise RuntimeError("; ".join(runtime_reasons))
except Exception as exc:
if "stale-runtime:" in str(exc):
raise RuntimeError(str(exc))
pass
raise RuntimeError(str(exc)) from exc
# Fail-closed: unexpected error while performing stale-runtime guard must not be swallowed.
# Surface an actionable diagnostic instead of allowing a mutation under unknown runtime state.
raise RuntimeError(
f"stale-runtime: runtime diagnostic check failed unexpectedly ({type(exc).__name__}: {exc}). "
"Failing closed. Verify MCP server processes, profile configuration, and OS process visibility; retry after full MCP server restart."
) from exc
role = _effective_workspace_role()
git_state = issue_lock_worktree.read_worktree_git_state(
@@ -8338,7 +8343,12 @@ def gitea_route_task_session(
def _check_mcp_runtimes_diagnostics(task: str, matching_profiles: list[str]) -> list[str]:
"""Check running runtimes and return errors if they are missing or stale."""
"""Check running runtimes and return errors if they are missing or stale.
NOTE: IDE-namespace callable-tool proof for #543 is a documented follow-up
if this change does not fully close the gap for tools invoked from
IDE-launched MCP client namespaces. See docs/wiki/Open-Decisions.md.
"""
import subprocess
import re
from datetime import datetime
@@ -8407,7 +8417,7 @@ def _check_mcp_runtimes_diagnostics(task: str, matching_profiles: list[str]) ->
if self_stale:
reasons.append(
"stale-runtime: The active Gitea MCP server process is stale (running code from before changes were merged). "
"Please fully restart the Gitea MCP server (e.g. touch /Users/jasonwalker/.gemini/config/mcp_config.json) and retry."
"Please fully restart the Gitea MCP server (for the affected profile) and retry."
)
if matching_profiles: