Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(minikube): recognize gate-owned port forwards
Alfredo Lopez8f048b059c45
diff --git a/scripts/minikube/t2-common.sh b/scripts/minikube/t2-common.shindex 7d8286624..3ee087f4e 100755--- a/scripts/minikube/t2-common.sh+++ b/scripts/minikube/t2-common.sh@@ -486,9 +486,10 @@ PY}t2_process_check() {- local process_lines allowed pid command_line pid_file+ local process_lines allowed pid command_line pid_file profile_safeprocess_lines="$(ps -ef 2>/dev/null | awk '/[p]ort-forward/ && /kubectl/ {print}' || true)"[ -z "$process_lines" ] && return 0+ profile_safe="${T2_PROFILE//[^A-Za-z0-9_.-]/_}"while IFS= read -r command_line; do[ -z "$command_line" ] && continue[[ "$command_line" == *"$T2_PROFILE"* || "$command_line" == *"$T2_CONTEXT"* ]] || continue@@ -498,6 +499,14 @@ t2_process_check() {pid="$(sed -n '1p' "$pid_file" 2>/dev/null || true)"[[ -n "$pid" && "$command_line" == *" $pid "* ]] && allowed=truedone+ # pf-all-stack.sh is the canonical gate forwarder and records its child+ # PIDs in /tmp/pf-<profile>-*.pid. Accept those PIDs as profile-owned too;+ # otherwise T1 rejects the forwards that pre-gate-sync just started.+ for pid_file in "/tmp/pf-${profile_safe}-"*.pid; do+ [ -f "$pid_file" ] || continue+ pid="$(sed -n '1p' "$pid_file" 2>/dev/null || true)"+ [[ -n "$pid" && "$command_line" == *" $pid "* ]] && allowed=true+ doneif [ "$allowed" != true ]; thenT2_NEXT_COMMAND='stop the unrelated profile port-forward or select the owner worktree; do not share it't2_fail PORT_FORWARD_CONFLICT 'a port-forward for this profile is owned by another process'diff --git a/scripts/tests/test-minikube-t2-scenarios.sh b/scripts/tests/test-minikube-t2-scenarios.shindex c4ce262ad..c778c38c2 100755--- a/scripts/tests/test-minikube-t2-scenarios.sh+++ b/scripts/tests/test-minikube-t2-scenarios.sh@@ -193,4 +193,17 @@ grep -Fq 'PORT_FORWARD_CONFLICT' "$COMMON"grep -Fq 'REUSE_DB=true' "$ROOT/scripts/minikube/t2.sh"grep -Fq 'CONTROL_DB_RESET_PVC_UID' "$ROOT/scripts/minikube/t2.sh"+forward_tmp="$tmp/port-forward-check"+mkdir -p "$forward_tmp/bin" "$forward_tmp/profile-cache/profile-a/pids"+cat >"$forward_tmp/bin/ps" <<'EOF'+#!/usr/bin/env bash+printf '%s\n' 'root 4242 1 0 00:00 ? 00:00:00 kubectl --context=profile-a -n control-plane port-forward svc/control-api 30100:8090'+EOF+chmod +x "$forward_tmp/bin/ps"+printf '4242\n' >"/tmp/pf-profile-a-control-api.pid"+forward_check="$(env PATH="$forward_tmp/bin:$PATH" T2_PROFILE=profile-a T2_CONTEXT=profile-a \+ T2_PROFILE_ROOT="$forward_tmp/profile-cache" bash -c 'source "$1"; t2_process_check; printf PASS' bash "$COMMON")"+rm -f "/tmp/pf-profile-a-control-api.pid"+[ "$forward_check" = PASS ] || fail "canonical /tmp port-forward ownership was rejected: $forward_check"+printf 'PASS: local Minikube T0/T1/T2 scenario checks\n'