Skip to content

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

TypeScript

fix(minikube): refuse a restored Control API that keeps fixture storage

Alfredo Lopezc478976479ad
diff --git a/scripts/minikube/t2-common.sh b/scripts/minikube/t2-common.sh
index 9bea4a10f..9bbe1f03d 100755
--- a/scripts/minikube/t2-common.sh
+++ b/scripts/minikube/t2-common.sh
@@ -656,7 +656,7 @@ PY
# The planner may reconcile; certifying preflight requires the live baseline.
t2_restored_runtime_check() {
[ "$T2_PLAN_MODE" != true ] && [ "$T2_BOOTSTRAP_REQUIRED" != true ] || return 0
- local deployments="$1" service="$2" failure_code="$3" fixture_flags="$4" marker_file="$5"
+ local deployments="$1" service="$2" failure_code="$3" fixture_flags="$4" marker_file="$5" fixture_mounts="$6"
local pods inventory pod_names pod_name environment_check
if ! pods="$(t2_kc -n "$T2_CONTROL_NAMESPACE" get pods -l app="$service" -o json)"; then
t2_fail "$failure_code" "unable to observe running $service identity"
@@ -666,7 +666,7 @@ t2_restored_runtime_check() {
t2_fail "$failure_code" 'unable to observe profile image inventory'
return 1
fi
- if ! pod_names="$(python3 - "$T2_IMAGE_MANIFEST" "$T2_PROFILE" "$T2_CONTROL_NAMESPACE" "$deployments" "$pods" "$inventory" "$service" "$fixture_flags" <<'PY_RUNTIME'
+ if ! pod_names="$(python3 - "$T2_IMAGE_MANIFEST" "$T2_PROFILE" "$T2_CONTROL_NAMESPACE" "$deployments" "$pods" "$inventory" "$service" "$fixture_flags" "$fixture_mounts" <<'PY_RUNTIME'
import json
import re
import sys
@@ -674,6 +674,7 @@ from pathlib import Path
service = sys.argv[7]
fixture_flags = set(sys.argv[8].split())
+fixture_mounts = set(sys.argv[9].split())
def require(condition):
if not condition:
@@ -702,6 +703,13 @@ def clean(template):
for entry in container.get("env", []):
require(entry.get("name") not in fixture_flags)
require(entry.get("name") != "NODE_ENV" or entry.get("value") != "test")
+ # A fresh fixture emptyDir has no marker file, so the storage itself must
+ # be absent from the restored workload.
+ for volume in template["spec"].get("volumes") or []:
+ require(volume.get("name") != "approved-tools-oauth-tmp")
+ for mount in container.get("volumeMounts") or []:
+ require(mount.get("name") != "approved-tools-oauth-tmp")
+ require(mount.get("mountPath") not in fixture_mounts)
return container
try:
@@ -788,13 +796,13 @@ PY_RUNTIME
# Keep callers explicit about which production workload they certify.
t2_proxy_runtime_check() {
t2_restored_runtime_check "$1" codex-llm-proxy PROXY_RUNTIME_MISMATCH \
- 'CODEX_APPROVED_TOOLS_TEST_ONLY CODEX_APPROVED_TOOLS_MINIKUBE_PROFILE' ''
+ 'CODEX_APPROVED_TOOLS_TEST_ONLY CODEX_APPROVED_TOOLS_MINIKUBE_PROFILE' '' ''
}
t2_control_api_runtime_check() {
t2_restored_runtime_check "$1" control-api CONTROL_API_RUNTIME_MISMATCH \
'EVENFIRE_APPROVED_TOOLS_OAUTH_FIXTURE APPROVED_TOOLS_RUN_ID' \
- '/tmp/approved-tools-oauth-active.json'
+ '/tmp/approved-tools-oauth-active.json' '/tmp'
}
# An optional image-input fixture must never survive into a runtime verdict.
diff --git a/scripts/tests/test-minikube-t2-control-api-runtime.sh b/scripts/tests/test-minikube-t2-control-api-runtime.sh
index de1bd88a3..c2f76b159 100755
--- a/scripts/tests/test-minikube-t2-control-api-runtime.sh
+++ b/scripts/tests/test-minikube-t2-control-api-runtime.sh
@@ -84,6 +84,14 @@ if case == 'fixture-image-alias':
pod['spec']['containers'][0]['image'] = alias
manifest['images'][alias] = base
inventory[0]['repoTags'].append('docker.io/' + alias)
+# A5 fixture storage: a fresh emptyDir carries no marker file.
+if case == 'fixture-volume': template['spec']['volumes'] = [{'name': 'approved-tools-oauth-tmp', 'emptyDir': {}}]
+if case == 'fixture-tmp-mount': container['volumeMounts'] = [{'name': 'scratch', 'mountPath': '/tmp'}]
+if case == 'old-fixture-volume-pod': pod['spec']['volumes'] = [{'name': 'approved-tools-oauth-tmp', 'emptyDir': {}}]
+if case == 'unrelated-mount':
+ for spec in (template['spec'], pod['spec']):
+ spec['volumes'] = [{'name': 'config', 'configMap': {'name': 'control-api'}}]
+ spec['containers'][0]['volumeMounts'] = [{'name': 'config', 'mountPath': '/etc/control-api'}]
if case == 'wrong-id': status['imageID'] = 'docker://' + other
if case == 'unknown-id': status['imageID'] = 'unknown'
if case == 'missing-id': del status['imageID']
@@ -134,7 +142,7 @@ for name, data in [('manifest', manifest), ('deployments', {'items': [deployment
(root / (name + '.json')).write_text(json.dumps(data))
PY
}
-for scenario in restored ghcr completed-migration; do
+for scenario in restored ghcr completed-migration unrelated-mount; do
make_case "$scenario"
t2_deployment_check
t2_control_api_runtime_check "$T2_DEPLOYMENT_JSON"
@@ -143,7 +151,7 @@ done
# The contract checks literal shell source, not an expanded value.
# shellcheck disable=SC2016
grep -Fq 't2_control_api_runtime_check "$T2_DEPLOYMENT_JSON"' "$ROOT/scripts/minikube/t2-preflight.sh"
-for scenario in fixture-image fixture-image-alias fixture-env fixture-run-env fixture-node-env fixture-marker old-fixture-pod old-fixture-marker wrong-id unknown-id missing-id missing-baseline missing-api wrong-profile missing-pods missing-inventory unknown-repo-digest runtime-fixture runtime-run runtime-test runtime-marker runtime-unknown migration-only migration-insufficient-serving running-migration failed-migration unknown-migration unowned-migration noncontroller-migration nonjob-migration migration-wrong-serving-id migration-fixture-serving migration-running-container migration-failed-container migration-unknown-containers migration-running-init migration-unknown-owner-api; do
+for scenario in fixture-image fixture-image-alias fixture-volume fixture-tmp-mount old-fixture-volume-pod fixture-env fixture-run-env fixture-node-env fixture-marker old-fixture-pod old-fixture-marker wrong-id unknown-id missing-id missing-baseline missing-api wrong-profile missing-pods missing-inventory unknown-repo-digest runtime-fixture runtime-run runtime-test runtime-marker runtime-unknown migration-only migration-insufficient-serving running-migration failed-migration unknown-migration unowned-migration noncontroller-migration nonjob-migration migration-wrong-serving-id migration-fixture-serving migration-running-container migration-failed-container migration-unknown-containers migration-running-init migration-unknown-owner-api; do
make_case "$scenario"
case "$scenario" in
runtime-fixture) runtime_environment=fixture ;;
diff --git a/scripts/tests/test-minikube-t2-proxy-runtime.sh b/scripts/tests/test-minikube-t2-proxy-runtime.sh
index 6d8d71764..580a5c44d 100755
--- a/scripts/tests/test-minikube-t2-proxy-runtime.sh
+++ b/scripts/tests/test-minikube-t2-proxy-runtime.sh
@@ -63,6 +63,12 @@ if case == 'fixture-image':
if case == 'fixture-env': container['env'] = [{'name': 'CODEX_APPROVED_TOOLS_TEST_ONLY', 'value': '1'}]
if case == 'fixture-marker': template['metadata']['annotations'] = {'evenfire.ai/codex-tools-fixture-run': 'approved-tools-aabbccddeeff'}
if case == 'old-fixture-pod': pod['spec']['containers'][0]['env'] = [{'name': 'CODEX_APPROVED_TOOLS_MINIKUBE_PROFILE', 'value': 'fake'}]
+# The production proxy mounts /tmp; only the fixture volume name is refused.
+if case == 'production-tmp':
+ for spec in (template['spec'], pod['spec']):
+ spec['volumes'] = [{'name': 'tmp', 'emptyDir': {}}]
+ spec['containers'][0]['volumeMounts'] = [{'name': 'tmp', 'mountPath': '/tmp'}]
+if case == 'fixture-volume': template['spec']['volumes'] = [{'name': 'approved-tools-oauth-tmp', 'emptyDir': {}}]
if case == 'wrong-id': status['imageID'] = 'docker://' + other
if case == 'unknown-id': status['imageID'] = 'unknown'
if case == 'missing-id': del status['imageID']
@@ -84,14 +90,14 @@ for name, data in [('manifest', manifest), ('deployments', {'items': [deployment
(root / (name + '.json')).write_text(json.dumps(data))
PY
}
-for scenario in restored ghcr; do
+for scenario in restored ghcr production-tmp; do
make_case "$scenario"
t2_deployment_check
t2_proxy_runtime_check "$T2_DEPLOYMENT_JSON"
done
# Keep the production preflight integration under regression coverage.
grep -Fq 't2_proxy_runtime_check "$T2_DEPLOYMENT_JSON"' "$ROOT/scripts/minikube/t2-preflight.sh"
-for scenario in fixture-image fixture-env fixture-marker old-fixture-pod wrong-id unknown-id missing-id missing-baseline missing-proxy wrong-profile missing-pods missing-inventory unknown-repo-digest runtime-fixture runtime-unknown; do
+for scenario in fixture-image fixture-volume fixture-env fixture-marker old-fixture-pod wrong-id unknown-id missing-id missing-baseline missing-proxy wrong-profile missing-pods missing-inventory unknown-repo-digest runtime-fixture runtime-unknown; do
make_case "$scenario"
case "$scenario" in runtime-fixture) runtime_environment=false ;; runtime-unknown) runtime_environment='' ;; esac
if t2_proxy_runtime_check "$(cat "$tmp/deployments.json")" >"$tmp/result" 2>&1; then