Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(hcc): collect finished Host execution jobs automatically

Alfredo Lopezac4b5ce145b2
diff --git a/host-context-controller/package-lock.json b/host-context-controller/package-lock.json
index 938e400a2..449526342 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.377",
+ "version": "0.1.378",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-host-context-controller",
- "version": "0.1.377",
+ "version": "0.1.378",
"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.json
index ef4a910fe..020d17edc 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.377",
+ "version": "0.1.378",
"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/hostExecution/jobFactory.test.ts b/host-context-controller/src/hostExecution/jobFactory.test.ts
index 9e7e3322e..0780c0fb3 100644
--- a/host-context-controller/src/hostExecution/jobFactory.test.ts
+++ b/host-context-controller/src/hostExecution/jobFactory.test.ts
@@ -145,6 +145,19 @@ function ownedPod(job: k8s.V1Job): k8s.V1Pod {
}
describe('bounded Host execution job factory', () => {
+ it('requests native collection of finished Jobs and their private input Pods without a caller', () => {
+ for (const request of [workspaceRequest, attachmentRequest]) {
+ const job = buildHostExecutionJob(identity, request)
+ // activeDeadlineSeconds stops work, but leaves terminated Pods and their
+ // input volumes behind unless the Kubernetes TTL controller collects
+ // the Job. A lost/disconnected caller must not retain those copies.
+ expect(job.spec!.ttlSecondsAfterFinished).toBe(0)
+ expect(job.spec!.activeDeadlineSeconds).toBeLessThanOrEqual(
+ Math.ceil(EXECUTION_TIMEOUT_MAX_MS / 1000) + 60
+ )
+ }
+ })
+
it('encodes one workspace Job under the Host owner with targetable labels', () => {
const job = buildHostExecutionJob(identity, workspaceRequest)
diff --git a/host-context-controller/src/hostExecution/jobFactory.ts b/host-context-controller/src/hostExecution/jobFactory.ts
index 1086c2259..5e01d6312 100644
--- a/host-context-controller/src/hostExecution/jobFactory.ts
+++ b/host-context-controller/src/hostExecution/jobFactory.ts
@@ -551,6 +551,10 @@ export function buildHostExecutionJob(
},
spec: {
backoffLimit: 0,
+ // A terminated Pod can retain the private input volume after a caller
+ // disconnects. Native Job TTL cleanup collects finished/deadline-failed
+ // Jobs and their dependent Pods; API absence still is not purge proof.
+ ttlSecondsAfterFinished: 0,
// Includes the bounded private-result delivery window. Command runtime
// itself is still limited by the launcher to the approved timeout.
activeDeadlineSeconds: Math.ceil(approved.timeoutMs / 1000) + 60,