langgenius / langgenius/dify

Inserted snippet nodes disappear after reopening a collaborative workflow

Open
#42,226 0 comments 1 reaction 1 assignee Claimed by @Mike-stone12 View on GitHub
Dominant language
TypeScript
Stars
156k
Forks
24.6k
Avg merge
22h 9m
Merged PRs (30d)
610

Description

### Self Checks

- [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542).
- [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general).
- [x] I have searched for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- [x] Please do not modify this template :) and fill in all the required fields.

### Dify version

main (085a79c7); browser repro on 1.17.0 backend + source frontend (ad90cb91)

### Cloud or Self Hosted

Self Hosted (Source), Self Hosted (Docker)

### Steps to reproduce

Historical browser reproduction: source frontend based on `ad90cb911138f6b27af996c87afe34fbb5a4ed16`, with the official 1.17.0 Docker backend, PostgreSQL, Redis and Sandbox. The frontend and backend were not built from the same commit. Also reproduced with focused hook regressions on current main `085a79c748be47111d2e1c1b65b3f82200998d5c`: the two new regressions fail before the corresponding fix and pass after it. This current-main check is automated; the browser deployment evidence below is historical.

1. With workflow collaboration enabled and connected, publish a valid snippet containing connected nodes (a Code node returning a constant and an End node consuming it are sufficient for the regression fixture).
2. Open a fresh workflow containing only Start, and insert the snippet from the block selector.
3. Reopen the workflow and inspect the inserted graph. Also check another tab already viewing the same workflow.

The historical browser reproduction used a five-node countdown snippet: after insertion the saved workflow contained six nodes and four edges; reopening reduced it to one node while four edges still referenced missing nodes. This observation used an assigner-reference fix already applied; it isolates a separate persistence failure.

### ✔️ Expected Behavior

Inserted nodes and edges survive reopening and propagate to the other connected editor.

### ❌ Actual Behavior

Inserted nodes can disappear after reopening, leaving dangling edges and a `MISSING_NODE` validation error.

The insertion hook writes directly to React Flow instead of using the existing collaborative workflow setters, so the collaboration document does not receive the graph update. The proposed fix routes insertion through `useCollaborativeWorkflow` and aborts before mutation, history, draft sync or usage counting when collaboration cannot accept graph changes.

I would like to contribute a focused fix with a Loro snapshot round-trip regression and an unavailable-state regression. Please assign this issue to me if this approach is suitable.

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.