Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(hcc): address zach88 review nits
Alfredo Lopez0aff52f8ce60
diff --git a/Makefile b/Makefileindex cad53ca12..cce68c7a4 100644--- a/Makefile+++ b/Makefile@@ -676,7 +676,7 @@ minikube-t2-np08-hcc-authorization: minikube-t2 ## Run canonical T2 including th# Dedicated #604 certification: the bounded health lane runs the real# policy lifecycle, business invocation and three watch reconnections..PHONY: minikube-t2-hcc-networkpolicy-lifecycle-minikube-t2-hcc-networkpolicy-lifecycle:+minikube-t2-hcc-networkpolicy-lifecycle: ## Run canonical T2 with the HCC NetworkPolicy lifecycle and watch-reconnection health gate@T2_HEALTHCHECK_COMMAND='bash scripts/e2e/e2e-hcc-networkpolicy-lifecycle.sh' \T2_HEALTHCHECK_TIMEOUT_SECONDS=900 T2_HEALTHCHECK_KILL_GRACE_SECONDS=300 $(MAKE) minikube-t2diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.jsonindex 752839af1..dc045e364 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.313",+ "version": "0.1.314","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-host-context-controller",- "version": "0.1.313",+ "version": "0.1.314","license": "SEE LICENSE IN LICENSE","dependencies": {"@clerum/codex-catalog-projection": "file:../packages/codex-catalog-projection",diff --git a/host-context-controller/package.json b/host-context-controller/package.jsonindex 5c8e6e083..02c15dca1 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.313",+ "version": "0.1.314","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.tsindex bef2ed366..5b3a4b286 100644--- a/host-context-controller/src/k8sClient.ts+++ b/host-context-controller/src/k8sClient.ts@@ -3936,8 +3936,9 @@ export class McpServerWatcher implements McpServerProvider {// Most status writes do not change desired state. A runtime eligibility// edge does change policy intent: propagate it without re-entering the- // runtime owner merely because it published status. Discovery still- // receives every update; UID/spec/annotation/label changes remain live.+ // runtime owner inline. The scheduled replay also retries runtime+ // reconciliation. Discovery receives every update; UID/spec/annotation/+ // label changes remain live.if (type === 'MODIFIED' && previous && isMcpServerStatusOnlyUpdate(previous, server)) {if (runtimeDesired(previous) !== runtimeDesired(server)) {// The revision bump above retires old policy work and requests a@@ -3993,6 +3994,11 @@ export class McpServerWatcher implements McpServerProvider {!current.spec.mcpServers?.includes(server.name))return+ hccLogger.debug('Reconciling Context policies after McpServer change', {+ serverName: server.name,+ contextName: current.name,+ contextId,+ })const completed = await this.netPolReconciler.reconcileContext(current, {isCurrent: () => isCurrent() && this.contexts.get(current.name) === current,})diff --git a/host-context-controller/src/mcpServerSafety.test.ts b/host-context-controller/src/mcpServerSafety.test.tsindex 08821c206..4f49ad2e2 100644--- a/host-context-controller/src/mcpServerSafety.test.ts+++ b/host-context-controller/src/mcpServerSafety.test.ts@@ -339,6 +339,18 @@ describe('runtimeDesired policy contract (#604)', () => {}})+ it.each(['True', 'Unknown'] as const)(+ 'keeps a known failure reason fail-closed despite contradictory %s status',+ status => {+ // A future or malformed writer must not turn a known failure into an allow.+ for (const reason of ['SecretNotFound', 'SecretMissingKey', 'SecretAccessDenied']) {+ const server = withVerdict(reason)+ server.status = { conditions: [{ type: 'SecretResolved', status, reason }] }+ expect(runtimeDesired(server)).toBe(false)+ }+ }+ )+it('recovers when the reference is removed despite a stale negative condition', () => {const server = withVerdict('SecretNotFound')expect(runtimeDesired(server)).toBe(false)diff --git a/host-context-controller/src/mcpServerSafety.ts b/host-context-controller/src/mcpServerSafety.tsindex 633f6b87d..1c6e0b399 100644--- a/host-context-controller/src/mcpServerSafety.ts+++ b/host-context-controller/src/mcpServerSafety.ts@@ -111,6 +111,9 @@ export function runtimeDesired(server: McpServerCRD): boolean {if (server.spec.enabled === false) return falseif (server.spec.managed === false || !server.spec.envSecret) return trueconst condition = server.status?.conditions?.find(item => item.type === 'SecretResolved')+ // The runtime owner publishes False with a validation failure reason and+ // True with SecretFound. Share its reason-based fail-closed predicate: a+ // contradictory status must not override a known validation failure.return !shouldFailClosedForSecretFailure(condition?.reason)}diff --git a/scripts/minikube/t2.sh b/scripts/minikube/t2.shindex 365afc806..336c03879 100755--- a/scripts/minikube/t2.sh+++ b/scripts/minikube/t2.sh@@ -395,6 +395,9 @@ run_healthcheck_if_requested() {t2_evidence_write Health NOT_RUN 'no profile-owned user-facing health command was supplied'return 0fi+ # Export the already-validated shell value to the child; the CLI argument+ # intentionally expands that same existing value before the assignment.+ # shellcheck disable=SC2097,SC2098T2_HEALTHCHECK_KILL_GRACE_SECONDS="$T2_HEALTHCHECK_KILL_GRACE_SECONDS" \node "$T2_DEADLINE_RUNNER" \--timeout-seconds "$T2_HEALTHCHECK_TIMEOUT_SECONDS" \diff --git a/scripts/tests/test-hcc-lifecycle-cleanup.sh b/scripts/tests/test-hcc-lifecycle-cleanup.shindex b3e82d742..09caab93e 100755--- a/scripts/tests/test-hcc-lifecycle-cleanup.sh+++ b/scripts/tests/test-hcc-lifecycle-cleanup.sh@@ -145,8 +145,10 @@ if [[ "${SIGNAL_AT_CLEANUP_HANDOFF:-0}" = 1 ]]; then# explicitly makes DEBUG observable even where Bash suppresses it in EXIT.set -THANDOFF_ARMED=1- HANDOFF_PARENT=$BASHPID- trap 'if [[ "$HANDOFF_ARMED" = 1 && "$BASH_COMMAND" = "trap - EXIT" ]] && { [[ "$HANDOFF_TARGET" = parent && "$BASHPID" = "$HANDOFF_PARENT" ]] || [[ "$HANDOFF_TARGET" = helper && "$BASHPID" != "$HANDOFF_PARENT" ]]; }; then HANDOFF_ARMED=0; echo "handoff-injected:$HANDOFF_TARGET" >> "$TRACE"; kill -TERM "$BASHPID"; fi' DEBUG+ # BASH_SUBSHELL also exists in macOS Bash 3.2. Signal the current shell+ # via a direct child so the helper receives TERM, not the top-level $$ PID.+ HANDOFF_PARENT=$BASH_SUBSHELL+ trap 'if [[ "$HANDOFF_ARMED" = 1 && "$BASH_COMMAND" = "trap - EXIT" ]] && { [[ "$HANDOFF_TARGET" = parent && "$BASH_SUBSHELL" = "$HANDOFF_PARENT" ]] || [[ "$HANDOFF_TARGET" = helper && "$BASH_SUBSHELL" != "$HANDOFF_PARENT" ]]; }; then HANDOFF_ARMED=0; echo "handoff-injected:$HANDOFF_TARGET" >> "$TRACE"; python3 -c "import os, signal; os.kill(os.getppid(), signal.SIGTERM)"; fi' DEBUGset +estatus_before_cleanup() { return "$DIRECT_EXIT"; }status_before_cleanup