Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(hcc): roll mcp-host on guardrails changes via revision annotation
Andy Paviabc3a04abb8ba
diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.jsonindex f7a9bf6c5..d340287bc 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.jsonindex b82fa88ea..e0bf3e74e 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/hostReconciler.ts b/host-context-controller/src/hostReconciler.tsindex 4b06b2db0..a0fe92524 100644--- a/host-context-controller/src/hostReconciler.ts+++ b/host-context-controller/src/hostReconciler.ts@@ -194,6 +194,14 @@ export type ResolveContextMountsFn = (host: HostCRD) => Promise<ResolvedSfsMountconst CONTEXT_LABEL = 'clerum.io/context'const CONTEXT_MOUNT_PATH_PATTERN = /^\/[a-zA-Z0-9_.][a-zA-Z0-9_.\/-]*$/const RUNTIME_TOKEN_REVISION_ANNOTATION = 'clerum.io/runtime-token-revision'+// Rolls the mcp-host pod when Host.spec.guardrails changes. mcp-host reads the+// guardrails block (installed-hook refs, built-ins, limits) ONLY at boot, so an+// install/uninstall/upgrade of a hook — or any edit to the block — would+// otherwise not reach the running agent until the pod happened to restart.+// Stamping a hash of the guardrails spec onto the pod template makes any change+// flip the template → rolling restart → mcp-host re-reads guardrails at boot.+// Mirrors the runtime-token / credentials revision annotations.+const GUARDRAILS_REVISION_ANNOTATION = 'clerum.io/guardrails-revision'const RUNTIME_TOKEN_SECRET_REVISION_ANNOTATION = 'clerum.io/runtime-token-secret-revision'const RUNTIME_TOKEN_ISSUED_AT_ANNOTATION = 'clerum.io/runtime-token-issued-at'const RUNTIME_TOKEN_REFRESH_EXPIRES_AT_ANNOTATION = 'clerum.io/runtime-token-refresh-expires-at'@@ -2355,6 +2363,16 @@ export class HostReconciler {if (runtimeTokenRevision) {podAnnotations[RUNTIME_TOKEN_REVISION_ANNOTATION] = runtimeTokenRevision}+ // Roll the mcp-host pod whenever the guardrails block changes: mcp-host reads+ // Host.spec.guardrails only at boot, so without a pod-template diff an+ // installed-hook change never reaches the running agent. Stamp a hash of the+ // block — present→changed→removed all flip the template and trigger a rollout+ // (when guardrails is absent the annotation is simply omitted).+ if (host.spec.guardrails) {+ podAnnotations[GUARDRAILS_REVISION_ANNOTATION] = createHash('sha256')+ .update(canonicalStringify(host.spec.guardrails as unknown as Record<string, unknown>))+ .digest('hex')+ }// Security context — desktop needs runAsNonRoot: false for s6-overlay init,// which is fundamentally incompatible with the `restricted` PodSecurity