dify/api/services/workflow
Yansong Zhang 7052257c8d fix(api): use lazy workflow persistence for transparent upgrade of old apps
VirtualWorkflowSynthesizer.ensure_workflow() creates a real draft
workflow on first call for a legacy app, persisting it to the database.
On subsequent calls, returns the existing draft.

This is needed because AdvancedChatAppGenerator's worker thread looks
up workflows from the database by ID. Instead of hacking the generator
to skip DB lookups, we treat this as a lazy one-time upgrade: the old
app gets a real workflow that can also be edited in the workflow editor.

Verified: old chat app created on main branch ("What is 2+2?" -> "Four")
and old agent-chat app ("Say hello" -> "Hello!") both successfully
execute through the Agent V2 engine with AGENT_V2_TRANSPARENT_UPGRADE=true.

Made-with: Cursor
2026-04-09 11:28:16 +08:00
..
__init__.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
entities.py feat: Human Input Node (#32060) 2026-02-09 14:57:23 +08:00
graph_factory.py feat(api): add Agent V2 node and new Agent app type (Phase 1-3) 2026-04-08 12:31:23 +08:00
nested_node_graph_service.py feat(api): enable all sandbox/skill controller routes and resolve dependencies (P0) 2026-04-09 09:36:16 +08:00
queue_dispatcher.py feat: trigger billing (#28335) 2025-11-20 10:15:23 +08:00
scheduler.py feat: introduce trigger functionality (#27644) 2025-11-12 17:59:37 +08:00
virtual_workflow.py fix(api): use lazy workflow persistence for transparent upgrade of old apps 2026-04-09 11:28:16 +08:00
workflow_converter.py refactor: convert AppMode if/elif to match/case in service files (#30001) (#34562) 2026-04-05 10:22:11 +00:00