Skip to content

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

TypeScript

fix: keep stepless sdk capability on full reconcile lane

Alfredo Lopeze9fde61d3dd3
diff --git a/scripts/e2e/e2e-plugin-workload-sdk.sh b/scripts/e2e/e2e-plugin-workload-sdk.sh
index e5a689926..712372d03 100755
--- a/scripts/e2e/e2e-plugin-workload-sdk.sh
+++ b/scripts/e2e/e2e-plugin-workload-sdk.sh
@@ -916,13 +916,38 @@ fi
# NetworkPolicy: a pod in a different namespace cannot reach the SDK port.
mcp_svc="$(kctl get svc -n "$SANDBOX_NS" -l "clerum.io/recipe=${RECIPE_NAME},clerum.io/component=workflow-mcp-host" -o jsonpath='{.items[0].metadata.name}' 2>/dev/null || true)"
if [ -n "$mcp_svc" ]; then
- probe_out="$(kctl run "sdk-np-probe-$$" -n default --rm -i --restart=Never \
- --image=busybox:1.36 --command --timeout=60s -- \
- sh -c "nc -z -w5 ${mcp_svc}.${SANDBOX_NS}.svc.cluster.local 8099 && echo OPEN || echo BLOCKED" 2>/dev/null || echo BLOCKED)"
- if printf "%s" "$probe_out" | grep -q BLOCKED; then
+ # Do not use `kubectl run --rm -i` here. The attached stdin can remain open
+ # after the probe pod exits (notably with a branch-owned Minikube context),
+ # leaving the whole gate blocked in a command substitution. Create the pod
+ # detached, observe its terminal phase with a hard deadline, then collect
+ # logs and delete it explicitly. This keeps the gate fail-closed without
+ # weakening the NetworkPolicy assertion.
+ probe_name="sdk-np-probe-$$"
+ probe_deadline=$((SECONDS + 45))
+ probe_phase=""
+ probe_out=""
+ kctl delete pod "$probe_name" -n default --ignore-not-found --wait=false >/dev/null 2>&1 || true
+ if kctl run "$probe_name" -n default --restart=Never --image=busybox:1.36 \
+ --request-timeout=15s --command -- \
+ sh -c "nc -z -w5 ${mcp_svc}.${SANDBOX_NS}.svc.cluster.local 8099 && echo OPEN || echo BLOCKED" \
+ >/dev/null 2>&1; then
+ while [ "$SECONDS" -lt "$probe_deadline" ]; do
+ probe_phase="$(kctl get pod "$probe_name" -n default -o jsonpath='{.status.phase}' 2>/dev/null || true)"
+ case "$probe_phase" in
+ Succeeded|Failed) break ;;
+ esac
+ sleep 1
+ done
+ probe_out="$(kctl logs "$probe_name" -n default --tail=20 2>/dev/null || true)"
+ else
+ probe_phase="CreateFailed"
+ probe_out=""
+ fi
+ kctl delete pod "$probe_name" -n default --ignore-not-found --wait=false >/dev/null 2>&1 || true
+ if [ "$probe_phase" = "Succeeded" ] && printf "%s" "$probe_out" | grep -q BLOCKED; then
ok "SDK port 8099 is blocked from the 'default' namespace (NetworkPolicy enforced)"
else
- fail "SDK port 8099 was reachable cross-namespace — NetworkPolicy not enforcing"
+ fail "SDK cross-namespace NetworkPolicy probe failed (phase=${probe_phase:-Timeout}; output redacted)"
exit 1
fi
else
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.json
index 2fd5cc788..1bb3e51a4 100644
--- a/workflow-recipes/package-lock.json
+++ b/workflow-recipes/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.266",
+ "version": "0.1.267",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "workload-recipes-controller",
- "version": "0.1.266",
+ "version": "0.1.267",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@aws-sdk/client-s3": "^3.1009.0",
diff --git a/workflow-recipes/package.json b/workflow-recipes/package.json
index 99e74f75e..da6f9c460 100644
--- a/workflow-recipes/package.json
+++ b/workflow-recipes/package.json
@@ -1,6 +1,6 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.266",
+ "version": "0.1.267",
"description": "Workload Recipes Controller (WRC) - WorkloadRecipe lifecycle management and MCP server interface",
"main": "dist/main.js",
"engines": {
diff --git a/workflow-recipes/src/k8sClient.test.ts b/workflow-recipes/src/k8sClient.test.ts
index f36c3dec7..d2287b2cc 100644
--- a/workflow-recipes/src/k8sClient.test.ts
+++ b/workflow-recipes/src/k8sClient.test.ts
@@ -516,6 +516,21 @@ describe('runtime credential refresh loop helpers', () => {
).toBe(true)
})
+ it('keeps reconciling a stepless SDK-only recipe through the full capability lane', () => {
+ expect(
+ workflowNeedsInfrastructureReconcile(
+ makeWorkflowRecipe({
+ spec: {
+ steps: [],
+ workloads: [{ id: 'api', type: 'deployment', image: 'clerum/api:test' }],
+ pluginWorkloadSdk: { promptBridge: {} },
+ },
+ status: { phase: 'active' },
+ })
+ )
+ ).toBe(true)
+ })
+
it('does NOT keep reconciling a recipe with no Plugin Workload SDK and no run', () => {
// No pluginWorkloadSdk → no eager mcp-host → no eager-reconcile requeue needed.
expect(
@@ -628,6 +643,17 @@ describe('workload status refresh loop helpers', () => {
})
)
).toBe(false)
+ expect(
+ workflowNeedsWorkloadStatusRefresh(
+ makeWorkloadRecipe({
+ spec: {
+ steps: [],
+ pluginWorkloadSdk: { promptBridge: {} },
+ },
+ status: { phase: 'active' },
+ })
+ )
+ ).toBe(false)
expect(
workflowNeedsWorkloadStatusRefresh(makeWorkflowRecipe({ status: { phase: 'active' } }))
).toBe(false)
diff --git a/workflow-recipes/src/k8sClient.ts b/workflow-recipes/src/k8sClient.ts
index cc1404c83..559f6d45f 100644
--- a/workflow-recipes/src/k8sClient.ts
+++ b/workflow-recipes/src/k8sClient.ts
@@ -273,7 +273,15 @@ export function workflowNeedsRuntimeCredentialRefresh(recipe: WorkflowRecipeCRD)
export function workflowNeedsInfrastructureReconcile(recipe: WorkflowRecipeCRD): boolean {
const isWorkflow = (recipe.spec.steps ?? []).length > 0
- if (!isWorkflow || recipe.metadata.deletionTimestamp) return false
+ if (recipe.metadata.deletionTimestamp) return false
+
+ // SDK-only recipes are deliberately stepless, but their eager mcp-host and
+ // bootstrap proof still need the full reconciler lane. The generic workload
+ // status-refresh path cannot represent that proof and would overwrite a
+ // validated SDK capability with BootstrapNotReady while leaving phase=active.
+ // Keep this level-triggered retry independent from workflowExecution.
+ if (!isWorkflow && recipe.spec.pluginWorkloadSdk) return true
+ if (!isWorkflow) return false
const workflowPhase = recipe.status?.workflowExecution?.phase
if (workflowPhase === 'initializing' || workflowPhase === 'recovering') return true
@@ -306,6 +314,10 @@ export function workflowNeedsTerminalRunTeardown(recipe: WorkflowRecipeCRD): boo
export function workflowNeedsWorkloadStatusRefresh(recipe: WorkflowRecipeCRD): boolean {
if (recipe.metadata.deletionTimestamp) return false
if ((recipe.spec.steps ?? []).length > 0) return false
+ // SDK-only recipes have capability state (including the eager bootstrap
+ // proof) that is owned by the full reconciler. A status-only workload read
+ // has no proof to carry and would corrupt the persisted SDK projection.
+ if (recipe.spec.pluginWorkloadSdk) return false
if ((recipe.spec.workloads ?? []).length === 0) return false
return recipe.status?.phase === 'active' || recipe.status?.phase === 'degraded'