Skip to content

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

TypeScript

fix(mcp-host): treat a non-positive Retry-After as absent (#720)

Alfredo Lopez74f97233489f
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 2553ab767..3988e441b 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.463",
+ "version": "0.1.464",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.463",
+ "version": "0.1.464",
"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 023bec761..2a5711a66 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.463",
+ "version": "0.1.464",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/llm/rateLimitRetry.ts b/mcp-host/src/llm/rateLimitRetry.ts
index 3a4875f3f..a9e3228a8 100644
--- a/mcp-host/src/llm/rateLimitRetry.ts
+++ b/mcp-host/src/llm/rateLimitRetry.ts
@@ -10,16 +10,17 @@ export const RATE_LIMIT_RETRY_MAX_WAIT_MS = 30_000
/**
* The wait before the single retry of a proxy or authorize error, or
* `undefined` when it is not retried: only a `rate_limited` that carried a
- * Retry-After within
- * {@link RATE_LIMIT_RETRY_MAX_WAIT_MS}. `control_plane_unavailable` and every
- * other code are never retried here.
+ * Retry-After greater than zero and within
+ * {@link RATE_LIMIT_RETRY_MAX_WAIT_MS}. A non-positive value is treated as
+ * absent, like any other invalid Retry-After. `control_plane_unavailable` and
+ * every other code are never retried here.
*/
export function rateLimitRetryDelayMs(
code: string,
retryAfterMs: number | undefined
): number | undefined {
if (code !== 'rate_limited' || retryAfterMs === undefined) return undefined
- return retryAfterMs <= RATE_LIMIT_RETRY_MAX_WAIT_MS ? retryAfterMs : undefined
+ return retryAfterMs > 0 && retryAfterMs <= RATE_LIMIT_RETRY_MAX_WAIT_MS ? retryAfterMs : undefined
}
/** Waits `ms`; an abort of `signal` rejects at once with the abort reason. */