Skip to content

refactor(workflow): adopt Graphon 0.8 execution orchestration - #40277

Merged
laipz8200 merged 28 commits into
mainfrom
laipz8200/adapt-graphon-engine-architecture
Oct 19, 2026
Merged

laipz8200 merged 28 commits into
mainfrom
laipz8200/adapt-graphon-engine-architecture

Conversation

@laipz8200

@laipz8200 laipz8200 commented Aug 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Move workflow, chat, pipeline, and direct-tool entrypoints onto Graphon 0.8. Application orchestration owns repositories, persistence, execution indexing, event publication, and durable pause handling; runners prepare and execute graphs. Streamed node ordering remains aligned with persisted runs after resumption.

Preserve supplied node inputs, including nested selectors and falsy values, during individual-node and container debugging. Record the real Agent node execution before starting its backend session. Persist workflow task ownership and stop intent so stopping a paused run invalidates its pending forms and prevents a concurrent resume or delayed storage write from reviving it. Keep installed and trial app cancellation on their injected task-control service for both legacy and workflow app modes.

Restrict end-user cancellation, including external SSO callers, to the task owner through the application task service. Snippet virtual starts connect only to roots outside containers. Stopped runs finalize unfinished retrying nodes while retaining completed retry-attempt history.

Pin the API dependency to the published graphon==0.8.0 release. Nested workflow usage and step totals can be approximate, particularly when runs pause or stop; this is an accepted known issue for this upgrade. The standalone dify-agent directory retains main's Graphon dependency.

This is the foundation of the Graphon stack. Human Input UI, nested Workflow Tool execution, trace access, trace navigation, export isolation, and Agent reporting follow in separate PRs. The independent DSL bundle PR #42010 and OPS rewrite #42008 are outside this stack.

Upgrade guide

Apply the additive database migrations while the existing API continues serving traffic. The two new columns, workflow_runs.task_id and stop_requested_at, are nullable and require no historical-row backfill. The same retryable migration builds PostgreSQL's partial index on populated task IDs concurrently. The index build still scans the table and consumes I/O; adding the columns requires a brief schema lock.

Replace legacy workflow workers, allowing their in-flight executions to finish, before switching API traffic to the new version. Existing API service can remain available during this handover. Do not leave old resume consumers processing the shared queue after enabling the new stop behavior: they lack its locking and cancellation guards. An old running execution without a persisted task ID cannot be safely recovered from Redis ownership alone.

The new version recovers legacy paused task IDs from saved invocation snapshots when stopping, replaying, or resuming a run. Recovery is restricted to the admitted tenant, app, and caller scope, and preserves concurrent stop/resume decisions. No Flask backfill command or global traffic shutdown is required.

Keep the temporary recovery path for 30 days after the last legacy writer is retired, then remove the code marked with the cleanup TODOs. Missing or invalid snapshots remain unrecoverable and must be repaired separately.

Dependencies

The stack ultimately targets main. Prerequisite fixes remain independently reviewable in #42799, #42800, #42801, #42802, #42805, and #42806. Rebase after those merge to remove overlapping prerequisite changes before merging the Graphon stack.

@github-actions

github-actions Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 75.42% 75.55% +0.12%
Strict coverage 75.10% 75.22% +0.12%
Typed symbols 62,608 63,078 +470
Untyped symbols 20,489 20,507 +18
Modules 3802 3814 +12

@github-actions

github-actions Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-10-19 10:45:26.958680040 +0000
+++ /tmp/pyrefly_pr.txt	2026-10-19 10:45:16.614559705 +0000
@@ -489,15 +489,15 @@
 ERROR Class member `TestClickZettaVolumeStorage.setUp` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
   --> tests/integration_tests/storage/test_clickzetta_volume.py:19:9
 ERROR Argument `SSRFProxy` is not assignable to parameter `http_client` with type `HttpClientProtocol | None` in function `graphon.nodes.http_request.node.HttpRequestNode.__init__` [bad-argument-type]
-  --> tests/integration_tests/workflow/nodes/test_http.py:83:21
+  --> tests/integration_tests/workflow/nodes/test_http.py:85:21
 ERROR Argument `type[ToolFileManager]` is not assignable to parameter `tool_file_manager_factory` with type `(() -> ToolFileManagerProtocol) | None` in function `graphon.nodes.http_request.node.HttpRequestNode.__init__` [bad-argument-type]
-  --> tests/integration_tests/workflow/nodes/test_http.py:84:35
+  --> tests/integration_tests/workflow/nodes/test_http.py:86:35
 ERROR Argument `SSRFProxy` is not assignable to parameter `http_client` with type `HttpClientProtocol` in function `graphon.nodes.http_request.executor.Executor.__init__` [bad-argument-type]
-   --> tests/integration_tests/workflow/nodes/test_http.py:241:25
+   --> tests/integration_tests/workflow/nodes/test_http.py:243:25
 ERROR Argument `SSRFProxy` is not assignable to parameter `http_client` with type `HttpClientProtocol | None` in function `graphon.nodes.http_request.node.HttpRequestNode.__init__` [bad-argument-type]
-   --> tests/integration_tests/workflow/nodes/test_http.py:730:21
+   --> tests/integration_tests/workflow/nodes/test_http.py:734:21
 ERROR Argument `type[ToolFileManager]` is not assignable to parameter `tool_file_manager_factory` with type `(() -> ToolFileManagerProtocol) | None` in function `graphon.nodes.http_request.node.HttpRequestNode.__init__` [bad-argument-type]
