mirror of
https://github.com/davidkaya/aryx.git
synced 2026-07-24 05:28:46 +02:00
fix: always replace builtin workflows with canonical definitions
The merge logic was preserving stale persisted versions of builtin workflows, only overlaying orchestrationMode. This meant edge fixes (like the handoff loop marking) never reached users who already had the old version saved. Builtin workflows are now fully replaced on load so fixes propagate automatically. Custom (non-builtin) workflows are preserved as-is. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -41,28 +41,12 @@ import { readJsonFile, writeJsonFile } from '@main/persistence/jsonStore';
|
||||
function mergeBuiltinWorkflows(existingWorkflows: WorkflowDefinition[]): WorkflowDefinition[] {
|
||||
const builtinWorkflows = createBuiltinWorkflows(nowIso());
|
||||
const builtinIds = new Set(builtinWorkflows.map((workflow) => workflow.id));
|
||||
const existingMap = new Map(existingWorkflows.map((workflow) => [workflow.id, workflow]));
|
||||
|
||||
const mergedBuiltins = builtinWorkflows.map((builtin) => {
|
||||
const existing = existingMap.get(builtin.id);
|
||||
if (!existing) {
|
||||
return builtin;
|
||||
}
|
||||
|
||||
return normalizeWorkflowDefinition({
|
||||
...existing,
|
||||
settings: {
|
||||
...existing.settings,
|
||||
orchestrationMode: builtin.settings.orchestrationMode,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
const customWorkflows = existingWorkflows
|
||||
.filter((workflow) => !builtinIds.has(workflow.id))
|
||||
.map(normalizeWorkflowDefinition);
|
||||
|
||||
return [...mergedBuiltins, ...customWorkflows];
|
||||
return [...builtinWorkflows, ...customWorkflows];
|
||||
}
|
||||
|
||||
function mergeWorkflowTemplates(existingTemplates: WorkflowTemplateDefinition[]): WorkflowTemplateDefinition[] {
|
||||
|
||||
Reference in New Issue
Block a user