Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(deploy): isolate Codex LLM proxy
Alfredo Lopez962fabb4864d
diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.ymlindex 92a3996fc..578b6c987 100644--- a/.github/workflows/build-publish.yml+++ b/.github/workflows/build-publish.yml@@ -83,6 +83,7 @@ jobs:mock-stdio-mcp-server: ${{ steps.filter.outputs.mock-stdio-mcp-server }}webhook-gateway: ${{ steps.filter.outputs.webhook-gateway }}webhook-proxy: ${{ steps.filter.outputs.webhook-proxy }}+ codex-llm-proxy: ${{ steps.filter.outputs.codex-llm-proxy }}steps:- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4with:@@ -123,6 +124,7 @@ jobs:- 'packages/workflow-recipe-capability-policy/**'- 'packages/image-policy/**'- 'packages/display-field/**'+ - 'packages/llm-provider-attempt-contract/**'control-ui:- 'control-ui/**'- 'packages/workflow-recipe-capability-policy/**'@@ -136,6 +138,7 @@ jobs:- 'packages/network-policy-core/**'mcp-host:- 'mcp-host/**'+ - 'packages/llm-provider-attempt-contract/**'mcp-proxy:- 'mcp-proxy/**'gfs-controller:@@ -174,6 +177,9 @@ jobs:- 'webhook-gateway/**'webhook-proxy:- 'webhook-proxy/**'+ codex-llm-proxy:+ - 'codex-llm-proxy/**'+ - 'packages/llm-provider-attempt-contract/**'build-push:name: Build & push (${{ matrix.image }}-${{ matrix.arch }})@@ -228,6 +234,7 @@ jobs:- mock-stdio-mcp-server- webhook-gateway- webhook-proxy+ - codex-llm-proxyinclude:- image: channel-readerpath: channel-reader@@ -330,6 +337,10 @@ jobs:- image: webhook-proxypath: webhook-proxychanged: ${{ needs.detect.outputs.webhook-proxy }}+ - image: codex-llm-proxy+ path: codex-llm-proxy+ rooted: true+ changed: ${{ needs.detect.outputs.codex-llm-proxy }}steps:- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4if: ${{ matrix.changed == 'true' || needs.detect.outputs.force_all == 'true' }}@@ -501,6 +512,8 @@ jobs:changed: ${{ needs.detect.outputs.webhook-gateway }}- image: webhook-proxychanged: ${{ needs.detect.outputs.webhook-proxy }}+ - image: codex-llm-proxy+ changed: ${{ needs.detect.outputs.codex-llm-proxy }}steps:- name: Set up Docker Buildxif: ${{ matrix.changed == 'true' || needs.detect.outputs.force_all == 'true' }}diff --git a/codex-llm-proxy/Dockerfile b/codex-llm-proxy/Dockerfileindex 5d15b4d00..cfa0e53b3 100644--- a/codex-llm-proxy/Dockerfile+++ b/codex-llm-proxy/Dockerfile@@ -1,18 +1,24 @@+# BUILD CONTEXT = repo root. The proxy consumes+# @clerum/llm-provider-attempt-contract via file:.FROM node:24.16.0-alpine@sha256:21f403ab171f2dc89bad4dd69d7721bfd15f084ccb46cdd225f31f2bc59b5c9a AS builderWORKDIR /app-COPY package*.json ./+COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contract+COPY codex-llm-proxy/package*.json ./codex-llm-proxy/+WORKDIR /app/codex-llm-proxyRUN npm ci-COPY tsconfig.json tsconfig.build.json ./-COPY src ./src+COPY codex-llm-proxy/tsconfig.json codex-llm-proxy/tsconfig.build.json ./+COPY codex-llm-proxy/src ./srcRUN npm run buildFROM node:24.16.0-alpine@sha256:21f403ab171f2dc89bad4dd69d7721bfd15f084ccb46cdd225f31f2bc59b5c9aWORKDIR /app-COPY package*.json ./+COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contract+COPY codex-llm-proxy/package*.json ./codex-llm-proxy/+WORKDIR /app/codex-llm-proxyRUN npm ci --only=production-COPY --from=builder /app/dist ./dist+COPY --from=builder /app/codex-llm-proxy/dist ./distRUN addgroup -g 1001 -S nodejs && \adduser -S nodejs -u 1001diff --git a/control-api/Dockerfile b/control-api/Dockerfileindex c02a510b5..7744ab58d 100644--- a/control-api/Dockerfile+++ b/control-api/Dockerfile@@ -11,6 +11,7 @@ COPY packages/llm-providers ./packages/llm-providers# before control-api's npm ci so its file: dependency resolves; resourceFieldValidation# imports validateDisplayField from it.COPY packages/display-field ./packages/display-field+COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contract# Build the shared @clerum/workflow-runtime-core package (TS → dist) BEFORE# control-api's npm ci, so its file: dependency on it resolves with the compileddiff --git a/deploy/base/control-plane/codex-llm-proxy.yaml b/deploy/base/control-plane/codex-llm-proxy.yamlnew file mode 100644index 000000000..71e3abb29--- /dev/null+++ b/deploy/base/control-plane/codex-llm-proxy.yaml@@ -0,0 +1,144 @@+apiVersion: v1+kind: ServiceAccount+metadata:+ name: codex-llm-proxy+ namespace: control-plane+ labels:+ app: codex-llm-proxy+automountServiceAccountToken: false+---+apiVersion: v1+kind: ConfigMap+metadata:+ name: codex-llm-proxy-config+ namespace: control-plane+ labels:+ app: codex-llm-proxy+data:+ CODEX_LLM_PROXY_RUNTIME_PORT: "8080"+ CODEX_LLM_PROXY_ADMIN_PORT: "8081"+ CODEX_LLM_PROXY_PROBE_PORT: "9090"+ CODEX_LLM_PROXY_MAX_BODY_BYTES: "1048576"+ CODEX_LLM_PROXY_MAX_STREAM_DURATION_MS: "300000"+ CODEX_LLM_PROXY_MAX_DEADLINE_MS: "300000"+ CODEX_LLM_PROXY_JWT_ISSUER: control-api+ CODEX_LLM_PROXY_EXECUTION_ENABLED: "false"+ CODEX_LLM_PROXY_CONTROL_API_URL: http://control-api-rpc-gateway.control-plane.svc.cluster.local:8090/api/v1+ CODEX_LLM_PROXY_CONTROL_API_SERVICE: codex-llm-proxy+---+apiVersion: apps/v1+kind: Deployment+metadata:+ name: codex-llm-proxy+ namespace: control-plane+ labels:+ app: codex-llm-proxy+spec:+ replicas: 1+ revisionHistoryLimit: 3+ selector:+ matchLabels:+ app: codex-llm-proxy+ strategy:+ type: RollingUpdate+ rollingUpdate:+ maxSurge: 1+ maxUnavailable: 0+ template:+ metadata:+ labels:+ app: codex-llm-proxy+ spec:+ serviceAccountName: codex-llm-proxy+ automountServiceAccountToken: false+ terminationGracePeriodSeconds: 30+ securityContext:+ runAsNonRoot: true+ seccompProfile:+ type: RuntimeDefault+ containers:+ - name: codex-llm-proxy+ image: clerum/codex-llm-proxy:0.1.0+ imagePullPolicy: IfNotPresent+ envFrom:+ - configMapRef:+ name: codex-llm-proxy-config+ env:+ - name: CODEX_LLM_PROXY_JWT_PUBLIC_KEY+ valueFrom:+ configMapKeyRef:+ name: control-api-public-key+ key: CONTROL_API_PUBLIC_KEY_PEM+ - name: CODEX_LLM_PROXY_CONTROL_API_TOKEN+ valueFrom:+ secretKeyRef:+ name: codex-llm-proxy-secrets+ key: CODEX_LLM_PROXY_CONTROL_API_TOKEN+ ports:+ - name: runtime+ containerPort: 8080+ protocol: TCP+ - name: admin+ containerPort: 8081+ protocol: TCP+ - name: metrics+ containerPort: 9090+ protocol: TCP+ readinessProbe:+ httpGet: { path: /readyz, port: metrics }+ initialDelaySeconds: 4+ periodSeconds: 8+ timeoutSeconds: 2+ livenessProbe:+ httpGet: { path: /healthz, port: metrics }+ initialDelaySeconds: 8+ periodSeconds: 12+ timeoutSeconds: 2+ resources:+ requests:+ cpu: 50m+ memory: 64Mi+ limits:+ cpu: 250m+ memory: 256Mi+ securityContext:+ allowPrivilegeEscalation: false+ readOnlyRootFilesystem: true+ runAsNonRoot: true+ runAsUser: 1001+ runAsGroup: 1001+ seccompProfile:+ type: RuntimeDefault+ capabilities:+ drop: [ALL]+ volumeMounts:+ - name: tmp+ mountPath: /tmp+ volumes:+ - name: tmp+ emptyDir: {}+---+apiVersion: v1+kind: Service+metadata:+ name: codex-llm-proxy+ namespace: control-plane+ labels:+ app: codex-llm-proxy+spec:+ type: ClusterIP+ selector:+ app: codex-llm-proxy+ ports:+ - name: runtime+ port: 8080+ protocol: TCP+ targetPort: runtime+ - name: admin+ port: 8081+ protocol: TCP+ targetPort: admin+ - name: metrics+ port: 9090+ protocol: TCP+ targetPort: metricsdiff --git a/deploy/base/control-plane/configmaps.yaml b/deploy/base/control-plane/configmaps.yamlindex d236d3cee..6e7096951 100644--- a/deploy/base/control-plane/configmaps.yaml+++ b/deploy/base/control-plane/configmaps.yaml@@ -23,6 +23,8 @@ data:CONTROL_API_ADMIN_JWT_ISSUER: control-apiCONTROL_API_ADMIN_JWT_AUDIENCE: control-uiCONTROL_API_ADMIN_JWT_TTL_SECONDS: '3600'+ CONTROL_API_CODEX_SUBSCRIPTION_ENABLED: 'false'+ CODEX_LLM_PROXY_ADMIN_URL: http://codex-llm-proxy.control-plane.svc.cluster.local:8081CONTROL_API_ADMIN_BOOTSTRAP_USERNAME: adminCONTROL_API_ADMIN_BOOTSTRAP_EMAIL: ''CONTROL_API_ADMIN_AUTH_MAX_FAILURES: '5'@@ -236,6 +238,28 @@ data:proxy_set_header X-Forwarded-Proto $scheme;}+ location = /api/v1/internal/llm/provider-attempts/redeem {+ limit_except POST {+ deny all;+ }+ proxy_pass http://control_api_upstream;+ proxy_set_header Host $host;+ proxy_set_header X-Real-IP $remote_addr;+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;+ proxy_set_header X-Forwarded-Proto $scheme;+ }++ location = /api/v1/internal/llm/provider-attempts/finalize {+ limit_except POST {+ deny all;+ }+ proxy_pass http://control_api_upstream;+ proxy_set_header Host $host;+ proxy_set_header X-Real-IP $remote_addr;+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;+ proxy_set_header X-Forwarded-Proto $scheme;+ }+location / {return 403;}@@ -657,6 +681,18 @@ data:proxy_set_header Authorization $http_authorization;}+ location = /api/v1/mcp-host/llm/provider-attempts/authorize {+ limit_except POST {+ deny all;+ }+ proxy_pass http://control_api_upstream;+ proxy_set_header Host $host;+ proxy_set_header X-Real-IP $remote_addr;+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;+ proxy_set_header X-Forwarded-Proto $scheme;+ proxy_set_header Authorization $http_authorization;+ }+# ── Workflow broker runtime endpoints ──location = /api/v1/workflows {diff --git a/deploy/base/control-plane/kustomization.yaml b/deploy/base/control-plane/kustomization.yamlindex 82fbff614..5b1cd8308 100644--- a/deploy/base/control-plane/kustomization.yaml+++ b/deploy/base/control-plane/kustomization.yaml@@ -12,6 +12,7 @@ resources:- trace-maintenance-worker.yaml- trace-postgres-runtime-secrets.yaml- configmaps.yaml+ - codex-llm-proxy.yaml# Empty-by-design Secrets. Populated out-of-band by# `deploy/scripts/apply-inter-service-tokens.sh` (kubectl patch) BEFORE# `kubectl apply -k` runs. Declared in base so every overlay gets thediff --git a/deploy/base/control-plane/secrets-canary.yaml b/deploy/base/control-plane/secrets-canary.yamlindex 6bdcda1ce..440b598bd 100644--- a/deploy/base/control-plane/secrets-canary.yaml+++ b/deploy/base/control-plane/secrets-canary.yaml@@ -32,6 +32,18 @@ stringData: {}---apiVersion: v1kind: Secret+metadata:+ name: codex-llm-proxy-secrets+ namespace: control-plane+ labels:+ app: codex-llm-proxy+type: Opaque+# Populated keys (via kubectl patch, NOT kubectl apply):+# CODEX_LLM_PROXY_CONTROL_API_TOKEN — dedicated redeem/finalize token+stringData: {}+---+apiVersion: v1+kind: Secretmetadata:name: internal-control-jwt-secretsnamespace: control-planediff --git a/deploy/components/ghcr-images/kustomization.yaml b/deploy/components/ghcr-images/kustomization.yamlindex bf57995db..fc705934f 100644--- a/deploy/components/ghcr-images/kustomization.yaml+++ b/deploy/components/ghcr-images/kustomization.yaml@@ -98,3 +98,6 @@ images:- name: clerum/webhook-proxynewName: ghcr.io/evenfire-ai/webhook-proxynewTag: v0.7.0+ - name: clerum/codex-llm-proxy+ newName: ghcr.io/evenfire-ai/codex-llm-proxy+ newTag: v0.7.0diff --git a/deploy/images.json b/deploy/images.jsonindex 9fa603a75..ee8332590 100644--- a/deploy/images.json+++ b/deploy/images.json@@ -23,7 +23,8 @@"packages/workflow-runtime-core/**","packages/workflow-recipe-capability-policy/**","packages/image-policy/**",- "packages/display-field/**"+ "packages/display-field/**",+ "packages/llm-provider-attempt-contract/**"],"published": true,"deployed_to_minikube": true@@ -64,7 +65,7 @@"name": "mcp-host","path": "mcp-host","rooted": true,- "source_paths": ["mcp-host/**"],+ "source_paths": ["mcp-host/**", "packages/llm-provider-attempt-contract/**"],"published": true,"deployed_to_minikube": true},@@ -73,7 +74,7 @@"path": "mcp-host","dockerfile": "Dockerfile.slim","rooted": true,- "source_paths": ["mcp-host/**"],+ "source_paths": ["mcp-host/**", "packages/llm-provider-attempt-contract/**"],"published": true,"deployed_to_minikube": true},@@ -82,7 +83,7 @@"path": "mcp-host","dockerfile": "Dockerfile.full","rooted": true,- "source_paths": ["mcp-host/**"],+ "source_paths": ["mcp-host/**", "packages/llm-provider-attempt-contract/**"],"published": true,"deployed_to_minikube": true},@@ -91,7 +92,7 @@"path": "mcp-host","dockerfile": "Dockerfile.desktop","rooted": true,- "source_paths": ["mcp-host/**"],+ "source_paths": ["mcp-host/**", "packages/llm-provider-attempt-contract/**"],"published": true,"deployed_to_minikube": false},@@ -266,6 +267,17 @@"published": true,"deployed_to_minikube": true},+ {+ "name": "codex-llm-proxy",+ "path": "codex-llm-proxy",+ "rooted": true,+ "source_paths": [+ "codex-llm-proxy/**",+ "packages/llm-provider-attempt-contract/**"+ ],+ "published": true,+ "deployed_to_minikube": true+ },{"name": "workflow-custom-sdk-e2e","path": "tests/e2e/fixtures/custom-workflow-coordinator",diff --git a/deploy/overlays/minikube/kustomization.yaml b/deploy/overlays/minikube/kustomization.yamlindex c20b09cb9..1a241eeda 100644--- a/deploy/overlays/minikube/kustomization.yaml+++ b/deploy/overlays/minikube/kustomization.yaml@@ -65,6 +65,8 @@ images:newTag: test- name: clerum/webhook-proxynewTag: test+ - name: clerum/codex-llm-proxy+ newTag: test- name: clerum/webhook-gatewaynewTag: test- name: clerum/stdio-bridgediff --git a/deploy/scripts/apply-inter-service-tokens.sh b/deploy/scripts/apply-inter-service-tokens.shindex 8f368cfe1..262d550d0 100755--- a/deploy/scripts/apply-inter-service-tokens.sh+++ b/deploy/scripts/apply-inter-service-tokens.sh@@ -181,6 +181,8 @@ TOKEN_WEBHOOK_PROXY="$(resolve_token CONTROL_API_INTERNAL_TOKEN_WEBHOOK_PROXY \webhook-ingress webhook-proxy-secrets WEBHOOK_PROXY_CONTROL_API_SERVICE_TOKEN)"TOKEN_WA_READER="$(resolve_token CONTROL_API_INTERNAL_TOKEN_WA_READER \channels workflow-approval-request-reader-credentials control-api-token)"+TOKEN_CODEX_LLM_PROXY="$(resolve_token CONTROL_API_INTERNAL_TOKEN_CODEX_LLM_PROXY \+ control-plane codex-llm-proxy-secrets CODEX_LLM_PROXY_CONTROL_API_TOKEN)"READER_HANDOFF_TOKEN_VALUE="$(resolve_token CHANNEL_READER_HANDOFF_TOKEN \channels workflow-approval-request-reader-credentials channel-reader-handoff-token)"INTERNAL_CONTROL_WRC_HMAC="$(resolve_token INTERNAL_CONTROL_JWT_WRC_HMAC_SECRET \@@ -194,6 +196,7 @@ for pair in \"RPC:$TOKEN_RPC" \"WEBHOOK_PROXY:$TOKEN_WEBHOOK_PROXY" \"WA_READER:$TOKEN_WA_READER" \+ "CODEX_LLM_PROXY:$TOKEN_CODEX_LLM_PROXY" \"CHANNEL_READER_HANDOFF:$READER_HANDOFF_TOKEN_VALUE" \"INTERNAL_CONTROL_WRC_HMAC:$INTERNAL_CONTROL_WRC_HMAC" \"INTERNAL_CONTROL_HCC_HMAC:$INTERNAL_CONTROL_HCC_HMAC" \@@ -203,8 +206,8 @@ for pair in \[ -n "$val" ] || die "token $name resolved to empty — refusing to patch"done-SERVICE_TOKENS_MAP="external-rest-api=${TOKEN_EXT_REST},rpc-proxy=${TOKEN_RPC},webhook-proxy=${TOKEN_WEBHOOK_PROXY},workflow-approval-reader=${TOKEN_WA_READER}"-INTERNAL_TOKENS_LIST="${TOKEN_EXT_REST},${TOKEN_RPC},${TOKEN_WEBHOOK_PROXY},${TOKEN_WA_READER}"+SERVICE_TOKENS_MAP="external-rest-api=${TOKEN_EXT_REST},rpc-proxy=${TOKEN_RPC},webhook-proxy=${TOKEN_WEBHOOK_PROXY},workflow-approval-reader=${TOKEN_WA_READER},codex-llm-proxy=${TOKEN_CODEX_LLM_PROXY}"+INTERNAL_TOKENS_LIST="${TOKEN_EXT_REST},${TOKEN_RPC},${TOKEN_WEBHOOK_PROXY},${TOKEN_WA_READER},${TOKEN_CODEX_LLM_PROXY}"# --- 1. control-api-internal-tokens (control-plane) ---log "Patching Secret control-api-internal-tokens (control-plane)"@@ -279,6 +282,15 @@ WEBHOOK_PROXY_PATCH="$(jq -cn --arg t "$TOKEN_WEBHOOK_PROXY" \'{stringData: {WEBHOOK_PROXY_CONTROL_API_SERVICE_TOKEN: $t}}')"kctl -n webhook-ingress patch secret webhook-proxy-secrets --type=merge -p "$WEBHOOK_PROXY_PATCH"+# --- 4d. codex-llm-proxy-secrets (control-plane) ---+# Dedicated service token only. The proxy never receives the full+# CONTROL_API_INTERNAL_SERVICE_TOKENS map.+log "Patching Secret codex-llm-proxy-secrets (control-plane)"+ensure_secret control-plane codex-llm-proxy-secrets+CODEX_LLM_PROXY_PATCH="$(jq -cn --arg t "$TOKEN_CODEX_LLM_PROXY" \+ '{stringData: {CODEX_LLM_PROXY_CONTROL_API_TOKEN: $t}}')"+kctl -n control-plane patch secret codex-llm-proxy-secrets --type=merge -p "$CODEX_LLM_PROXY_PATCH"+# --- 4c. workflow-approval-request-reader-credentials (channels) ---# Figure D cross-bot fix (PR1): the reader uses this token to authenticate its# consulta call to control-api@@ -297,7 +309,8 @@ kctl -n channels patch secret workflow-approval-request-reader-credentials --typ# Roll the consumers so they pick up the fresh tokens on first deploy. Safe# no-ops if the Deployments do not yet exist.-for pair in "control-plane:control-api" \+for pair in "control-plane:control-api" \+ "control-plane:codex-llm-proxy" \"control-plane:workflow-recipes" \"control-plane:host-context-controller" \"profiles:external-rest-api" \diff --git a/mcp-host/Dockerfile b/mcp-host/Dockerfileindex 81cb0dc54..c0f56c6bd 100644--- a/mcp-host/Dockerfile+++ b/mcp-host/Dockerfile@@ -14,6 +14,7 @@ WORKDIR /app# Shared prebuilt data-only package (no build step — ships index.cjs + .d.ts).COPY packages/llm-providers ./packages/llm-providers+COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contract# Install dependencies (file: dep resolves to ../packages/llm-providers)COPY mcp-host/package*.json ./mcp-host/@@ -34,6 +35,7 @@ WORKDIR /app# Copy the shared package + package files, install production dependencies onlyCOPY packages/llm-providers ./packages/llm-providers+COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contractCOPY mcp-host/package*.json ./mcp-host/WORKDIR /app/mcp-hostRUN npm ci --only=productiondiff --git a/mcp-host/Dockerfile.desktop b/mcp-host/Dockerfile.desktopindex 5f8420fbf..378a4b7b3 100644--- a/mcp-host/Dockerfile.desktop+++ b/mcp-host/Dockerfile.desktop@@ -5,6 +5,7 @@FROM node:24.16.0-alpine@sha256:21f403ab171f2dc89bad4dd69d7721bfd15f084ccb46cdd225f31f2bc59b5c9a AS builderWORKDIR /appCOPY packages/llm-providers ./packages/llm-providers+COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contractCOPY mcp-host/package*.json ./mcp-host/WORKDIR /app/mcp-hostRUN npm ci@@ -45,6 +46,7 @@ ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1# ../packages/llm-providers resolves, mirroring the other variants).WORKDIR /appCOPY packages/llm-providers ./packages/llm-providers+COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contractCOPY --from=builder /app/mcp-host/package*.json ./mcp-host/WORKDIR /app/mcp-hostRUN npm ci --omit=devdiff --git a/mcp-host/Dockerfile.full b/mcp-host/Dockerfile.fullindex 157f344dc..337b598f6 100644--- a/mcp-host/Dockerfile.full+++ b/mcp-host/Dockerfile.full@@ -12,6 +12,7 @@ WORKDIR /app# Shared prebuilt data-only package (no build step — ships index.cjs + .d.ts).COPY packages/llm-providers ./packages/llm-providers+COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contract# Install dependencies (file: dep resolves to ../packages/llm-providers)COPY mcp-host/package*.json ./mcp-host/@@ -42,6 +43,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \# Copy the shared package + package files, install production dependencies onlyCOPY packages/llm-providers ./packages/llm-providers+COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contractCOPY mcp-host/package*.json ./mcp-host/WORKDIR /app/mcp-hostRUN npm ci --only=productiondiff --git a/mcp-host/Dockerfile.slim b/mcp-host/Dockerfile.slimindex ccfa22774..78e0d6904 100644--- a/mcp-host/Dockerfile.slim+++ b/mcp-host/Dockerfile.slim@@ -12,6 +12,7 @@ WORKDIR /app# Shared prebuilt data-only package (no build step — ships index.cjs + .d.ts).COPY packages/llm-providers ./packages/llm-providers+COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contract# Install dependencies (file: dep resolves to ../packages/llm-providers)COPY mcp-host/package*.json ./mcp-host/@@ -45,6 +46,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \# Copy the shared package + package files, install production dependencies onlyCOPY packages/llm-providers ./packages/llm-providers+COPY packages/llm-provider-attempt-contract ./packages/llm-provider-attempt-contractCOPY mcp-host/package*.json ./mcp-host/WORKDIR /app/mcp-hostRUN npm ci --only=productiondiff --git a/scripts/minikube/build-images.sh b/scripts/minikube/build-images.shindex 21c191af1..8eeb8954d 100755--- a/scripts/minikube/build-images.sh+++ b/scripts/minikube/build-images.sh@@ -378,6 +378,7 @@ ALL_IMAGES=("clerum/external-rest-api:test""clerum/rpc-proxy:test""clerum/webhook-proxy:test"+ "clerum/codex-llm-proxy:test""clerum/webhook-gateway:test""clerum/channel-reader:test""clerum/workflow-approval-request-reader:test"@@ -759,6 +760,11 @@ build_image "webhook-proxy" \"${PROJECT_DIR}/webhook-proxy" \"clerum/webhook-proxy:test"+build_image "codex-llm-proxy" \+ "${PROJECT_DIR}" \+ "clerum/codex-llm-proxy:test" \+ "${PROJECT_DIR}/codex-llm-proxy/Dockerfile"+build_image "webhook-gateway" \"${PROJECT_DIR}/webhook-gateway" \"clerum/webhook-gateway:test"diff --git a/scripts/minikube/pre-gate-incremental.sh b/scripts/minikube/pre-gate-incremental.shindex a8e20094b..4155e889a 100755--- a/scripts/minikube/pre-gate-incremental.sh+++ b/scripts/minikube/pre-gate-incremental.sh@@ -167,6 +167,7 @@ incremental_classify_path() {;;profile-ui/*) incremental_add_target profile-ui profiles profile-ui ;;webhook-proxy/*) incremental_add_target webhook-proxy webhook-ingress webhook-proxy ;;+ codex-llm-proxy/*) incremental_add_target codex-llm-proxy control-plane codex-llm-proxy ;;tests/e2e/fixtures/workflow-plugin-sdk-e2e/*)incremental_add_target workflow-plugin-sdk-e2e sandbox-recipes workflow-plugin-sdk-e2e;;diff --git a/scripts/tests/test-codex-llm-proxy-deploy-contract.sh b/scripts/tests/test-codex-llm-proxy-deploy-contract.shnew file mode 100755index 000000000..0f4e7d356--- /dev/null+++ b/scripts/tests/test-codex-llm-proxy-deploy-contract.sh@@ -0,0 +1,134 @@+#!/usr/bin/env bash+set -euo pipefail++ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"+FAIL=0+pass() { echo "PASS: $1"; }+fail() { echo "FAIL: $1"; FAIL=1; }++MANIFEST="$ROOT/deploy/base/control-plane/codex-llm-proxy.yaml"+KUSTOMIZE="$ROOT/deploy/base/control-plane/kustomization.yaml"+CONFIGMAPS="$ROOT/deploy/base/control-plane/configmaps.yaml"+RBAC="$ROOT/deploy/base/control-plane/rbac.yaml"+TOKENS="$ROOT/deploy/scripts/apply-inter-service-tokens.sh"+IMAGES="$ROOT/deploy/images.json"+BUILD_IMAGES="$ROOT/scripts/minikube/build-images.sh"+WORKFLOW="$ROOT/.github/workflows/build-publish.yml"+GHCR="$ROOT/deploy/components/ghcr-images/kustomization.yaml"+MINIKUBE="$ROOT/deploy/overlays/minikube/kustomization.yaml"++if [[ ! -f "$MANIFEST" ]]; then+ fail "missing $MANIFEST"+ exit 1+fi++python3 - "$MANIFEST" "$KUSTOMIZE" "$CONFIGMAPS" "$RBAC" "$TOKENS" "$IMAGES" "$BUILD_IMAGES" "$WORKFLOW" "$GHCR" "$MINIKUBE" <<'PY'+import json, pathlib, re, sys++manifest, kustomize, configmaps, rbac, tokens, images, build_images, workflow, ghcr, minikube = map(pathlib.Path, sys.argv[1:])+errors = []++text = manifest.read_text()+for needle in (+ "kind: Deployment",+ "kind: Service",+ "kind: ServiceAccount",+ "name: codex-llm-proxy",+ "automountServiceAccountToken: false",+ "type: ClusterIP",+ "name: runtime",+ "name: admin",+ "name: metrics",+ "readOnlyRootFilesystem: true",+ "runAsNonRoot: true",+ "type: RuntimeDefault",+ "drop: [ALL]",+ "CODEX_LLM_PROXY_JWT_PUBLIC_KEY",+ "CODEX_LLM_PROXY_CONTROL_API_TOKEN",+ "CODEX_LLM_PROXY_EXECUTION_ENABLED",+ "control-api-rpc-gateway.control-plane.svc",+):+ if needle not in text:+ errors.append(f"manifest missing {needle}")++if "kind: Role" in text or "kind: RoleBinding" in text:+ errors.append("proxy manifest must not declare Role/RoleBinding")+if "type: LoadBalancer" in text or "type: NodePort" in text:+ errors.append("proxy Service must stay ClusterIP")++if "codex-llm-proxy.yaml" not in kustomize.read_text():+ errors.append("kustomization does not include codex-llm-proxy.yaml")++rbac_text = rbac.read_text()+if re.search(r"name:\s*codex-llm-proxy", rbac_text):+ errors.append("rbac.yaml must not grant the proxy a Role")++cm = configmaps.read_text()+if "location = /api/v1/mcp-host/llm/provider-attempts/authorize" not in cm:+ errors.append("workflow gateway missing exact authorize location")+if "location = /api/v1/internal/llm/provider-attempts/redeem" not in cm:+ errors.append("rpc gateway missing exact redeem location")+if "location = /api/v1/internal/llm/provider-attempts/finalize" not in cm:+ errors.append("rpc gateway missing exact finalize location")+if cm.count("location / {\n return 403;") < 2:+ errors.append("gateways must keep catch-all 403")+if "kind: Service" in cm and "codex-llm-gateway" in cm:+ errors.append("must not add a third gateway")++token_src = tokens.read_text()+if "codex-llm-proxy=${TOKEN_CODEX_LLM_PROXY}" not in token_src and "codex-llm-proxy=${TOKEN_CODEX" not in token_src:+ errors.append("apply-inter-service-tokens.sh must project a dedicated codex-llm-proxy token")+if "codex-llm-proxy-secrets" not in token_src:+ errors.append("proxy must receive only its dedicated secret, not the full token map")++manifest_json = json.loads(images.read_text())+row = next((item for item in manifest_json["images"] if item["name"] == "codex-llm-proxy"), None)+if not row:+ errors.append("images.json missing codex-llm-proxy")+else:+ paths = row.get("source_paths") or []+ if "codex-llm-proxy/**" not in paths:+ errors.append("images.json must watch codex-llm-proxy/**")+ if "packages/llm-provider-attempt-contract/**" not in paths:+ errors.append("images.json must watch packages/llm-provider-attempt-contract/**")+ if row.get("published") is not True or row.get("deployed_to_minikube") is not True:+ errors.append("codex-llm-proxy must be published and deployed_to_minikube")++for consumer in ("control-api", "mcp-host", "mcp-host-slim", "mcp-host-full", "mcp-host-desktop"):+ item = next((entry for entry in manifest_json["images"] if entry["name"] == consumer), None)+ if not item:+ errors.append(f"images.json missing {consumer}")+ continue+ if "packages/llm-provider-attempt-contract/**" not in (item.get("source_paths") or []):+ errors.append(f"{consumer} source_paths must include packages/llm-provider-attempt-contract/**")++build = build_images.read_text()+if "clerum/codex-llm-proxy:test" not in build:+ errors.append("build-images.sh missing clerum/codex-llm-proxy:test")+if 'build_image "codex-llm-proxy"' not in build:+ errors.append("build-images.sh missing build_image codex-llm-proxy")++wf = workflow.read_text()+if "- image: codex-llm-proxy" not in wf:+ errors.append("build-publish.yml missing matrix image")+if "packages/llm-provider-attempt-contract/**" not in wf:+ errors.append("build-publish.yml filters must watch the attempt contract")++if "clerum/codex-llm-proxy" not in ghcr.read_text():+ errors.append("ghcr-images component missing rewrite")+if "clerum/codex-llm-proxy" not in minikube.read_text():+ errors.append("minikube overlay images: missing codex-llm-proxy")++if errors:+ print("\n".join(errors))+ sys.exit(1)+print("ok")+PY++if [[ $? -eq 0 ]]; then+ pass "codex-llm-proxy deploy contract"+else+ fail "codex-llm-proxy deploy contract"+fi++exit "$FAIL"diff --git a/scripts/tests/test-images-manifest.sh b/scripts/tests/test-images-manifest.shindex 77b50eccc..1e96d1dd0 100755--- a/scripts/tests/test-images-manifest.sh+++ b/scripts/tests/test-images-manifest.sh@@ -654,6 +654,93 @@ assert_display_field_change_rebuilds_both_consumers() {fi}+assert_llm_provider_attempt_contract_change_rebuilds_consumers() {+ local output rc+ output="$(node -e '+ import("'"$REPO_ROOT"'/scripts/release/images-manifest.mjs").then(async m => {+ const fs = await import("node:fs")+ const wfPath = "'"$REPO_ROOT"'/.github/workflows/build-publish.yml"+ const wf = fs.readFileSync(wfPath, "utf8")+ const sourcePath = "packages/llm-provider-attempt-contract/**"+ const expectedFilters = ["codex-llm-proxy", "control-api", "mcp-host"]+ const expectedImages = [+ "codex-llm-proxy",+ "control-api",+ "mcp-host",+ "mcp-host-desktop",+ "mcp-host-full",+ "mcp-host-slim",+ ]++ const filtersMatch = wf.match(/filters: \|\n([\s\S]*?)\n\n {2}build-push:/)+ if (!filtersMatch) {+ console.log(`PARSE_ERROR: could not find the paths-filter filters block in ${wfPath}`)+ process.exit(1)+ }+ const filters = {}+ let currentKey = null+ for (const line of filtersMatch[1].split("\n")) {+ if (!line.trim()) continue+ const keyMatch = line.match(/^\s*([\w.-]+):\s*$/)+ const pathMatch = line.match(/^\s*-\s*\x27([^\x27]+)\x27\s*$/)+ if (keyMatch) {+ currentKey = keyMatch[1]+ filters[currentKey] = []+ } else if (pathMatch && currentKey) {+ filters[currentKey].push(pathMatch[1])+ }+ }++ const sectionMatch = wf.match(/include:\n([\s\S]*?)\n {4}steps:/)+ if (!sectionMatch) {+ console.log(`PARSE_ERROR: could not find the build-push matrix section in ${wfPath}`)+ process.exit(1)+ }+ const imageFilterKeys = {}+ for (const block of sectionMatch[1].split(/\n(?=\s*- image:)/)) {+ const image = block.match(/- image:\s*(\S+)/)?.[1]+ if (!image) continue+ const changedKey = block.match(/\n\s*changed:\s*\$\{\{\s*needs\.detect\.outputs\.([\w.-]+)\s*\}\}/)?.[1]+ if (changedKey) imageFilterKeys[image] = changedKey+ }++ const problems = []+ const filterKeys = Object.entries(filters)+ .filter(([, paths]) => paths.includes(sourcePath))+ .map(([key]) => key)+ .sort()+ if (filterKeys.join(",") !== expectedFilters.join(",")) {+ problems.push(`filters are ${filterKeys.join(",") || "<none>"}, expected ${expectedFilters.join(",")}`)+ }+ const selectedImages = Object.entries(imageFilterKeys)+ .filter(([, filterKey]) => filterKeys.includes(filterKey))+ .map(([image]) => image)+ .sort()+ if (selectedImages.join(",") !== expectedImages.join(",")) {+ problems.push(`selected images are ${selectedImages.join(",") || "<none>"}, expected ${expectedImages.join(",")}`)+ }+ for (const name of expectedImages) {+ const image = m.IMAGES.find(item => item.name === name)+ if (!image) problems.push(`${name} has no manifest row`)+ else if (!image.source_paths?.includes(sourcePath)) {+ problems.push(`${name} does not mirror ${sourcePath} in source_paths`)+ }+ }+ console.log(problems.join("; "))+ }).catch(err => {+ console.log(`PARSE_ERROR: ${err.message}`)+ process.exit(1)+ })' 2>&1)"+ rc=$?+ if [ "$rc" -ne 0 ]; then+ fail "llm-provider-attempt-contract changed-path contract parse failed: $output"+ elif [ -z "$output" ]; then+ pass "a provider-attempt-contract change rebuilds Control API, mcp-host variants, and the proxy"+ else+ fail "llm-provider-attempt-contract changed-path contract failed: $output"+ fi+}+# THREE copies of the 28-image list exist in build-publish.yml, not two:# build-push's `image:` matrix dimension (the array that, crossed with# `arch`, produces the 56 base combinations), build-push's `include:` list@@ -1144,6 +1231,7 @@ assert_every_matrix_image_has_a_manifest_rowassert_source_paths_match_filtersassert_network_policy_core_change_rebuilds_all_consumersassert_display_field_change_rebuilds_both_consumers+assert_llm_provider_attempt_contract_change_rebuilds_consumersassert_all_three_image_lists_agreeassert_the_verify_set_splits_on_published_not_on_modeassert_the_default_ghcr_verify_set_omits_only_the_e2e_fixturesdiff --git a/scripts/tests/test-inter-service-tokens.sh b/scripts/tests/test-inter-service-tokens.shindex 824c2ecb1..82b109b97 100755--- a/scripts/tests/test-inter-service-tokens.sh+++ b/scripts/tests/test-inter-service-tokens.sh@@ -74,6 +74,7 @@ run_apply() {minikube_capture="$TMP/minikube-control-api-internal-tokens.json"run_apply clerum-codex-member-registration-test "$minikube_capture" envjq -e '.stringData.CONTROL_API_MEMBER_REGISTRATION_HMAC_SECRET and .stringData.CONTROL_API_INTERNAL_TOKENS and .stringData.CONTROL_API_INTERNAL_SERVICE_TOKENS' "$minikube_capture" >/dev/null+jq -e '.stringData.CONTROL_API_INTERNAL_SERVICE_TOKENS | contains("codex-llm-proxy=")' "$minikube_capture" >/dev/nullbranch_profile_capture="$TMP/branch-profile-control-api-internal-tokens.json"run_apply clerum-cursor-46f812cd-185fc31b "$branch_profile_capture" env