fix(FN-000): harden workflow work item dispatch

Address PR #1578 feedback by failing unwired work item dispatch without a no-op persistence path and forwarding work item attempts into merge primitive context.
This commit is contained in:
gsxdsm
2026-06-11 08:30:31 -07:00
parent c7e278c3db
commit 3af587af6e
3 changed files with 95 additions and 7 deletions

View File

@@ -935,7 +935,10 @@ export function createDefaultNodeHandlers(
},
"merge-attempt": async (_node, ctx) => {
if (!deps?.primitives) return { outcome: "failure", value: "merge-primitives-unwired" };
const result = await deps.primitives.requestMerge(primitiveContextForNode(_node, ctx.task, ctx.context), ctx.task);
const attempt = typeof ctx.context["workflow:work-item-attempt"] === "number"
? ctx.context["workflow:work-item-attempt"]
: undefined;
const result = await deps.primitives.requestMerge(primitiveContextForNode(_node, ctx.task, ctx.context, attempt), ctx.task);
return { outcome: result.outcome, value: result.value, contextPatch: result.contextPatch };
},
"manual-merge-hold": async () => ({ outcome: "failure", value: "manual-required" }),