Skip to content

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

TypeScript

docs(workflow-recipes): document the read-first Context and StatefulSet writers (#760)

Alfredo Lopez11d419182a76
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.json
index fd8e1453c..a6da729fe 100644
--- a/workflow-recipes/package-lock.json
+++ b/workflow-recipes/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.464",
+ "version": "0.1.465",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "workload-recipes-controller",
- "version": "0.1.464",
+ "version": "0.1.465",
"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 8dda872ec..5a07975d4 100644
--- a/workflow-recipes/package.json
+++ b/workflow-recipes/package.json
@@ -1,6 +1,6 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.464",
+ "version": "0.1.465",
"description": "Workload Recipes Controller (WRC) - WorkloadRecipe lifecycle management and MCP server interface",
"main": "dist/main.js",
"engines": {
diff --git a/workflow-recipes/src/reconciler/mcpDelegation.ts b/workflow-recipes/src/reconciler/mcpDelegation.ts
index de5ab7aa4..93e2248d7 100644
--- a/workflow-recipes/src/reconciler/mcpDelegation.ts
+++ b/workflow-recipes/src/reconciler/mcpDelegation.ts
@@ -919,6 +919,10 @@ export async function deleteTransportDelegation(
* The Context has an ownerReference to the WorkflowRecipe so K8s GC handles
* deletion automatically. Belt-and-suspenders explicit delete in cleanupDelegation.
*
+ * Read-first, like ensureTransportService (#760): GET the Context; create it
+ * only on a 404; a 409 on that create re-reads and compares. A POST against an
+ * existing Context is a rejected write that the audit log still counts.
+ *
* Returns the per-recipe context name.
*/
export async function ensureRecipeContext(
@@ -1228,8 +1232,9 @@ export async function preDeployMcpServers(
// Create (or update) the per-recipe Context CRD immediately after McpServers
// are pre-deployed. This makes the allowlist visible to E2E tests and downstream
// watchers in ~2-3s, well before waitForNetworkReady completes (~30s for stdio).
- // delegateTransportWorkloads (Step 9a) will call ensureRecipeContext again
- // idempotently after the network handshake completes.
+ // delegateTransportWorkloads (Step 9a) calls ensureRecipeContext again after
+ // the network handshake completes. In steady state that second call is one
+ // GET and no write, because the writer reads before it creates (#760).
if (preDeployed.length > 0) {
const recipeOwnerRef = {
apiVersion: `${CRD_GROUP}/${CRD_VERSION}` as const,
diff --git a/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts b/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts
index 1b1fd421d..560e34f0b 100644
--- a/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts
+++ b/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts
@@ -4806,6 +4806,9 @@ export class WorkflowRecipeReconciler {
})
}
+ // Read-first, like ensureTransportService in mcpDelegation.ts (#760): GET the
+ // StatefulSet; create it only on a 404; a 409 on that create re-reads. A POST
+ // against an existing StatefulSet is a rejected write the audit log counts.
private async createOrPatchStatefulSet(
statefulSet: k8s.V1StatefulSet,
namespace: string,