Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(wrc): keep stepless SDK policies coordinator-free
Alfredo Lopezd12d8d469e23
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.jsonindex 6a6efd48d..a548ea6e7 100644--- a/workflow-recipes/package-lock.json+++ b/workflow-recipes/package-lock.json@@ -1,12 +1,12 @@{"name": "workload-recipes-controller",- "version": "0.1.259",+ "version": "0.1.260","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "workload-recipes-controller",- "version": "0.1.259",+ "version": "0.1.260","license": "SEE LICENSE IN LICENSE","dependencies": {"@aws-sdk/client-s3": "^3.1009.0",diff --git a/workflow-recipes/package.json b/workflow-recipes/package.jsonindex ec26fe442..cc30447db 100644--- a/workflow-recipes/package.json+++ b/workflow-recipes/package.json@@ -1,6 +1,6 @@{"name": "workload-recipes-controller",- "version": "0.1.259",+ "version": "0.1.260","description": "Workload Recipes Controller (WRC) - WorkloadRecipe lifecycle management and MCP server interface","main": "dist/main.js","engines": {diff --git a/workflow-recipes/src/workflow/networkPolicyFactory.gfs.test.ts b/workflow-recipes/src/workflow/networkPolicyFactory.gfs.test.tsindex 20f3acda3..fdb80f533 100644--- a/workflow-recipes/src/workflow/networkPolicyFactory.gfs.test.ts+++ b/workflow-recipes/src/workflow/networkPolicyFactory.gfs.test.ts@@ -55,6 +55,24 @@ describe('workflow GFS NetworkPolicy', () => {expect(policies.some(np => np.metadata?.name === 'daily-report-mcp-host-to-gfs')).toBe(false)})+ it('omits coordinator lanes for a stepless SDK host while keeping mcp-host access', () => {+ const policies = buildWorkflowNetworkPolicies({+ ...baseConfig,+ includeCoordinator: false,+ pluginWorkloadSdkSandboxAccess: true,+ })+ const names = policies.map(policy => policy.metadata?.name)++ expect(names).not.toContain('daily-report-coord-to-mcp-host')+ expect(names).not.toContain('daily-report-coord-to-mcp-host-ingress')+ expect(names).not.toContain('daily-report-coord-to-wrc')+ expect(names).not.toContain('daily-report-coordinator-to-gfs')+ expect(names).toContain('daily-report-wrc-to-mcp-host')+ expect(names).toContain('daily-report-mcp-host-to-gfs')+ expect(names).toContain('daily-report-mcp-host-to-llm-api')+ expect(names).toContain('daily-report-workload-to-mcp-host-sdk-ingress')+ })+it('opens coordinator egress to gfsc only when workflow output publishing is enabled', () => {const withoutPublish = buildWorkflowNetworkPolicies({ ...baseConfig, includeMcpHost: false })expect(withoutPublish.some(np => np.metadata?.name === 'daily-report-coordinator-to-gfs')).toBe(diff --git a/workflow-recipes/src/workflow/networkPolicyFactory.ts b/workflow-recipes/src/workflow/networkPolicyFactory.tsindex 03594a2b2..eb1928722 100644--- a/workflow-recipes/src/workflow/networkPolicyFactory.ts+++ b/workflow-recipes/src/workflow/networkPolicyFactory.ts@@ -59,6 +59,13 @@ export interface NetworkPolicyConfig {wrcPort: numbermcpHostPort: numbergfscPort?: number+ /**+ * Emit workflow-coordinator lanes. Stepless Plugin Workload SDK hosts do not+ * have a coordinator; they still need the mcp-host control/egress lanes but+ * must not receive coordinator NetworkPolicies that can never select a pod.+ * Defaults to true for the existing workflow runtime.+ */+ includeCoordinator?: booleanincludeMcpHost?: booleanincludeCoordinatorGfs?: booleanincludeArtifactReader?: boolean@@ -194,6 +201,17 @@ export function buildWorkflowNetworkPolicies('clerum.io/recipe': config.recipeName,'clerum.io/managed-by': 'wrc',}+ const includeCoordinator = config.includeCoordinator !== false+ const filterCoordinatorPolicies = (policies: k8s.V1NetworkPolicy[]) =>+ includeCoordinator+ ? policies+ : policies.filter(policy => {+ const name = policy.metadata?.name ?? ''+ return (+ !name.startsWith(`${config.recipeName}-coord-to-`) &&+ !name.startsWith(`${config.recipeName}-coordinator-to-`)+ )+ })const dnsEgressRule: k8s.V1NetworkPolicyEgressRule = {to: [{@@ -632,23 +650,25 @@ export function buildWorkflowNetworkPolicies(: []if (config.includeMcpHost === false) {- return config.includeArtifactReader- ? [- coordinatorToWrc,- ...(config.includeCoordinatorGfs ? [coordinatorToGfs] : []),- artifactReaderIngress,- ...snippetRunnerPolicies,- ...coordinatorWorkloadIngressPolicies,- ]- : [- coordinatorToWrc,- ...(config.includeCoordinatorGfs ? [coordinatorToGfs] : []),- ...snippetRunnerPolicies,- ...coordinatorWorkloadIngressPolicies,- ]+ return filterCoordinatorPolicies(+ config.includeArtifactReader+ ? [+ coordinatorToWrc,+ ...(config.includeCoordinatorGfs ? [coordinatorToGfs] : []),+ artifactReaderIngress,+ ...snippetRunnerPolicies,+ ...coordinatorWorkloadIngressPolicies,+ ]+ : [+ coordinatorToWrc,+ ...(config.includeCoordinatorGfs ? [coordinatorToGfs] : []),+ ...snippetRunnerPolicies,+ ...coordinatorWorkloadIngressPolicies,+ ]+ )}- return [+ return filterCoordinatorPolicies([// 1. Coordinator → mcp_host (within sandbox-recipes){apiVersion: 'networking.k8s.io/v1',@@ -952,5 +972,5 @@ export function buildWorkflowNetworkPolicies(// port plus mcp-host -> WRC for per-attempt credential ticket redemption.// Empty unless the capability and feature flag are both enabled....pluginWorkloadSdkPolicies,- ]+ ])}diff --git a/workflow-recipes/src/workflow/workflowReconciler.test.ts b/workflow-recipes/src/workflow/workflowReconciler.test.tsindex 8a2d24e0b..354c2b806 100644--- a/workflow-recipes/src/workflow/workflowReconciler.test.ts+++ b/workflow-recipes/src/workflow/workflowReconciler.test.ts@@ -1418,6 +1418,11 @@ describe('WorkflowReconciler — Plugin Workload SDK eager mcp-host', () => {const npNames = mockNetworkingApi.createNamespacedNetworkPolicy.mock.calls.map(call => call[0].body.metadata.name)+ // A stepless SDK host has no coordinator. The eager network lane must not+ // create workflow-only coordinator policies that would later be orphaned.+ expect(npNames).not.toContain('sdk-recipe-coord-to-mcp-host')+ expect(npNames).not.toContain('sdk-recipe-coord-to-mcp-host-ingress')+ expect(npNames).not.toContain('sdk-recipe-coord-to-wrc')expect(npNames).toContain('sdk-recipe-workload-to-mcp-host-sdk-ingress')expect(npNames).toContain('sdk-recipe-workload-to-mcp-host-sdk-egress')expect(npNames).toContain('sdk-recipe-mcp-host-to-gfs')@@ -1464,6 +1469,12 @@ describe('WorkflowReconciler — Plugin Workload SDK eager mcp-host', () => {)expect(podNames).toContain('sdk-only-mcp-host')expect(podNames).not.toContain('sdk-only-coordinator')+ const npNames = mockNetworkingApi.createNamespacedNetworkPolicy.mock.calls.map(+ call => call[0].body.metadata.name+ )+ expect(npNames).not.toContain('sdk-only-coord-to-mcp-host')+ expect(npNames).not.toContain('sdk-only-coord-to-mcp-host-ingress')+ expect(npNames).not.toContain('sdk-only-coord-to-wrc')expect(result.phase).toBe('active')expect(mockModelConfigHandler.configurePluginWorkloadSdkBootstrap).toHaveBeenCalledWith('zai',@@ -1498,6 +1509,34 @@ describe('WorkflowReconciler — Plugin Workload SDK eager mcp-host', () => {expect(mockCoreApi.createNamespacedPod).not.toHaveBeenCalled()})+ it('sweeps legacy SDK network policies by recipe label during cleanup', async () => {+ mockNetworkingApi.listNamespacedNetworkPolicy.mockImplementation(+ ({ namespace }: { namespace: string }) =>+ Promise.resolve({+ items:+ namespace === sandboxNamespace+ ? [{ metadata: { name: 'sdk-only-legacy-coord-to-mcp-host' } }]+ : [],+ })+ )+ const reconciler = new WorkflowReconciler(makeDeps())++ await reconciler.cleanupPluginWorkloadSdkOnly('sdk-only')++ expect(mockNetworkingApi.listNamespacedNetworkPolicy).toHaveBeenCalledWith({+ namespace: sandboxNamespace,+ labelSelector: 'clerum.io/recipe=sdk-only,clerum.io/managed-by=wrc',+ })+ expect(mockNetworkingApi.listNamespacedNetworkPolicy).toHaveBeenCalledWith({+ namespace: mcpServerNamespace,+ labelSelector: 'clerum.io/recipe=sdk-only,clerum.io/managed-by=wrc',+ })+ expect(mockNetworkingApi.deleteNamespacedNetworkPolicy).toHaveBeenCalledWith({+ name: 'sdk-only-legacy-coord-to-mcp-host',+ namespace: sandboxNamespace,+ })+ })+it('brokers the provider into the eager mcp-host for promptBridge recipes', async () => {const reconciler = new WorkflowReconciler(makeDeps())diff --git a/workflow-recipes/src/workflow/workflowReconciler.ts b/workflow-recipes/src/workflow/workflowReconciler.tsindex a4ed4ef32..b557801f5 100644--- a/workflow-recipes/src/workflow/workflowReconciler.ts+++ b/workflow-recipes/src/workflow/workflowReconciler.ts@@ -957,6 +957,23 @@ export class WorkflowReconciler {this.deps.networkingApi.deleteNamespacedNetworkPolicy({ name, namespace: ns }))),+ // Older SDK-only reconciles used the shared workflow policy factory and+ // left coordinator-shaped policies behind. Sweep the complete recipe+ // label set so upgrades and dynamic policy names cannot retain a stale+ // isolation lane. The selector is recipe-scoped and only matches WRC-+ // managed policies, never the namespace-wide baseline policies.+ this.safeDelete(() =>+ this.deleteNetworkPoliciesByLabelSelector(+ ns,+ `clerum.io/recipe=${recipeName},clerum.io/managed-by=wrc`+ )+ ),+ this.safeDelete(() =>+ this.deleteNetworkPoliciesByLabelSelector(+ this.deps.config.mcpServerNamespace,+ `clerum.io/recipe=${recipeName},clerum.io/managed-by=wrc`+ )+ ),])}@@ -2398,6 +2415,10 @@ export class WorkflowReconciler {artifactReaderPort: 8080,snippetRunnerPort: 8095,includeMcpHost: runtime.network.includeMcpHost && mcpHostLaneLive,+ // A stepless eager SDK host has no coordinator pod. Keep the mcp-host+ // control/egress lanes, but do not manufacture coordinator policies+ // whose selectors can never match a real workload.+ includeCoordinator: !eagerSdkMcpHost,// The outer WorkflowRecipe reconciler owns this declarative lane so it can// revoke before phase short-circuits while gating creation on provenance.includeCoordinatorGfs: false,