fix: refine terminal preflight check to avoid false-positive PATH blocks on server

This commit is contained in:
2026-07-09 11:31:48 -04:00
parent f558b80cc8
commit 8d6d3cb014
+7
View File
@@ -9457,6 +9457,13 @@ def gitea_resolve_task_capability(
resolved_cwd = os.environ.get("GITEA_ACTIVE_WORKTREE") or PROJECT_ROOT resolved_cwd = os.environ.get("GITEA_ACTIVE_WORKTREE") or PROJECT_ROOT
probe_res = native_mcp_preference.probe_terminal_spawn(resolved_cwd) probe_res = native_mcp_preference.probe_terminal_spawn(resolved_cwd)
if not probe_res["healthy"]: if not probe_res["healthy"]:
# Only block if the failure is due to a missing CWD, missing shell, or the circuit breaker is tripped.
# Other failures (like missing executable in the MCP process's limited PATH) should not block the agent's shell capability.
is_real_blocker = (
probe_res.get("error_type") in ("missing cwd", "missing shell")
or native_mcp_preference.shell_health_status().get("hard_stopped")
)
if is_real_blocker:
profile = get_profile() profile = get_profile()
h = host or (REMOTES.get(remote, {}).get("host") if remote in REMOTES else None) h = host or (REMOTES.get(remote, {}).get("host") if remote in REMOTES else None)
username = _authenticated_username(h) if h else None username = _authenticated_username(h) if h else None