Comfy-Org / Comfy-Org/ComfyUI_frontend

Implement atomic workflow overwrite via persistence-level flag

Open
#9,355 0 comments 0 reactions 1 assignee Claimed by @pythongosssss View on GitHub
area:workflows
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Problem

The current workflow save/overwrite flow deletes the existing workflow before the replacement is durably saved (e.g., in `saveWorkflowAs` and `saveWorkflow`). If a subsequent rename, open, or save step fails, the original workflow is already gone, risking data loss.

Affected locations:
- `src/platform/workflow/core/services/workflowService.ts` Line 131 (in `saveWorkflowAs`)
- `src/platform/workflow/core/services/workflowService.ts` Line 173 (in `saveWorkflow`)

## Proposed Solution

Add an `overwrite` flag (or similar) to the workflow persistence layer (`saveWorkflow` / `persistWorkflow` API) that allows atomic replacement:
- Write the new workflow content first
- Only delete/replace the old workflow after successful commit
- Ensure any write failures abort the delete and propagate errors up

This would replace the current pattern of explicit `deleteWorkflow` calls before saving.

## References

- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9338
- Comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9338#discussion_r2878008918
- Requested by: @pythongosssss

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-9355-Implement-atomic-workflow-overwrite-via-persistence-level-flag-3186d73d365081518c6af82d086e195b) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.