Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
refactor(mcp-host): return a fresh unavailable result per guarded short-circuit
Jose Gabriel Ramirez Encinas4f2be5fcbeb1
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex 1928bc87d..0e6daaf99 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.557",+ "version": "0.1.558","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.557",+ "version": "0.1.558","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex 2e9f5111a..17bcdd016 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.557",+ "version": "0.1.558","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/guardrails/hooks/guardedFetch.ts b/mcp-host/src/core/guardrails/hooks/guardedFetch.tsindex 58b889b11..c2798e4ba 100644--- a/mcp-host/src/core/guardrails/hooks/guardedFetch.ts+++ b/mcp-host/src/core/guardrails/hooks/guardedFetch.ts@@ -34,7 +34,8 @@ export interface GuardHookFetcherOptions {export const DEFAULT_HOOK_HARD_DEADLINE_MS = 15000-const UNAVAILABLE: HookHttpResult = { status: 0, body: undefined, unavailable: true }+/** Fresh object per short-circuit so callers never share a mutable result. */+const unavailable = (): HookHttpResult => ({ status: 0, body: undefined, unavailable: true })/** Identity of the breaker state (per hook pod+path), shared across tasks and lanes (§8.6). */export function hookBreakerKey(descriptor: HookDescriptor): string {@@ -60,7 +61,7 @@ function withDeadline(): Promise<HookHttpResult> {let timer: ReturnType<typeof setTimeout> | undefinedconst deadline = new Promise<HookHttpResult>(resolve => {- timer = setTimeout(() => resolve(UNAVAILABLE), hardDeadlineMs)+ timer = setTimeout(() => resolve(unavailable()), hardDeadlineMs)// Don't let the backstop timer keep the event loop alive.;(timer as { unref?: () => void }).unref?.()})@@ -78,10 +79,10 @@ export function guardHookFetcher(opts: GuardHookFetcherOptions): HookFetcher {const key = hookBreakerKey(descriptor)return async args => {- if (descriptor.quarantined) return UNAVAILABLE+ if (descriptor.quarantined) return unavailable()const engaged = hookBreakerEngaged(descriptor)// Breaker open: skip the dial (and its timeout); report unavailable.- if (engaged && breakers.isOpen(key, now())) return UNAVAILABLE+ if (engaged && breakers.isOpen(key, now())) return unavailable()const res = await withDeadline(fetch, args, hardDeadlineMs)if (engaged) {