Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(mcp-host,desktop): classify control_plane_unavailable as its own retryable code
Alfredo Lopezcfb794f2e896
diff --git a/desktop-app/ui/src/constants/agents.ts b/desktop-app/ui/src/constants/agents.tsindex da7fa828a..41c348804 100644--- a/desktop-app/ui/src/constants/agents.ts+++ b/desktop-app/ui/src/constants/agents.ts@@ -11,6 +11,7 @@ export const AGENT_ERROR_CODE_LABELS: Record<string, string> = {LLM_RATE_LIMITED: 'Rate Limited',LLM_AUTHENTICATION_FAILED: 'Authentication Error',LLM_MODEL_OVERLOADED: 'Model Overloaded',+ LLM_CONTROL_PLANE_UNAVAILABLE: 'Control Plane Unavailable',LLM_MODEL_NOT_AVAILABLE: 'Model Not Available',LLM_CONTENT_FILTERED: 'Content Filtered',LLM_API_CALL_FAILED: 'Connection Error',diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex 126c0d67a..d32a2ca19 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.445",+ "version": "0.1.446","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.445",+ "version": "0.1.446","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex e189791ca..0f9eb847c 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.445",+ "version": "0.1.446","description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude","main": "dist/main.js","engines": {diff --git a/mcp-host/src/core/errors.ts b/mcp-host/src/core/errors.tsindex d77add7ed..fb7ed98b6 100644--- a/mcp-host/src/core/errors.ts+++ b/mcp-host/src/core/errors.ts@@ -31,6 +31,14 @@ export enum LlmErrorCode {RateLimited = 'LLM_RATE_LIMITED',AuthenticationFailed = 'LLM_AUTHENTICATION_FAILED',ModelOverloaded = 'LLM_MODEL_OVERLOADED',+ /**+ * Issue #720 — a control-plane hop no live process answered: a refused or+ * unresolvable connection to the authorize gateway or a subscription proxy,+ * or a gateway's own 502 in front of control-api. Retryable, with the+ * failover class `provider_unavailable`; only the label differs from+ * {@link LlmErrorCode.ModelOverloaded}.+ */+ ControlPlaneUnavailable = 'LLM_CONTROL_PLANE_UNAVAILABLE',/** One model response asked for more tool calls than the provider contract allows. */ToolCallLimitExceeded = 'LLM_TOOL_CALL_LIMIT_EXCEEDED',/**diff --git a/mcp-host/src/llm/codexSubscription.ts b/mcp-host/src/llm/codexSubscription.tsindex 8ad91a96d..483cfc6e0 100644--- a/mcp-host/src/llm/codexSubscription.ts+++ b/mcp-host/src/llm/codexSubscription.ts@@ -460,6 +460,28 @@ export class CodexSubscriptionProvider implements SingleTurnProvider {...(providerDispatched !== undefined ? { providerDispatched } : {}),}}+ // A control-plane hop no live process answered (#720): retryable, with the+ // failover class of the overload arm below; only the label differs.+ if (code === 'control_plane_unavailable') {+ return {+ code: LlmErrorCode.ControlPlaneUnavailable,+ retryable: true,+ message: err instanceof Error ? err.message : String(err),+ providerCode: code,+ ...(providerDispatched !== undefined ? { providerDispatched } : {}),+ }+ }+ // An upstream 4xx the proxy could not map (#720): the same request gets+ // the same answer, so it is terminal whatever the generic arm decides.+ if (code === 'upstream_rejected') {+ return {+ code: LlmErrorCode.ApiCallFailed,+ retryable: false,+ message: err instanceof Error ? err.message : String(err),+ providerCode: code,+ ...(providerDispatched !== undefined ? { providerDispatched } : {}),+ }+ }if (code === 'provider_unavailable' || code === 'connection_unavailable') {return {code: LlmErrorCode.ModelOverloaded,diff --git a/mcp-host/src/llm/failover/classify.ts b/mcp-host/src/llm/failover/classify.tsindex 188c4c4ca..9e9ea756b 100644--- a/mcp-host/src/llm/failover/classify.ts+++ b/mcp-host/src/llm/failover/classify.ts@@ -26,6 +26,8 @@ export const ALL_FAILOVER_CLASSES: readonly FailoverClass[] = [* - `AuthenticationFailed` → auth (401 and 403 collapse)* - `RateLimited` → rate_limited (429)* - `ModelOverloaded` → provider_unavailable (5xx / 529)+ * - `ControlPlaneUnavailable` → provider_unavailable (a control-plane hop no+ * live process answered, #720)* - `ApiCallFailed ∧ retryable` → provider_unavailable (timeout / network;* also `classifyUnknown`'s default bucket — restrict `triggerOn` to avoid* firing on unrecognised errors)@@ -46,6 +48,7 @@ export function classifyFailoverClass(case LlmErrorCode.RateLimited:return 'rate_limited'case LlmErrorCode.ModelOverloaded:+ case LlmErrorCode.ControlPlaneUnavailable:return 'provider_unavailable'case LlmErrorCode.ApiCallFailed:return retryable ? 'provider_unavailable' : nulldiff --git a/mcp-host/src/llm/grokSubscription.ts b/mcp-host/src/llm/grokSubscription.tsindex 3adfd3a2d..838bb2f59 100644--- a/mcp-host/src/llm/grokSubscription.ts+++ b/mcp-host/src/llm/grokSubscription.ts@@ -325,6 +325,28 @@ export class GrokSubscriptionProvider implements SingleTurnProvider {...(providerDispatched !== undefined ? { providerDispatched } : {}),}}+ // A control-plane hop no live process answered (#720): retryable, with the+ // failover class of the overload arm below; only the label differs.+ if (code === 'control_plane_unavailable') {+ return {+ code: LlmErrorCode.ControlPlaneUnavailable,+ retryable: true,+ message: err instanceof Error ? err.message : String(err),+ providerCode: code,+ ...(providerDispatched !== undefined ? { providerDispatched } : {}),+ }+ }+ // An upstream 4xx the proxy could not map (#720): the same request gets+ // the same answer, so it is terminal whatever the generic arm decides.+ if (code === 'upstream_rejected') {+ return {+ code: LlmErrorCode.ApiCallFailed,+ retryable: false,+ message: err instanceof Error ? err.message : String(err),+ providerCode: code,+ ...(providerDispatched !== undefined ? { providerDispatched } : {}),+ }+ }if (code === 'provider_unavailable' || code === 'connection_unavailable') {return {code: LlmErrorCode.ModelOverloaded,