fix(target-health): ignore context-caused federation errors

mcpFederatedToolsList's fan-out and mcpFederatedToolsCall both
derive their outbound context from r.Context(). A client cancel
(context.Canceled) or the shared fan-out deadline expiring
(context.DeadlineExceeded) is not evidence about a server's own
health, so neither is recorded any more, mirroring
recordTargetProxyHealth's own client-cancel rule. A server that is
genuinely hung is still caught by the active probe sweep or its own
per-server proxy health.

Claude-Session: https://claude.ai/code/session_01EebV5jyWvYocByNQ3oss1w
This commit is contained in:
2026-09-03 02:45:15 +01:00
parent d2152b169c
commit 88260a386b
3 changed files with 188 additions and 3 deletions
+6 -1
View File
@@ -1893,7 +1893,12 @@ plugin's config.
`POST /mcp`'s `tools/list` fan-out and `tools/call` record a failure
only when the outbound call itself fails (`err != nil` from the
backend call) — a JSON-RPC-level `error` in the backend's own
response still counts as reachable, since the server answered.
response still counts as reachable, since the server answered. A
context-caused failure (the caller canceling, or the shared fan-out
deadline expiring) records nothing at all, the same client-cancel
rule the per-server proxy above applies; a genuinely hung server is
still caught by the active probe sweep or its own per-server proxy
health.
- **Active probes are opt-in** (`targetHealth.enabled: true`) and lazy:
no timer, no background goroutine running on its own. A probe sweep
is triggered by `/metrics`, `GET /admin/api/targets`, `GET