Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(hcc): exclude routine renewal from rollout preparation
Alfredo Lopez8c3e646e3d31
diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.jsonindex ad07e3807..35ab630fe 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.380",+ "version": "0.1.381","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-host-context-controller",- "version": "0.1.380",+ "version": "0.1.381","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 264e3c7bd..6a9df9017 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.380",+ "version": "0.1.381","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 78fcce468..742d84f31 100644--- a/host-context-controller/src/hostReconciler.ts+++ b/host-context-controller/src/hostReconciler.ts@@ -2329,8 +2329,11 @@ export class HostReconciler {HostReconciler.bootstrapAppliedToDeployment(existing, deployment, existingRevision)const boundUid =existing?.metadata?.annotations?.[RUNTIME_TOKEN_BOOTSTRAP_DEPLOYMENT_UID_ANNOTATION]+ // A routine renewal can be consumed by a container restart without+ // changing the applied revision. Reuse only explicit rollout preparation.const usablePendingPreparation =bootstrapIsFresh &&+ existing?.metadata?.annotations?.[RUNTIME_TOKEN_ROLLOUT_REQUIRED_ANNOTATION] === 'true' &&!bootstrapApplied &&(!boundUid || boundUid === deployment?.metadata?.uid)if (resourcesWillChange) {diff --git a/host-context-controller/test/hostReconciler.lifecycle.test.ts b/host-context-controller/test/hostReconciler.lifecycle.test.tsindex 6eb6e8535..ef84ce9ea 100644--- a/host-context-controller/test/hostReconciler.lifecycle.test.ts+++ b/host-context-controller/test/hostReconciler.lifecycle.test.ts@@ -1110,6 +1110,58 @@ describe('HostReconciler resource rollout bootstrap', () => {expect(fixture.templateChanges()).toBe(1)})+ it.each([+ ['Host', false],+ ['Desktop', true],+ ] as const)(+ 'does not reuse a routine renewal for a new %s resource rollout',+ async (_kind, desktop) => {+ const fixture = await runtime({ desktop })+ const applied = fixture.deployment().spec!.template.metadata!.annotations![APPLIED_REVISION]+ vi.setSystemTime(+ Date.parse(+ fixture.secret().metadata!.annotations!['clerum.io/runtime-token-refresh-before']+ ) + 1+ )+ await fixture.reconcile()+ const renewed = fixture.secret().metadata!.annotations![SECRET_REVISION]+ expect(renewed).not.toBe(applied)+ expect(fixture.secret().metadata!.annotations![BOOTSTRAP]).toBe('fresh')+ expect(fixture.secret().metadata!.annotations![ROLLOUT]).toBe('false')+ expect(fixture.deployment().spec!.template.metadata!.annotations![APPLIED_REVISION]).toBe(+ applied+ )+ expect(fixture.templateChanges()).toBe(0)+ expect(issue).toHaveBeenCalledOnce()++ // A routine renewal may be consumed after a container restart without an+ // applied revision change. Its fresh record is not rollout preparation.+ fixture.events.length = 0+ const resources = desktop ? config.desktopResources : config.hostResources+ resources.requests.cpu = '25m'+ await fixture.reconcile()+ const prepared = fixture.secret().metadata!.annotations![SECRET_REVISION]+ expect(issue).toHaveBeenCalledTimes(2)+ expect(prepared).not.toBe(renewed)+ expect(fixture.events).toEqual(['issue', 'persist-secret', 'replace-deployment'])+ expect(fixture.deployment().spec!.template.metadata!.annotations![APPLIED_REVISION]).toBe(+ prepared+ )+ expect(fixture.secret().metadata!.annotations![ROLLOUT]).toBe('true')++ // The new preparation survives NotReady startup; it is not renewed on+ // every reconcile, and is acknowledged only after convergence.+ fixture.advance({ readyReplicas: 0, availableReplicas: 0, unavailableReplicas: 1 })+ for (let pass = 0; pass < 3; pass++) await fixture.reconcile()+ expect(issue).toHaveBeenCalledTimes(2)+ expect(fixture.templateChanges()).toBe(1)+ fixture.advance()+ await fixture.reconcile()+ expect(fixture.secret().metadata!.annotations![BOOTSTRAP]).toBe('consumed')+ expect(issue).toHaveBeenCalledTimes(2)+ }+ )+it('reuses an intrinsic renewal persisted before a failed resource replacement', async () => {const fixture = await runtime()vi.setSystemTime(