-   --> tests/integration_tests/workflow/nodes/test_http.py:731:35
+   --> tests/integration_tests/workflow/nodes/test_http.py:735:35
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
   --> tests/test_containers_integration_tests/controllers/openapi/test_account.py:24:22
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
@@ -542,32 +542,6 @@
    --> tests/test_containers_integration_tests/controllers/web/test_wraps.py:191:33
 ERROR Argument `SimpleNamespace` is not assignable to parameter `webapp_settings` with type `WebAppSettings | None` in function `controllers.web.wraps._validate_user_accessibility` [bad-argument-type]
    --> tests/test_containers_integration_tests/controllers/web/test_wraps.py:219:33
-ERROR Attribute `file_service` of class `TestPauseStatePersistenceLayerTestContainers` is a read-only descriptor with no `__set__` and cannot be set [read-only]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:182:9
-ERROR Attribute `workflow_run_service` of class `TestPauseStatePersistenceLayerTestContainers` is a read-only descriptor with no `__set__` and cannot be set [read-only]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:183:9
-ERROR Argument `Connection | Engine` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Session]` in function `core.app.layers.pause_state_persist_layer.PauseStatePersistenceLayer.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:321:29
-ERROR Argument `dict[str, str]` is not assignable to parameter `outputs` with type `dict[str, object] | None` in function `TestPauseStatePersistenceLayerTestContainers._create_graph_runtime_state` [bad-argument-type]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:339:21
-ERROR Argument `dict[tuple[str, str], dict[str, str] | str]` is not assignable to parameter `variables` with type `dict[tuple[str, str], object] | None` in function `TestPauseStatePersistenceLayerTestContainers._create_graph_runtime_state` [bad-argument-type]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:342:23
-ERROR Argument `dict[str, bool | list[dict[str, str] | int] | dict[str, int | str] | None]` is not assignable to parameter `outputs` with type `dict[str, object] | None` in function `TestPauseStatePersistenceLayerTestContainers._create_graph_runtime_state` [bad-argument-type]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:400:21
-ERROR Argument `dict[tuple[str, str], dict[str, str] | list[int] | str]` is not assignable to parameter `variables` with type `dict[tuple[str, str], object] | None` in function `TestPauseStatePersistenceLayerTestContainers._create_graph_runtime_state` [bad-argument-type]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:403:23
-ERROR Object of class `FixtureFunctionDefinition` has no attribute `_workflow_runs` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:415:24
-ERROR Object of class `AdvancedChatAppGenerateEntity` has no attribute `workflow_execution_id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:427:16
-ERROR Argument `dict[str, LiteralString]` is not assignable to parameter `outputs` with type `dict[str, object] | None` in function `TestPauseStatePersistenceLayerTestContainers._create_graph_runtime_state` [bad-argument-type]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:468:21
-ERROR Object of class `AdvancedChatAppGenerateEntity` has no attribute `workflow_execution_id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:492:16
-ERROR Object of class `FixtureFunctionDefinition` has no attribute `_workflow_runs` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:554:24
-ERROR Object of class `AdvancedChatAppGenerateEntity` has no attribute `workflow_execution_id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:557:16
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:38:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -628,12 +602,6 @@
    --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:589:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:599:23
-ERROR Argument `core.workflow.nodes.human_input.entities.HumanInputNodeData` is not assignable to parameter `data` with type `graphon.nodes.human_input.entities.HumanInputNodeData` in function `graphon.nodes.human_input.human_input_node.HumanInputNode.__init__` [bad-argument-type]
-  --> tests/test_containers_integration_tests/core/workflow/test_human_input_resume_node_execution.py:96:14
-ERROR Argument `Connection | Engine` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown]` in function `core.repositories.sqlalchemy_workflow_execution_repository.SQLAlchemyWorkflowExecutionRepository.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/core/workflow/test_human_input_resume_node_execution.py:249:29
-ERROR Argument `Connection | Engine` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown]` in function `core.repositories.sqlalchemy_workflow_node_execution_repository.SQLAlchemyWorkflowNodeExecutionRepository.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/core/workflow/test_human_input_resume_node_execution.py:256:29
 ERROR Argument `Literal['owner']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/helpers/execution_extra_content.py:48:14
 ERROR Returned type `int | str` is not assignable to declared return type `str` [bad-return]
@@ -648,12 +616,6 @@
    --> tests/test_containers_integration_tests/models/test_types_enum_text.py:147:20
 ERROR Object of class `NoneType` has no attribute `user_type_nullable` [missing-attribute]
    --> tests/test_containers_integration_tests/models/test_types_enum_text.py:148:20
-ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_synchronously`, `save_execution_data`, `get_by_workflow_execution` [bad-instantiation]
-  --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:72:70
-ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_synchronously`, `save_execution_data`, `get_by_workflow_execution` [bad-instantiation]
-  --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:89:70
-ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_synchronously`, `save_execution_data`, `get_by_workflow_execution` [bad-instantiation]
-   --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_node_execution_repository.py:151:70
 ERROR Generator function should return `Generator` [bad-return]
    --> tests/test_containers_integration_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:150:56
 ERROR Argument `str | None` is not assignable to parameter `tenant_id` with type `str` in function `_create_node_execution_model` [bad-argument-type]
@@ -727,19 +689,19 @@
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_app_generate_service.py:199:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:498:23
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:496:23
 ERROR Argument `Literal['invalid_mode']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:577:20
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:575:20
 ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `services.app_generate_service.AppGenerateService.generate_single_loop` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:838:18
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:836:18
 ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `services.app_generate_service.AppGenerateService.generate_single_loop` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:870:18
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:868:18
 ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `services.app_generate_service.AppGenerateService.generate_single_loop` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:901:22
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:899:22
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:953:23
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:951:23
 ERROR Argument `Literal['agent-chat']` is not assignable to parameter `value` with type `AppMode | SQLCoreOperations[AppMode]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_generate_service.py:1089:20
+    --> tests/test_containers_integration_tests/services/test_app_generate_service.py:1087:20
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
   --> tests/test_containers_integration_tests/services/test_app_service.py:86:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -1074,11 +1036,11 @@
     --> tests/test_containers_integration_tests/services/test_workflow_service.py:1313:20
 ERROR `Literal['total_tokens']` is not assignable to dict key type `WorkflowNodeExecutionMetadataKey` [bad-assignment]
     --> tests/test_containers_integration_tests/services/test_workflow_service.py:1661:27
-ERROR Argument `() -> tuple[_ExecutedNode, Generator[NodeRunSucceededEvent, Unknown]]` is not assignable to parameter `invoke_node_fn` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase | IterationFrameRequest | LoopFrameRequest]]` in function `services.workflow_service.WorkflowService._handle_single_step_result` [bad-argument-type]
+ERROR Argument `() -> tuple[_ExecutedNode, Generator[NodeRunSucceededEvent, Unknown]]` is not assignable to parameter `invoke_node_fn` with type `() -> tuple[Node[Unknown], Generator[CustomContainerRequest | IterationFrameRequest | LoopFrameRequest | NodeEvent]]` in function `services.workflow_service.WorkflowService._handle_single_step_result` [bad-argument-type]
     --> tests/test_containers_integration_tests/services/test_workflow_service.py:1683:28
