Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
chore(hcc): sync #481 with merged #480 and #479
Alfredo Lopez6177014d8f08
diff --cc host-context-controller/package-lock.jsonindex f02d8db39,dbbd87fd5..fd8dcd343--- a/host-context-controller/package-lock.json+++ b/host-context-controller/package-lock.json@@@ -1,12 -1,12 +1,12 @@@{"name": "clerum-host-context-controller",- "version": "0.1.250",- "version": "0.1.249",++ "version": "0.1.251","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-host-context-controller",- "version": "0.1.250",- "version": "0.1.249",++ "version": "0.1.251","license": "SEE LICENSE IN LICENSE","dependencies": {"@clerum/image-policy": "file:../packages/image-policy",diff --cc host-context-controller/package.jsonindex 189a692dd,d3d738da8..8e8a38126--- a/host-context-controller/package.json+++ b/host-context-controller/package.json@@@ -1,6 -1,6 +1,6 @@@{"name": "clerum-host-context-controller",- "version": "0.1.250",- "version": "0.1.249",++ "version": "0.1.251","description": "Host Context Controller - provides McpServer CRDs to mcp-host via REST API","main": "dist/main.js","engines": {diff --cc host-context-controller/src/networkPolicyReconciler.tsindex 456ef52ab,0c048d5b6..624f54570--- a/host-context-controller/src/networkPolicyReconciler.ts+++ b/host-context-controller/src/networkPolicyReconciler.ts@@@ -1450,74 -1415,32 +1452,74 @@@ export class NetworkPolicyReconcilerallRpcProxyEgressPolicies.length +allExternalPolicies.length+ // Count namespace-wide orphan candidates BEFORE any delete. A blown cache- // that lists a mass-delete must refuse the pass rather than sweep.++ // that lists a mass-delete must refuse the sweep and still certify.+ const isContextLaneOrphan = (policy: k8s.V1NetworkPolicy): boolean => {+ const contextId = policy.metadata?.labels?.[CONTEXT_LABEL]+ return !contextId || !desiredContextIds.has(contextId)+ }+ const isExternalLaneOrphan = (policy: k8s.V1NetworkPolicy): boolean => {+ const serverName = policy.metadata?.labels?.[MCPSERVER_LABEL]+ return !serverName || !desiredServerNames.has(serverName)+ }+ const orphanCandidates = [+ ...allContextPolicies.filter(isContextLaneOrphan),+ ...allContextEgressPolicies.filter(isContextLaneOrphan),+ ...allRpcProxyEgressPolicies.filter(isContextLaneOrphan),+ ...(options.serverInventoryComplete !== false && serverCleanupAuthoritative()+ ? allExternalPolicies.filter(isExternalLaneOrphan)+ : []),+ ]+ const listedManagedFleet =+ allContextPolicies.length ++ allContextEgressPolicies.length ++ allRpcProxyEgressPolicies.length ++ allExternalPolicies.length+ const capReason = evaluateNetPolOrphanSweepCap(orphanCandidates.length, listedManagedFleet)+ if (capReason) {+ netPolOrphanSweepCappedTotal.inc({ reason: capReason })+ console.warn(+ `[NetPol] ${NETWORKPOLICY_ORPHAN_SWEEP_CAPPED_MESSAGE} (${capReason}): ${orphanCandidates.length} candidates of ${listedManagedFleet} listed managed policies; refusing deletes and continuing certification`+ )+ }+// Delete orphaned Context policies across every L2 lane. Each lane uses// the canonical contextId effect key and rechecks authority plus live CRD- // presence immediately before its delete.- await cleanupOrphanedContextPolicies(- allContextPolicies,- policy =>- this.deleteSafetyPolicySnapshot(config.namespace, policy, contextCleanupAuthoritative),- (name, contextId) =>- `[NetPol] Deleting orphaned policy "${name}" (context "${contextId}" no longer exists)`- )- await cleanupOrphanedContextPolicies(- allContextEgressPolicies,- policy =>- this.deleteSafetyPolicySnapshot(config.hostNamespace, policy, contextCleanupAuthoritative),- name => `[NetPol] Deleting orphaned L2 egress policy "${name}"`- )- await cleanupOrphanedContextPolicies(- allRpcProxyEgressPolicies,- policy =>- this.deleteSafetyPolicySnapshot(- config.rpcProxyNamespace,- policy,- contextCleanupAuthoritative- ),- name => `[NetPol] Deleting orphaned rpc-proxy egress policy "${name}"`- )+ // presence immediately before its delete. A cap trip skips this sweep+ // (and the external-orphan loop below) so a blown cache cannot mass-delete,+ // then the pass still certifies live inventory.+ if (!capReason) {+ await cleanupOrphanedContextPolicies(+ allContextPolicies,+ policy =>+ this.deleteSafetyPolicySnapshot(config.namespace, policy, contextCleanupAuthoritative),+ (name, contextId) =>+ `[NetPol] Deleting orphaned policy "${name}" (context "${contextId}" no longer exists)`,+ 'context-ingress'+ )+ await cleanupOrphanedContextPolicies(+ allContextEgressPolicies,+ policy =>+ this.deleteSafetyPolicySnapshot(+ config.hostNamespace,+ policy,+ contextCleanupAuthoritative+ ),+ name => `[NetPol] Deleting orphaned L2 egress policy "${name}"`,+ 'context-host-egress'+ )+ await cleanupOrphanedContextPolicies(+ allRpcProxyEgressPolicies,+ policy =>+ this.deleteSafetyPolicySnapshot(+ config.rpcProxyNamespace,+ policy,+ contextCleanupAuthoritative+ ),+ name => `[NetPol] Deleting orphaned rpc-proxy egress policy "${name}"`,+ 'context-rpc-egress'+ )+ }let liveDesiredRevisionChanged = falsefor (const context of contexts) {