Skip to content

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

TypeScript

fix(np-08): fail closed on context API errors after PR380 rebase

Alfredo Lopezd5ea0f3731b9
diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.json
index a30df3efb..ae8213295 100644
--- a/host-context-controller/package-lock.json
+++ b/host-context-controller/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-host-context-controller",
- "version": "0.1.170",
+ "version": "0.1.171",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-host-context-controller",
- "version": "0.1.170",
+ "version": "0.1.171",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@clerum/image-policy": "file:../packages/image-policy",
diff --git a/host-context-controller/package.json b/host-context-controller/package.json
index 63c6499b6..4a2193b66 100644
--- a/host-context-controller/package.json
+++ b/host-context-controller/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-host-context-controller",
- "version": "0.1.170",
+ "version": "0.1.171",
"description": "Host Context Controller - provides McpServer CRDs to mcp-host via REST API",
"main": "dist/main.js",
"engines": {
diff --git a/host-context-controller/src/k8sClient.ts b/host-context-controller/src/k8sClient.ts
index c54215f07..0044519cf 100644
--- a/host-context-controller/src/k8sClient.ts
+++ b/host-context-controller/src/k8sClient.ts
@@ -30,7 +30,6 @@ import {
import { K8sGfsApi } from './k8s/gfsK8sApi'
import { makeHostK8sApiClient } from './k8s/hostK8sApiClient'
import { pvcName as sfsPvcName } from './k8s/sharedFileSystemFactory'
-import { hostDeleteCleanupTotal, hostFleetRequestsTotal, hostWatchRecoverySeconds } from './metrics'
import type {
AuthorityContext,
AuthorityHost,
@@ -39,6 +38,7 @@ import type {
AuthoritySecretMetadata,
McpAuthorizationStore,
} from './mcpAuthorization'
+import { hostDeleteCleanupTotal, hostFleetRequestsTotal, hostWatchRecoverySeconds } from './metrics'
import { NetworkPolicyReconciler } from './networkPolicyReconciler'
import { McpServerReconciler } from './reconciler'
import { SharedFileSystemReconciler } from './sharedFileSystemReconciler'
@@ -56,6 +56,7 @@ import {
SharedFileSystemCRD,
SharedFileSystemSpec,
} from './types'
+import { getErrorCode } from './utils'
// Only initialize K8s client if not in dev mode
let customObjectsApi: k8s.CustomObjectsApi | null = null
@@ -506,15 +507,12 @@ export async function getContext(contextId: string): Promise<ContextCRD | null>
spec: obj.spec,
}
} catch (error) {
- const code =
- (error as { code?: number; response?: { statusCode?: number } }).code ??
- (error as { response?: { statusCode?: number } }).response?.statusCode
- if (code === 404) {
+ if (getErrorCode(error) === 404) {
console.warn(`[K8s] Context CRD not found: ${contextId}`)
return null
}
console.error(`[K8s] Failed to read Context CRD:`, error)
- return null
+ throw error
}
}