Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
chore(hcc): sync #479 with the merged #480 identity pass
Alfredo Lopez79d1ed19a894
diff --cc host-context-controller/src/readinessSafetyFence.integration.test.tsindex 9533b8c6b,5bab48f71..1153a0709--- a/host-context-controller/src/readinessSafetyFence.integration.test.ts+++ b/host-context-controller/src/readinessSafetyFence.integration.test.ts@@@ -19,12 -18,7 +19,13 @@@import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'import * as http from 'http'import { McpServerWatcher } from './k8sClient'+ import { registry } from './metrics'+import {+ resolveHostAuthoritativeFn,+ resolveProbeAuthoritativeFn,+ resolveProviderAuthoritativeFn,+ resolveReadinessDetailFn,+} from './readinessGate'import { ContextMapperServer } from './server'const mocks = vi.hoisted(() => ({@@@ -152,21 -146,28 +153,42 @@@ async function readyStatus(server: Inst})}+async function apiStatus(server: InstanceType<typeof ContextMapperServer>): Promise<number> {+ const listener = (server as unknown as { server: http.Server | null }).server+ const address = listener?.address()+ if (!address || typeof address === 'string') throw new Error('readiness listener never bound')+ return new Promise((resolve, reject) => {+ http+ .get({ host: '127.0.0.1', port: address.port, path: '/api/v1/mcpservers' }, res => {+ res.resume()+ res.on('end', () => resolve(res.statusCode ?? 0))+ })+ .on('error', reject)+ })+}+/** Aligns every revocation counter so only the fence can gate readiness. */++ async function readLabeledMetric(name: string, labels: Record<string, string>): Promise<number> {+ const metric = registry.getSingleMetric(name)+ if (!metric) throw new Error(`${name} is not registered`)+ const snapshot = await metric.get()+ return (+ snapshot.values.find(entry =>+ Object.entries(labels).every(([key, value]) => entry.labels[key] === value)+ )?.value ?? 0+ )+ }++ async function readLaneSuccessTimestamp(lane: string): Promise<number> {+ const metric = registry.getSingleMetric(+ 'clerum_hcc_initial_convergence_last_success_timestamp_seconds'+ )+ if (!metric) throw new Error('last_success metric is not registered')+ const snapshot = await metric.get()+ return snapshot.values.find(entry => entry.labels.lane === lane)?.value ?? 0+ }+function alignRevocationCounters(watcher: InstanceType<typeof McpServerWatcher>): void {const w = watcher as unknown as Record<string, unknown>w.mcpServerCacheSynced = true