Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(mcp-host): give a retryable control_plane_unavailable the loop transport retry (#720)

Alfredo Lopez5fab01f7ed72
diff --git a/docs/architecture/codex-subscription-transport-contract.md b/docs/architecture/codex-subscription-transport-contract.md
index 94b8dfd87..69a267a40 100644
--- a/docs/architecture/codex-subscription-transport-contract.md
+++ b/docs/architecture/codex-subscription-transport-contract.md
@@ -666,6 +666,15 @@ which mount `nginx.conf` through `subPath`. `rate_limited` and
`upstream_rejected` need no order: an old Host already classifies them as a
new one does, without `httpStatus`.
+The Host classifies `control_plane_unavailable` as
+`LLM_CONTROL_PLANE_UNAVAILABLE`, retryable, with the failover class
+`provider_unavailable`. The Host sets the same code when its own connect to
+the authorize gateway or to the proxy fails in the connect phase. The
+tool-use loop retries it once after 350 ms, as it retries a retryable
+`LLM_API_CALL_FAILED`; before #720 a refused Host connect reached the loop as
+that code. The retry is a new provider attempt with a new authorize, so a
+redeemed ticket is never reused.
+
The client logs `codex_proxy_control_api_unreachable` with `path` only. The
cause code is logged on one line only: the attempt line for a redeem, and,
when both finalize tries fail, the `err` of `codex_proxy_finalize_failed`.
diff --git a/docs/architecture/grok-subscription-transport-contract.md b/docs/architecture/grok-subscription-transport-contract.md
index 99e85c301..d3abe3e27 100644
--- a/docs/architecture/grok-subscription-transport-contract.md
+++ b/docs/architecture/grok-subscription-transport-contract.md
@@ -565,6 +565,15 @@ which mount `nginx.conf` through `subPath`. `rate_limited` and
`upstream_rejected` need no order: an old Host already classifies them as a
new one does, without `httpStatus`.
+The Host classifies `control_plane_unavailable` as
+`LLM_CONTROL_PLANE_UNAVAILABLE`, retryable, with the failover class
+`provider_unavailable`. The Host sets the same code when its own connect to
+the authorize gateway or to the proxy fails in the connect phase. The
+tool-use loop retries it once after 350 ms, as it retries a retryable
+`LLM_API_CALL_FAILED`; before #720 a refused Host connect reached the loop as
+that code. The retry is a new provider attempt with a new authorize, so a
+redeemed ticket is never reused.
+
The client logs `grok_proxy_control_api_unreachable` with `path` only. The
`grok_proxy_attempt_finished` line carries `causeCode` whenever the failure
is a rejected `fetch`: the undici cause code, such as `ECONNREFUSED`, and
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 4b5e9b166..11242bec3 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.458",
+ "version": "0.1.459",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.458",
+ "version": "0.1.459",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --git a/mcp-host/package.json b/mcp-host/package.json
index 49e037a8e..87d359b16 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.458",
+ "version": "0.1.459",
"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/orchestration/toolUseLoopIntentRecovery.ts b/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.ts
index fd2b0008a..8260ef273 100644
--- a/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.ts
+++ b/mcp-host/src/core/orchestration/toolUseLoopIntentRecovery.ts
@@ -18,9 +18,19 @@ export function isRetryableLlmError(error: Error): boolean {
)
}
+/**
+ * A failure the loop retries once after a short pause. ControlPlaneUnavailable
+ * is here because it relabels a refused connect that reached the loop as a
+ * retryable ApiCallFailed before #720 (review round 2 M4); a gateway's
+ * `control_plane_unavailable` reply takes the same single retry.
+ */
export function isRetryableLlmTransportError(error: Error): boolean {
const maybeLlmError = error as { code?: unknown; retryable?: unknown }
- return maybeLlmError.retryable === true && maybeLlmError.code === LlmErrorCode.ApiCallFailed
+ return (
+ maybeLlmError.retryable === true &&
+ (maybeLlmError.code === LlmErrorCode.ApiCallFailed ||
+ maybeLlmError.code === LlmErrorCode.ControlPlaneUnavailable)
+ )
}
export function latestUserText(messages: ChatMessage[]): string {