-ERROR Argument `() -> tuple[_ExecutedNode, Generator[NodeRunFailedEvent, Unknown]]` is not assignable to parameter `invoke_node_fn` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase | IterationFrameRequest | LoopFrameRequest]]` in function `services.workflow_service.WorkflowService._handle_single_step_result` [bad-argument-type]
+ERROR Argument `() -> tuple[_ExecutedNode, Generator[NodeRunFailedEvent, Unknown]]` is not assignable to parameter `invoke_node_fn` with type `() -> tuple[Node[Unknown], Generator[CustomContainerRequest | IterationFrameRequest | LoopFrameRequest | NodeEvent]]` in function `services.workflow_service.WorkflowService._handle_single_step_result` [bad-argument-type]
     --> tests/test_containers_integration_tests/services/test_workflow_service.py:1751:28
-ERROR Argument `() -> tuple[_ExecutedNode, Generator[NodeRunFailedEvent, Unknown]]` is not assignable to parameter `invoke_node_fn` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase | IterationFrameRequest | LoopFrameRequest]]` in function `services.workflow_service.WorkflowService._handle_single_step_result` [bad-argument-type]
+ERROR Argument `() -> tuple[_ExecutedNode, Generator[NodeRunFailedEvent, Unknown]]` is not assignable to parameter `invoke_node_fn` with type `() -> tuple[Node[Unknown], Generator[CustomContainerRequest | IterationFrameRequest | LoopFrameRequest | NodeEvent]]` in function `services.workflow_service.WorkflowService._handle_single_step_result` [bad-argument-type]
     --> tests/test_containers_integration_tests/services/test_workflow_service.py:1818:28
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/tools/test_mcp_tools_manage_service.py:63:20
@@ -1216,8 +1178,6 @@
    --> tests/test_containers_integration_tests/services/workflow/test_workflow_converter.py:659:16
 ERROR Argument `Literal['owner']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/workflow/test_workflow_deletion.py:38:18
-ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `save_synchronously`, `save_execution_data`, `get_by_workflow_execution` [bad-instantiation]
-  --> tests/test_containers_integration_tests/services/workflow/test_workflow_node_execution_service_repository.py:21:64
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/tasks/test_add_document_to_index_task.py:56:20
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
@@ -1663,9 +1623,9 @@
 ERROR Generator function should return `Generator` [bad-return]
   --> tests/unit_tests/controllers/console/tag/test_tags.py:66:23
 ERROR Argument `SimpleNamespace` is not assignable to parameter `form` with type `Form` in function `controllers.console.human_input_form._jsonify_form_definition` [bad-argument-type]
-  --> tests/unit_tests/controllers/console/test_human_input_form.py:83:41
+  --> tests/unit_tests/controllers/console/test_human_input_form.py:85:41
 ERROR Argument `SimpleNamespace` is not assignable to parameter `form` with type `Form` in function `controllers.console.human_input_form.ConsoleHumanInputFormApi._ensure_console_access` [bad-argument-type]
-  --> tests/unit_tests/controllers/console/test_human_input_form.py:94:57
+  --> tests/unit_tests/controllers/console/test_human_input_form.py:96:57
 ERROR Type `Response` is not iterable [not-iterable]
    --> tests/unit_tests/controllers/console/test_wraps.py:304:17
 ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
@@ -1727,17 +1687,19 @@
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
   --> tests/unit_tests/controllers/openapi/test_account.py:69:18
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
-  --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:89:18
+   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:156:20
+ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
+   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:159:17
 ERROR Object of class `Resource` has no attribute `post` [missing-attribute]
-   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:149:20
+   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:216:20
 ERROR Object of class `Resource` has no attribute `post` [missing-attribute]
-   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:164:13
+   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:231:13
 ERROR Object of class `Resource` has no attribute `post` [missing-attribute]
-   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:189:9
+   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:264:9
 ERROR Object of class `Resource` has no attribute `post` [missing-attribute]
-   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:212:20
+   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:287:20
 ERROR Object of class `Resource` has no attribute `post` [missing-attribute]
-   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:230:20
+   --> tests/unit_tests/controllers/openapi/test_app_run_streaming.py:305:20
 ERROR Object of class `FunctionType` has no attribute `view_class` [missing-attribute]
   --> tests/unit_tests/controllers/openapi/test_device_approve_deny.py:41:12
 ERROR Object of class `FunctionType` has no attribute `view_class` [missing-attribute]
@@ -1767,19 +1729,19 @@
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
    --> tests/unit_tests/controllers/openapi/test_human_input_form.py:229:20
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
-   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:135:17
+   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:132:17
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
-   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:154:17
+   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:151:17
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
-   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:168:17
+   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:165:17
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
-   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:183:20
+   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:180:20
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
-   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:225:20
+   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:222:20
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
-   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:258:20
+   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:252:20
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
-   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:280:20
+   --> tests/unit_tests/controllers/openapi/test_workflow_events_openapi.py:271:20
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
    --> tests/unit_tests/controllers/openapi/test_workspaces_members.py:242:14
 ERROR Object of class `FunctionType` has no attribute `__handler__` [missing-attribute]
@@ -1819,15 +1781,15 @@
 ERROR Missing argument `session` in function `services.conversation_service.ConversationService.pagination_by_last_id` [missing-argument]
    --> tests/unit_tests/controllers/service_api/app/test_conversation.py:531:59
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
-   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:513:27
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:512:27
 ERROR Argument `(**kwargs: Unknown) -> None` is not assignable to parameter `draft_var_saver_factory` with type `DraftVariableSaverFactory` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
-   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:525:37
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:524:37
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
-   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:605:27
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:604:27
 ERROR Argument `(**kwargs: Unknown) -> None` is not assignable to parameter `draft_var_saver_factory` with type `DraftVariableSaverFactory` in function `core.app.apps.workflow.generate_task_pipeline.WorkflowAppGenerateTaskPipeline.__init__` [bad-argument-type]
-   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:608:37
-ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `core.app.apps.common.workflow_response_converter.WorkflowResponseConverter.workflow_pause_to_stream_response` [bad-argument-type]
-   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:698:33
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:607:37
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `RuntimeState` in function `core.app.apps.common.workflow_response_converter.WorkflowResponseConverter.workflow_pause_to_stream_response` [bad-argument-type]
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:697:33
 ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]
   --> tests/unit_tests/controllers/service_api/conftest.py:39:16
 ERROR Argument `Literal['completed']` is not assignable to parameter `status` with type `SQLCoreOperations[SegmentStatus] | SegmentStatus` in function `models.dataset.DocumentSegment.__init__` [bad-argument-type]
@@ -2101,79 +2063,79 @@
 ERROR `in` is not supported between `Literal['Question: What is Python?']` and `None` [not-iterable]
    --> tests/unit_tests/core/agent/test_cot_completion_agent_runner.py:180:16
 ERROR `Literal[0]` is not assignable to attribute `prompt_price` with type `Decimal` [bad-assignment]
-  --> tests/unit_tests/core/agent/test_fc_agent_runner.py:50:26
+  --> tests/unit_tests/core/agent/test_fc_agent_runner.py:51:26
 ERROR `Literal[0]` is not assignable to attribute `completion_price` with type `Decimal` [bad-assignment]
-  --> tests/unit_tests/core/agent/test_fc_agent_runner.py:51:30
+  --> tests/unit_tests/core/agent/test_fc_agent_runner.py:52:30
 ERROR `Literal[0]` is not assignable to attribute `total_price` with type `Decimal` [bad-assignment]
-  --> tests/unit_tests/core/agent/test_fc_agent_runner.py:52:25
+  --> tests/unit_tests/core/agent/test_fc_agent_runner.py:53:25
 ERROR Missing argument `session` in function `core.agent.base_agent_runner.BaseAgentRunner.__init__` [missing-argument]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:191:37
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:193:37
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:223:5
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:226:5
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:234:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:237:9
 ERROR Argument `None` is not assignable to parameter `query` with type `str` in function `core.agent.fc_agent_runner.FunctionCallAgentRunner._organize_user_query` [bad-argument-type]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:335:46
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:338:46
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:403:58
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:406:58
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:451:19
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:454:19
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:508:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:511:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:510:35
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:513:35
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:512:33
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:515:33
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:513:33
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:516:33
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:514:16
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:517:16
 ERROR Object of class `FunctionType` has no attribute `assert_called` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:519:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:522:9
 ERROR Object of class `FunctionType` has no attribute `call_args_list` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:521:23
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:524:23
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:527:19
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:530:19
 ERROR Argument `list[TextPromptMessageContent]` is not assignable to parameter `content` with type `str | None` in function `DummyMessage.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:544:57
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:547:57
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:550:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:553:9
 ERROR Argument `list[TextPromptMessageContent]` is not assignable to parameter `content` with type `str | None` in function `DummyMessage.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:566:57
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:569:57
 ERROR Object of class `FunctionType` has no attribute `side_effect` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:574:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:577:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:576:35
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:579:35
 ERROR Argument `list[TextPromptMessageContent]` is not assignable to parameter `content` with type `str | None` in function `DummyMessage.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:582:46
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:585:46
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:585:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:588:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:587:35
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:590:35
 ERROR Object of class `FunctionType` has no attribute `call_args` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:589:16
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:592:16
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:605:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:608:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:616:35
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:619:35
 ERROR Object of class `FunctionType` has no attribute `side_effect` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:632:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:635:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:634:35
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:637:35
 ERROR Object of class `FunctionType` has no attribute `side_effect` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:649:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:652:9
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:654:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:657:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:663:35
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:666:35
 ERROR Object of class `FunctionType` has no attribute `call_args_list` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:669:25
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:672:25
 ERROR Object of class `NoneType` has no attribute `max_iteration` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:673:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:676:9
 ERROR Object of class `FunctionType` has no attribute `return_value` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:685:9
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:688:9
 ERROR Object of class `FunctionCallAgentRunner` has no attribute `session` [missing-attribute]
