Skip to content

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

TypeScript

docs(wrc): correct stale NetworkPolicy convergence comments

Alfredo Lopez05265b687da3
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.json
index 27c5cf150..d27c2a039 100644
--- a/workflow-recipes/package-lock.json
+++ b/workflow-recipes/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.397",
+ "version": "0.1.398",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "workload-recipes-controller",
- "version": "0.1.397",
+ "version": "0.1.398",
"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 0fcdb8692..01be242e1 100644
--- a/workflow-recipes/package.json
+++ b/workflow-recipes/package.json
@@ -1,6 +1,6 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.397",
+ "version": "0.1.398",
"description": "Workload Recipes Controller (WRC) - WorkloadRecipe lifecycle management and MCP server interface",
"main": "dist/main.js",
"engines": {
diff --git a/workflow-recipes/src/k8sClient.ts b/workflow-recipes/src/k8sClient.ts
index 2f3a9cc84..b40962e28 100644
--- a/workflow-recipes/src/k8sClient.ts
+++ b/workflow-recipes/src/k8sClient.ts
@@ -171,8 +171,9 @@ export function shouldPatchRecipeStatus(
return true
// A NetworkPolicy ownership conflict changes neither phase nor message, so
- // without this clause the condition would never be published or cleared. An
- // undefined field means the pass never reached the apply, so it opens nothing.
+ // without this clause the condition would not be published or cleared on a
+ // pass where nothing else changed. An undefined field means the pass never
+ // reached the apply, so it does not force a patch.
if (
result.networkPolicyOwnershipConditions !== undefined &&
ownedConditionsChanged(recipe.status?.conditions, result.networkPolicyOwnershipConditions, [
diff --git a/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts b/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts
index d6c501563..d73eac8e0 100644
--- a/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts
+++ b/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts
@@ -1442,7 +1442,7 @@ export class WorkflowRecipeReconciler {
// already logged at warn by the apply and stay there.
if (refreshed.retryPending) {
createLogger('wrc', recipe.metadata.name).error(
- 'Runtime HTTP egress refresh left a NetworkPolicy pending a retry; the next refresh retries it',
+ 'Runtime HTTP egress refresh left a NetworkPolicy pending a retry; a later refresh retries it',
{ name: recipe.metadata.name }
)
}
@@ -2272,8 +2272,8 @@ export class WorkflowRecipeReconciler {
// fires no CR MODIFIED event — without this timer the run wedges at
// phase=deploying forever (mcp-host pod never created) and dbRunProcessor
// logs "orphaned running run reclaimed" every reclaim tick. Terminal /
- // active / failed results keep `undefined` so steady-state does not
- // requeue.
+ // active / failed results keep `undefined` (unless a NetworkPolicy retry
+ // is pending, below) so steady-state does not requeue.
//
// Priority: a transient ERROR (skipStatusPatch) wins over PROGRESS
// (deploying). The error path keeps exponential backoff; the progress
@@ -2290,16 +2290,18 @@ export class WorkflowRecipeReconciler {
// deadline that bounds a fixed-interval loop.
//
// A NetworkPolicy left pending a retry (terminating, deleted before the
- // replace, or conflicted twice) requeues on the backoff path too: nothing
- // bounds how long the deletion or the contention lasts. An ownership
- // conflict does not requeue; it waits for an operator and is published as
- // a condition.
+ // replace, or conflicted twice) requeues on the backoff path unless the
+ // phase is `deploying`: nothing bounds how long the deletion or the
+ // contention lasts. An ownership conflict does not requeue; it waits for
+ // an operator and is published as a condition.
//
// Known limit: the requeued pass reaches the run-lane apply only while
- // the run is still initializing or recovering. Once it is running, the
- // in-progress and active short-circuits above return before
- // WorkflowReconciler.reconcile(), so the policy is rewritten by the next
- // pass that reaches it (the next run or a crash recovery). The 30s
+ // the run is still initializing or recovering. Otherwise the
+ // awaiting-trigger, terminal, in-progress and active short-circuits above
+ // return before WorkflowReconciler.reconcile() (the awaiting-trigger and
+ // active ones let a Plugin Workload SDK recipe fall through unless its
+ // run is in progress), so the policy is rewritten by the next pass that
+ // reaches it (the next run or a crash recovery). The 30s
// runtime HTTP egress refresh reapplies only coord-to-wrc and
// snippet-runner-egress, and only when the spec gives them public HTTP
// egress.
diff --git a/workflow-recipes/src/workflow/pluginWorkloadSdkProvisioner.ts b/workflow-recipes/src/workflow/pluginWorkloadSdkProvisioner.ts
index 764b5c1c7..ceb9a013d 100644
--- a/workflow-recipes/src/workflow/pluginWorkloadSdkProvisioner.ts
+++ b/workflow-recipes/src/workflow/pluginWorkloadSdkProvisioner.ts
@@ -230,6 +230,11 @@ export class PluginWorkloadSdkProvisioner {
* Idempotent: safe to call on every reconcile. The mcp-host bootstrap is an
* identity-only handshake, so re-delivering the same provider/model after a
* pod restart simply re-arms the SDK LLM binding.
+ *
+ * Known limit: the NetworkPolicy apply summary is returned only when the
+ * function returns. If the pod half throws after the apply, the summary is
+ * discarded: ownership conflicts the apply already evaluated are not
+ * published, and its `retryPending` is lost for that pass.
*/
async ensureEagerSdkMcpHost(
recipeName: string,
diff --git a/workflow-recipes/src/workflow/workflowReconciler.ts b/workflow-recipes/src/workflow/workflowReconciler.ts
index 59486ccb3..f55505da8 100644
--- a/workflow-recipes/src/workflow/workflowReconciler.ts
+++ b/workflow-recipes/src/workflow/workflowReconciler.ts
@@ -420,8 +420,8 @@ function latestDate(a: Date | undefined, b: Date | undefined): Date | undefined
/**
* The latest live resolved-at when every policy the apply writes exists and
* already carries the computed CIDR state. Undefined when a policy is missing,
- * the resolved set changed, or no live value parses, so the caller stamps the
- * current time.
+ * any CIDR state annotation changed (a previous-CIDR overlap expiry included),
+ * or no live value parses, so the caller stamps the current time.
*/
function unchangedRuntimeHttpEgressResolvedAt(
liveAnnotationSets: Array<Record<string, string> | undefined>,
@@ -3045,7 +3045,7 @@ export class WorkflowReconciler {
// only record that a policy still carries the CIDRs the prune meant to drop.
if (pruned.retryPending) {
this.log.error(
- 'DNS-failure prune left a NetworkPolicy pending a retry; the next refresh retries it',
+ 'DNS-failure prune left a NetworkPolicy pending a retry; a later refresh retries it',
{ recipeName }
)
}
@@ -3364,7 +3364,7 @@ export class WorkflowReconciler {
serializeRuntimeHttpEgressCidrExpiries(activePreviousExpiries)
}
// Observability only; policy decisions use current/previous CIDR annotations above.
- // The key records the last change of the resolved set, not the last resolution:
+ // The key records the last change of the CIDR state annotations, not the last resolution:
// stamping every pass made each refresh a replace of an otherwise converged policy.
// A pass that finds any sibling policy missing, or no parseable live value,
// stamps the current time on every policy, so the siblings are replaced once.
@@ -4824,11 +4824,14 @@ export class WorkflowReconciler {
}
/**
- * Read first, then write only what the live object lacks. Ownership conflicts,
- * terminating objects, a policy deleted before the PUT and a replace that
- * conflicts twice are returned, not thrown: the workflow reconcile catch turns
- * every non-transport error into a terminal `failed`. Any other API error
- * still propagates.
+ * Read first, then write only when the live object differs from desired. The
+ * write is a full-object PUT of desired, so it also removes owned annotations
+ * that desired no longer carries. Ownership conflicts, terminating objects, a
+ * policy absent on the re-read after a 409, a 404 on the PUT (reason
+ * `deleted-before-replace`) and a replace that conflicts twice are returned,
+ * not thrown: the workflow reconcile catch turns every error it does not
+ * classify as transient into a terminal `failed`. Any other API error still
+ * propagates.
*/
private async applyNetworkPolicy(
policy: k8s.V1NetworkPolicy
diff --git a/workflow-recipes/tests/unit/workflow/asApiserverNetworkPolicy.ts b/workflow-recipes/tests/unit/workflow/asApiserverNetworkPolicy.ts
index d6cbe2277..6f196a537 100644
--- a/workflow-recipes/tests/unit/workflow/asApiserverNetworkPolicy.ts
+++ b/workflow-recipes/tests/unit/workflow/asApiserverNetworkPolicy.ts
@@ -1,7 +1,8 @@
import type * as k8s from '@kubernetes/client-node'
/**
- * Copied from host-context-controller/src/__tests__/asApiserverNetworkPolicy.ts.
+ * Adapted from host-context-controller/src/__tests__/asApiserverNetworkPolicy.ts.
+ * Dropped: `driftPort`, `updatedPolicyLogs`, and the merge of recorded peers.
* The packages are separate npm projects without a workspace, so the fixture
* cannot be imported across them.
*