-   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:688:29
+   --> tests/unit_tests/core/agent/test_fc_agent_runner.py:691:29
 ERROR Missing argument `description` in function `core.agent.plugin_entities.AgentStrategyEntity.__init__` [missing-argument]
    --> tests/unit_tests/core/agent/test_plugin_entities.py:292:32
 ERROR Argument `dict[Unknown, Unknown]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.variables.manager.BasicVariablesConfigManager.convert` [bad-argument-type]
@@ -2187,87 +2149,87 @@
 ERROR Expected a mapping, got object | None [invalid-argument]
   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_config_manager.py:41:29
 ERROR Argument `SimpleNamespace` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.single_loop_generate` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:176:22
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:177:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.single_loop_generate` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:187:22
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:188:22
 ERROR Object of class `object` has no attribute `files` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:288:16
-ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.resume` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:331:33
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:289:16
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `RuntimeState` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.resume` [bad-argument-type]
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:332:33
 ERROR Object of type `Generator[Mapping[str, Any] | str] | Mapping[str, Any]` has no attribute `resumed` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:335:16
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:336:16
 ERROR Object of class `object` has no attribute `single_iteration_run` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:400:16
-ERROR Object of class `object` has no attribute `extras` [missing-attribute]
    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:401:16
+ERROR Object of class `object` has no attribute `extras` [missing-attribute]
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:402:16
 ERROR Argument `SimpleNamespace` is not assignable to parameter `args` with type `LoopNodeRunPayload` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.single_loop_generate` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:453:18
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:454:18
 ERROR Object of class `object` has no attribute `single_loop_run` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:463:16
-ERROR Object of class `object` has no attribute `extras` [missing-attribute]
    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:464:16
+ERROR Object of class `object` has no attribute `extras` [missing-attribute]
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:465:16
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pause_state_config` with type `PauseStateLayerConfig | None` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:567:32
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:564:32
 ERROR Cannot index into `Generator[Mapping[str, Any] | str]` [bad-index]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:570:16
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:567:16
 ERROR Cannot index into `object` [bad-index]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:574:33
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:571:16
 ERROR Argument `SimpleNamespace` is not assignable to parameter `flask_app` with type `Flask` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:726:27
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:723:27
 ERROR Argument `SimpleNamespace` is not assignable to parameter `context` with type `Context` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:731:25
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:728:25
 ERROR Argument `SimpleNamespace` is not assignable to parameter `flask_app` with type `Flask` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:778:27
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:774:27
 ERROR Argument `SimpleNamespace` is not assignable to parameter `context` with type `Context` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:783:25
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:779:25
 ERROR Argument `SimpleNamespace` is not assignable to parameter `flask_app` with type `Flask` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:841:23
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:836:23
 ERROR Argument `SimpleNamespace` is not assignable to parameter `context` with type `Context` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:846:21
-ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState | None` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:851:33
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:841:21
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `RuntimeState | None` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:845:33
 ERROR Argument `SimpleNamespace` is not assignable to parameter `flask_app` with type `Flask` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:915:23
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:909:23
 ERROR Argument `SimpleNamespace` is not assignable to parameter `context` with type `Context` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:920:21
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:914:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `flask_app` with type `Flask` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:984:27
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:977:27
 ERROR Argument `SimpleNamespace` is not assignable to parameter `context` with type `Context` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:989:25
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:982:25
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._handle_advanced_chat_response` [bad-argument-type]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1041:31
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1033:31
 ERROR Argument `(**kwargs: Unknown) -> None` is not assignable to parameter `draft_var_saver_factory` with type `DraftVariableSaverFactory` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._handle_advanced_chat_response` [bad-argument-type]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1051:41
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1043:41
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._handle_advanced_chat_response` [bad-argument-type]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1089:35
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1081:35
 ERROR Argument `(**kwargs: Unknown) -> None` is not assignable to parameter `draft_var_saver_factory` with type `DraftVariableSaverFactory` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._handle_advanced_chat_response` [bad-argument-type]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1099:45
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1091:45
 ERROR Argument `SimpleNamespace` is not assignable to parameter `flask_app` with type `Flask` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1163:23
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1155:23
 ERROR Argument `SimpleNamespace` is not assignable to parameter `context` with type `Context` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator._generate_worker` [bad-argument-type]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1168:21
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1160:21
 ERROR Object of class `NoneType` has no attribute `show_retrieve_source` [missing-attribute]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1250:16
-ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.resume` [bad-argument-type]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1391:33
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1241:16
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `RuntimeState` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.resume` [bad-argument-type]
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1382:33
 ERROR Object of type `Generator[Mapping[str, Any] | str] | Mapping[str, Any]` has no attribute `ok` [missing-attribute]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1394:16
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1385:16
 ERROR Object of class `NoneType` has no attribute `app_id` [missing-attribute]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1398:16
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1389:16
 ERROR Object of class `NoneType` has no attribute `user_id` [missing-attribute]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1399:16
-ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.resume` [bad-argument-type]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1439:33
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1390:16
+ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `RuntimeState` in function `core.app.apps.advanced_chat.app_generator.AdvancedChatAppGenerator.resume` [bad-argument-type]
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1430:33
 ERROR Object of type `Generator[Mapping[str, Any] | str] | Mapping[str, Any]` has no attribute `ok` [missing-attribute]
-    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1442:16
+    --> tests/unit_tests/core/app/apps/advanced_chat/test_app_generator.py:1433:16
 ERROR Argument `list[object]` is not assignable to parameter `value` with type `Sequence[VariableBase]` in function `models.workflow.Workflow.conversation_variables` [bad-argument-type]
   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_runner_conversation_variables.py:45:39
 ERROR Argument `object` is not assignable to parameter `variable` with type `VariableBase` in function `models.workflow.ConversationVariable.from_variable` [bad-argument-type]
-  --> tests/unit_tests/core/app/apps/advanced_chat/test_app_runner_conversation_variables.py:76:22
+  --> tests/unit_tests/core/app/apps/advanced_chat/test_app_runner_conversation_variables.py:74:22
 ERROR Argument `list[VariableBase]` is not assignable to parameter `workflow_variables` with type `list[object]` in function `_runner` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_runner_conversation_variables.py:109:25
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_runner_conversation_variables.py:107:25
 ERROR Argument `list[VariableBase]` is not assignable to parameter `workflow_variables` with type `list[object]` in function `_runner` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_runner_conversation_variables.py:126:25
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_app_runner_conversation_variables.py:124:25
 ERROR Cannot index into `str` [bad-index]
    --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_response_converter.py:129:16
 ERROR Cannot index into `str` [bad-index]
@@ -2275,107 +2237,105 @@
 ERROR Cannot index into `str` [bad-index]
    --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_response_converter.py:131:16
 ERROR `SimpleNamespace` is not assignable to attribute `_application_generate_entity` with type `AdvancedChatAppGenerateEntity` [bad-assignment]
-  --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:42:45
+  --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:61:45
 ERROR `SimpleNamespace` is not assignable to attribute `_base_task_pipeline` with type `BasedGenerateTaskPipeline[Unknown]` [bad-assignment]
-  --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:44:36
-ERROR `SimpleNamespace` is not assignable to attribute `_application_generate_entity` with type `AdvancedChatAppGenerateEntity` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:109:45
+  --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:63:36
 ERROR Argument `SimpleNamespace` is not assignable to parameter `application_generate_entity` with type `AdvancedChatAppGenerateEntity` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:173:37
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:199:37
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:175:23
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:201:23
 ERROR Argument `SimpleNamespace` is not assignable to parameter `application_generate_entity` with type `AdvancedChatAppGenerateEntity` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:227:37
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:253:37
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:229:23
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:255:23
 ERROR Argument `SimpleNamespace` is not assignable to parameter `application_generate_entity` with type `AdvancedChatAppGenerateEntity` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:304:37
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:330:37
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:306:23
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:332:23
 ERROR Argument `SimpleNamespace` is not assignable to parameter `application_generate_entity` with type `AdvancedChatAppGenerateEntity` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:371:37
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:397:37
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:373:23
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:399:23
 ERROR `SimpleNamespace` is not assignable to attribute `_application_generate_entity` with type `AdvancedChatAppGenerateEntity` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:411:45
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:437:45
 ERROR `SimpleNamespace` is not assignable to attribute `_application_generate_entity` with type `AdvancedChatAppGenerateEntity` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:433:45
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline.py:459:45
 ERROR Argument `SimpleNamespace` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
    --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:104:23
 ERROR Argument `(**kwargs: Unknown) -> None` is not assignable to parameter `draft_var_saver_factory` with type `DraftVariableSaverFactory` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline.__init__` [bad-argument-type]
    --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:110:33
 ERROR `SimpleNamespace` is not assignable to attribute `_message_cycle_manager` with type `MessageCycleManager` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:225:43
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:226:43
 ERROR Argument `SimpleNamespace` is not assignable to parameter `event` with type `QueueTextChunkEvent` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline._handle_text_chunk_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:233:60
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:234:60
 ERROR Argument `SimpleNamespace` is not assignable to parameter `publisher` with type `AppGeneratorTTSPublisher | None` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline._listen_audio_msg` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:278:57
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:279:57
 ERROR `(err: Unknown) -> Unknown` is not assignable to attribute `error_to_stream_response` with type `(e: Exception) -> ErrorStreamResponse` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:293:65
-ERROR `(**kwargs: str) -> Literal['started']` is not assignable to attribute `workflow_start_to_stream_response` with type `(*, task_id: str, workflow_run_id: str, workflow_id: str, reason: WorkflowStartReason) -> WorkflowStartStreamResponse` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:307:83
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:294:65
+ERROR `(**kwargs: Sequence[NodeExecutionSnapshot] | str) -> Literal['started']` is not assignable to attribute `workflow_start_to_stream_response` with type `(*, task_id: str, workflow_run_id: str, workflow_id: str, reason: WorkflowStartReason, node_execution_snapshots: Sequence[NodeExecutionSnapshot] = ...) -> WorkflowStartStreamResponse` [bad-assignment]
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:309:83
 ERROR `TestAdvancedChatGenerateTaskPipeline.test_handle_output_moderation_chunk_publishes_stop._Moderation` is not assignable to attribute `output_moderation_handler` with type `OutputModeration | None` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:341:66
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:343:66
 ERROR `SimpleNamespace` is not assignable to attribute `queue_manager` with type `AppQueueManager` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:342:54
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:344:54
 ERROR `(outputs: Unknown) -> list[dict[str, str]]` is not assignable to attribute `fetch_files_from_node_outputs` with type `(outputs_dict: Mapping[str, Any] | None) -> Sequence[Mapping[str, Any]]` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:355:79
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:357:79
 ERROR `(**kwargs: QueueNodeExceptionEvent | QueueNodeFailedEvent | QueueNodeSucceededEvent | str) -> Literal['done']` is not assignable to attribute `workflow_node_finish_to_stream_response` with type `(*, event: QueueNodeExceptionEvent | QueueNodeFailedEvent | QueueNodeSucceededEvent, task_id: str) -> NodeFinishStreamResponse | None` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:358:89
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:360:89
 ERROR Argument `SimpleNamespace` is not assignable to parameter `event` with type `QueueNodeSucceededEvent` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline._handle_node_succeeded_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:368:64
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:370:64
 ERROR `(outputs: Unknown) -> list[@_]` is not assignable to attribute `fetch_files_from_node_outputs` with type `(outputs_dict: Mapping[str, Any] | None) -> Sequence[Mapping[str, Any]]` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:375:79
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:377:79
 ERROR `(**kwargs: QueueNodeExceptionEvent | QueueNodeFailedEvent | QueueNodeSucceededEvent | str) -> Literal['done']` is not assignable to attribute `workflow_node_finish_to_stream_response` with type `(*, event: QueueNodeExceptionEvent | QueueNodeFailedEvent | QueueNodeSucceededEvent, task_id: str) -> NodeFinishStreamResponse | None` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:376:89
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:378:89
 ERROR Argument `SimpleNamespace` is not assignable to parameter `event` with type `QueueNodeSucceededEvent` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline._handle_node_succeeded_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:386:52
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:388:52
 ERROR `(outputs: Unknown) -> list[@_]` is not assignable to attribute `fetch_files_from_node_outputs` with type `(outputs_dict: Mapping[str, Any] | None) -> Sequence[Mapping[str, Any]]` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:392:79
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:394:79
 ERROR `(**kwargs: QueueNodeExceptionEvent | QueueNodeFailedEvent | QueueNodeSucceededEvent | str) -> Literal['done']` is not assignable to attribute `workflow_node_finish_to_stream_response` with type `(*, event: QueueNodeExceptionEvent | QueueNodeFailedEvent | QueueNodeSucceededEvent, task_id: str) -> NodeFinishStreamResponse | None` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:393:89
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:395:89
 ERROR Argument `SimpleNamespace` is not assignable to parameter `event` with type `QueueNodeSucceededEvent` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline._handle_node_succeeded_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:405:52
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:407:52
 ERROR Argument `SimpleNamespace` is not assignable to parameter `event` with type `QueueNodeSucceededEvent` in function `core.app.apps.advanced_chat.generate_task_pipeline.AdvancedChatAppGenerateTaskPipeline._handle_node_succeeded_event` [bad-argument-type]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:406:52
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:408:52
 ERROR `(**kwargs: QueueIterationStartEvent | str) -> Literal['iter_start']` is not assignable to attribute `workflow_iteration_start_to_stream_response` with type `(*, task_id: str, workflow_execution_id: str, event: QueueIterationStartEvent) -> IterationNodeStartStreamResponse` [bad-assignment]
-   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:413:93
+   --> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:415:93
 ERROR `(**kwargs: QueueIterationNextEvent | str) -> Literal['iter_next']` is not assignable to attribute `workflow_iteration_next_to_stream_response` with type `(*, task_id: str, workflow_execution_\n\n... (truncated) ...

@codecov

codecov Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.43884% with 66 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.54%. Comparing base (2525118) to head (03f2481).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
...sitories/sqlalchemy_api_workflow_run_repository.py 91.96% 7 Missing and 2 partials ⚠️
api/services/human_input_service.py 65.21% 6 Missing and 2 partials ⚠️
api/services/workflow_run_agg.py 95.62% 4 Missing and 3 partials ⚠️
...positories/logstore_api_workflow_run_repository.py 86.48% 3 Missing and 2 partials ⚠️
api/core/app/apps/workflow_app_runner.py 95.18% 3 Missing and 1 partial ⚠️
api/core/repositories/human_input_repository.py 88.46% 1 Missing and 2 partials ⚠️
api/core/app/workflow/layers/observability.py 94.11% 1 Missing and 1 partial ⚠️
api/core/tools/workflow_as_tool/tool.py 60.00% 1 Missing and 1 partial ⚠️
...ow/nodes/trigger_schedule/trigger_schedule_node.py 0.00% 2 Missing ⚠️
api/enums/__init__.py 77.77% 1 Missing and 1 partial ⚠️
... and 18 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #40277      +/-   ##
==========================================
+ Coverage   88.41%   88.54%   +0.12%     
==========================================
  Files        5516     5522       +6     
  Lines      330392   331056     +664     
  Branches    66092    66206     +114     
==========================================
+ Hits       292125   293142    +1017     
+ Misses      33074    32725     -349     
+ Partials     5193     5189       -4     
Flag Coverage Δ
api 88.77% <95.16%> (+0.15%) ⬆️
cli 94.06% <ø> (+3.50%) ⬆️
dify-ui 91.67% <ø> (ø)
web 87.94% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@laipz8200
laipz8200 force-pushed the laipz8200/adapt-graphon-engine-architecture branch 4 times, most recently from 56a1eb9 to 938617a Compare August 22, 2026 14:01
@github-actions github-actions Bot added the web This relates to changes on the web. label Aug 22, 2026
@laipz8200
laipz8200 force-pushed the laipz8200/adapt-graphon-engine-architecture branch 5 times, most recently from c12e680 to 92417b3 Compare August 27, 2026 09:58
@laipz8200
laipz8200 force-pushed the laipz8200/adapt-graphon-engine-architecture branch 3 times, most recently from b820a4a to 059af42 Compare September 5, 2026 07:22
@laipz8200
laipz8200 force-pushed the laipz8200/adapt-graphon-engine-architecture branch from 9f5c292 to 3648a2a Compare September 8, 2026 06:12
@laipz8200
laipz8200 force-pushed the laipz8200/adapt-graphon-engine-architecture branch from 94309f0 to 5ab7cf1 Compare September 8, 2026 20:51
@laipz8200
laipz8200 force-pushed the laipz8200/adapt-graphon-engine-architecture branch 2 times, most recently from 66caa10 to 85faed5 Compare September 9, 2026 16:01
@laipz8200 laipz8200 added this to the next milestone Sep 9, 2026
@laipz8200
laipz8200 force-pushed the laipz8200/adapt-graphon-engine-architecture branch from 2f81f5a to cf8b587 Compare September 10, 2026 16:28
@laipz8200
laipz8200 marked this pull request as ready for review September 10, 2026 20:17
@laipz8200
laipz8200 requested a review from a team September 10, 2026 20:17
Keep legacy completion and chat stops on the application service transport. Forward the injected Redis client through durable workflow cancellation while preserving tenant, app, role, and user admission for installed and trial workflows.
Drop code that Graphon 0.8 orchestration left without effect: the advanced
chat graph-layer pass-through, placeholder layer hooks, the second
command-channel delete after fetch_commands, the duplicate published-form
check, unused WorkflowEntry and _run_node_with_layers parameters, the
closing() wrapper around yield from, the dead SuspendLayer, and the
generator-only get_response_generator. Non-workflow stops no longer write
an Engine abort that no runner reads, so AppTaskControlService.stop_task
loses its app_mode switch.

Make always-passed call_depth, execution_driver, pause_state_config and
root_executions arguments required, let event-stream readers call the
generator classmethods instead of building driver-bound instances, and
reuse comparisonOperatorNotRequireValue for list filter references.
Update the existing advanced-chat integration fixture and assertions to call retrieve_events and convert_to_event_stream on the generator class. Preserve the instance conversion fixture used by blocking generation.
Construct validated workflow, model, session, and LogStore objects in workflow control and human input tests. Patch external I/O at callable boundaries while preserving ownership, persistence, and event assertions.
Wait for settings to close and paste the setup prompt in one interaction, avoiding unnecessary per-character Builder renders under coverage while retaining the parameter edit and request assertion.
Keep the real Celery task and isolate its apply_async method so pause publication follows the successful notification path. Assert that the normal pause cases never log a dispatch failure.
Wait for the Builder landmark before querying its model-settings control. Scope the control lookup to that landmark so page loading and model loading do not compete within one asynchronous query deadline.
Move caller-aware stop admission into AppTaskControlService so external SSO and resource-token users can stop only their own tasks. Preserve account app-wide behavior and route non-workflow ownership through the existing queue check without duplicate Redis reads.
Add a bounded, repeatable upgrade backfill through the existing task-control service. Validate saved invocation ownership and index only the same unchanged pause, then fail explicitly if active legacy runs remain unresolved. Share the snapshot validation with event replay and document the required worker drain.
Resolve node ownership using the complete graph before connecting incoming-free root nodes. Keep nested loop and iteration entry points inside their containers and preserve invalid ownership errors and the original draft graph.
Expand descendant discovery and selected-node copying into explicit steps while retaining ownership resolution, termination, validation, and caller-owned graph data.
Treat retrying attempts as unfinished during terminal cleanup, pause persistence, durable stop, and delayed SQL/Celery/Logstore writes. Preserve completed retry attempts, completed node history, and the existing paused-node behavior during graph failure.
Reuse the application-services fixture when injecting the task-control service into stop-route tests. Preserve caller ownership coverage while removing new SimpleNamespace service containers rejected by the CI guard.
Use the persisted workflow enum and SQLAlchemy tuple results in legacy backfill coverage. Assert the complete retained retry history without indexing nullable process data.
Keep the accumulated execution duration introduced upstream when cancelling a paused workflow, publishing its terminal history, and overriding delayed Logstore writes. Preserve the durable stopped duration instead of replacing it with time spent awaiting input.

Align existing cancellation fixtures with the timed execution entity and current lint rules.
Remove the B903 suppression from WorkflowBasedAppRunner because its Graphon orchestration methods make it ineligible for the dataclass rule.
Match the human-input email schema errors and legacy task backfill failures so the stack satisfies upstream Ruff PT011 while checking the intended failure paths.
41tair
41tair previously approved these changes Oct 19, 2026
iamjoel
iamjoel previously approved these changes Oct 19, 2026
hyoban
hyoban previously approved these changes Oct 19, 2026

@hyoban hyoban left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the frontend changes.

Replace the required global Flask backfill with app- and owner-scoped recovery from saved pauses when stopping, replaying, or resuming a workflow. Reuse conditional task binding and locked stop/resume transitions, keep durable UUIDs authoritative, and mark recovery for removal 30 days after the final legacy writer retires.

Keep task_id and stop_requested_at nullable and build their partial PostgreSQL index concurrently in one retryable migration. Tolerate schema changes left by interrupted upgrades and downgrades without rewriting historical rows. Preserve per-commit CI coverage regeneration for the rebased stack.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants