Skip to content

fix(api): avoid infinite loop in _delete_records when batch deletion fails#38118

Merged
fatelei merged 3 commits into
langgenius:mainfrom
p2003722:fix/celery-infinite-loop-in-delete-records
Jun 30, 2026
Merged

fix(api): avoid infinite loop in _delete_records when batch deletion fails#38118
fatelei merged 3 commits into
langgenius:mainfrom
p2003722:fix/celery-infinite-loop-in-delete-records

Conversation

@p2003722

@p2003722 p2003722 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes an infinite loop vulnerability in remove_app_and_related_data_task.py.

When _delete_records processes a batch of records, if a single record fails to be deleted (e.g., due to an ORM mapping ValueError from malformed or dirty data), the previous code executed a break which only exited the inner for loop. This caused the outer while True loop to continuously fetch and fail on the same 1000 records without end, completely bypassing Celery's max_retries safeguard and causing massive disk exhaustion (Poison Pill).

Changes made:

  • Changed break to continue to allow the loop to process the rest of the records in the batch.
  • Added a success_count to track successful deletions. If the entire batch fails (0 successes), the outer while True loop is explicitly broken to prevent an infinite loop, allowing the Celery task to gracefully throw an error and follow standard retry policies.

Related Issue

Resolves #38117

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@p2003722 p2003722 requested a review from QuantumGhost as a code owner June 28, 2026 18:22
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 28, 2026
fatelei
fatelei previously approved these changes Jun 30, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-06-30 14:15:10.185191150 +0000
+++ /tmp/pyrefly_pr.txt	2026-06-30 14:14:57.766063569 +0000
@@ -823,37 +823,37 @@
 ERROR Argument `str | None` is not assignable to parameter `created_by` with type `SQLCoreOperations[str] | str` in function `models.model.MessageAgentThought.__init__` [bad-argument-type]
     --> tests/test_containers_integration_tests/services/test_agent_service.py:1006:24
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:104:38
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:103:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:107:81
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:106:81
 ERROR Argument `dict[str, str | Unknown | None]` is not assignable to parameter `args` with type `InsertAnnotationArgs` in function `services.annotation_service.AppAnnotationService.insert_app_annotation_directly` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:244:65
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:239:65
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.annotation_service.AppAnnotationService.update_app_annotation_directly` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:292:13
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:285:50
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.annotation_service.AppAnnotationService.delete_app_annotation` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:580:94
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:573:75
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.annotation_service.AppAnnotationService.delete_app_annotation` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:613:65
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:601:92
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.annotation_service.AppAnnotationService.delete_app_annotation` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:629:17
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:615:92
 ERROR Object of class `str` has no attribute `decode` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:708:33
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:693:33
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:927:27
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:910:27
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:973:27
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:956:27
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `id` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1015:23
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:998:23
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `score_threshold` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1016:23
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:999:23
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `embedding_model` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1017:23
+    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1000:23
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `embedding_model` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1018:23
+    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1001:23
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.annotation_service.AppAnnotationService.update_app_annotation_directly` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1251:13
+    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1232:50
 ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.annotation_service.AppAnnotationService.delete_app_annotation` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1322:94
+    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1303:75
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:226:45
 ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
@@ -1085,7 +1085,7 @@
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/test_dataset_service.py:40:58
 ERROR Argument `Literal['invalid_action']` is not assignable to parameter `action` with type `Literal['archive', 'disable', 'enable', 'un_archive']` in function `services.dataset_service.DocumentService.batch_update_document_status` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_dataset_service_batch_update_document_status.py:738:24
+   --> tests/test_containers_integration_tests/services/test_dataset_service_batch_update_document_status.py:712:64
 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/test_dataset_service_create_dataset.py:36:18
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
@@ -1327,31 +1327,31 @@
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
    --> tests/test_containers_integration_tests/services/test_webapp_auth_service.py:715:20
 ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:293:88
+   --> tests/test_containers_integration_tests/services/test_webhook_service.py:290:88
 ERROR Argument `dict[str, dict[str, str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:312:83
+   --> tests/test_containers_integration_tests/services/test_webhook_service.py:309:83
 ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:333:83
+   --> tests/test_containers_integration_tests/services/test_webhook_service.py:330:83
 ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:355:88
+   --> tests/test_containers_integration_tests/services/test_webhook_service.py:352:88
 ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:380:83
+   --> tests/test_containers_integration_tests/services/test_webhook_service.py:377:83
 ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:402:83
+   --> tests/test_containers_integration_tests/services/test_webhook_service.py:399:83
 ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:425:88
+   --> tests/test_containers_integration_tests/services/test_webhook_service.py:422:88
 ERROR Argument `dict[str, dict[Unknown, Unknown]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:483:79
+   --> tests/test_containers_integration_tests/services/test_webhook_service.py:480:79
 ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:493:79
+   --> tests/test_containers_integration_tests/services/test_webhook_service.py:490:79
 ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:503:79
+   --> tests/test_containers_integration_tests/services/test_webhook_service.py:500:79
 ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_webhook_service.py:512:79
+   --> tests/test_containers_integration_tests/services/test_webhook_service.py:509:79
 ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
-  --> tests/test_containers_integration_tests/services/test_webhook_service_relationships.py:40:72
+  --> tests/test_containers_integration_tests/services/test_webhook_service_relationships.py:39:72
 ERROR Class `WebhookServiceRelationshipFactory` has no class attribute `_read_cache` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_webhook_service_relationships.py:516:26
+   --> tests/test_containers_integration_tests/services/test_webhook_service_relationships.py:481:26
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_workflow_app_service.py:102:38
 ERROR Argument `SimpleNamespace` is not assignable to parameter `log` with type `WorkflowAppLog` in function `services.workflow_app_service.LogView.__init__` [bad-argument-type]
@@ -1389,15 +1389,15 @@
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_workflow_run_service.py:651:38
 ERROR Argument `str | None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-  --> tests/test_containers_integration_tests/services/test_workflow_service.py:68:21
+  --> tests/test_containers_integration_tests/services/test_workflow_service.py:67:21
 ERROR Argument `Literal['single-step']` is not assignable to parameter `value` with type `SQLCoreOperations[WorkflowNodeExecutionTriggeredFrom] | WorkflowNodeExecutionTriggeredFrom` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_workflow_service.py:169:41
+   --> tests/test_containers_integration_tests/services/test_workflow_service.py:168:41
 ERROR Argument `Literal['succeeded']` is not assignable to parameter `value` with type `SQLCoreOperations[WorkflowNodeExecutionStatus] | WorkflowNodeExecutionStatus` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_workflow_service.py:174:33
+   --> tests/test_containers_integration_tests/services/test_workflow_service.py:173:33
 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_workflow_service.py:1293:20
+    --> tests/test_containers_integration_tests/services/test_workflow_service.py:1292:20
 ERROR Argument `dict[str, int]` is not assignable to parameter `metadata` with type `Mapping[WorkflowNodeExecutionMetadataKey, Any]` in function `graphon.node_events.base.NodeRunResult.__init__` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_workflow_service.py:1647:26
+    --> tests/test_containers_integration_tests/services/test_workflow_service.py:1641:26
 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/test_workspace_service.py:53: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]
@@ -1587,7 +1587,7 @@
 ERROR `None` is not subscriptable [unsupported-operation]
    --> tests/test_containers_integration_tests/services/workflow/test_workflow_converter.py:654: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
+  --> tests/test_containers_integration_tests/services/workflow/test_workflow_deletion.py:37:18
 ERROR Cannot instantiate `DifyAPISQLAlchemyWorkflowNodeExecutionRepository` because the following members are abstract: `save`, `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]
@@ -1938,34 +1938,28 @@
   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:36:38
 ERROR Object of class `FromClause` has no attribute `insert` [missing-attribute]
    --> tests/unit_tests/commands/test_legacy_model_type_migration.py:204:13
-ERROR Argument `list[SimpleNamespace] | list[Unknown]` is not assignable to parameter `rows` with type `list[object]` in function `FakeExecuteResult.__init__` [bad-argument-type]
-   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:405:38
-ERROR Object of class `object` has no attribute `scope` [missing-attribute]
-   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:429:12
-ERROR Argument `list[SimpleNamespace] | list[Unknown]` is not assignable to parameter `rows` with type `list[object]` in function `FakeExecuteResult.__init__` [bad-argument-type]
-   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:461:38
 ERROR Object of class `object` has no attribute `callback` [missing-attribute]
-   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:551:5
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:383:5
 ERROR Object of class `object` has no attribute `callback` [missing-attribute]
-   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:612:5
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:444:5
 ERROR Object of class `TextIOBase` has no attribute `name` [missing-attribute]
-   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:625:17
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:457:17
 ERROR Class `object` has no class attribute `__table__` [missing-attribute]
-   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:709:48
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:541:48
 ERROR Class `object` has no class attribute `__table__` [missing-attribute]
-   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:788:48
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:620:48
 ERROR Class `object` has no class attribute `__table__` [missing-attribute]
-   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:891:48
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:723:48
 ERROR Class `object` has no class attribute `__table__` [missing-attribute]
-   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:969:48
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:801:48
 ERROR Class `object` has no class attribute `__table__` [missing-attribute]
-    --> tests/unit_tests/commands/test_legacy_model_type_migration.py:1024:42
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:856:42
 ERROR Class member `SlowLineOutput.write` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
-    --> tests/unit_tests/commands/test_legacy_model_type_migration.py:1092:13
+   --> tests/unit_tests/commands/test_legacy_model_type_migration.py:924:13
 ERROR Argument `object` is not assignable to parameter `orig` with type `BaseException` in function `sqlalchemy.exc.DBAPIError.__init__` [bad-argument-type]
-    --> tests/unit_tests/commands/test_legacy_model_type_migration.py:1394:44
+    --> tests/unit_tests/commands/test_legacy_model_type_migration.py:1226:44
 ERROR Argument `SimpleNamespace` is not assignable to parameter `orig` with type `BaseException` in function `sqlalchemy.exc.DBAPIError.__init__` [bad-argument-type]
-    --> tests/unit_tests/commands/test_legacy_model_type_migration.py:1418:57
+    --> tests/unit_tests/commands/test_legacy_model_type_migration.py:1250:57
 ERROR Expected a callable, got `None` [not-callable]
   --> tests/unit_tests/commands/test_reset_encrypt_key_pair.py:18:9
 ERROR Object of class `ModuleType` has no attribute `upgrade` [missing-attribute]
@@ -4238,13 +4232,13 @@
 ERROR Argument `None` is not assignable to parameter `dataset_id` with type `str` in function `core.callback_handler.index_tool_callback_handler.DatasetIndexToolCallbackHandler.on_query` [bad-argument-type]
   --> tests/unit_tests/core/callback_handler/test_index_tool_callback_handler.py:72:32
 ERROR Argument `list[DummyToolInvokeMessage]` is not assignable to parameter `tool_outputs` with type `Iterable[ToolInvokeMessage]` in function `core.callback_handler.workflow_tool_callback_handler.DifyWorkflowCallbackHandler.on_tool_execution` [bad-argument-type]
-  --> tests/unit_tests/core/callback_handler/test_workflow_tool_callback_handler.py:55:30
+  --> tests/unit_tests/core/callback_handler/test_workflow_tool_callback_handler.py:47:30
 ERROR Argument `list[DummyToolInvokeMessage]` is not assignable to parameter `tool_outputs` with type `Iterable[ToolInvokeMessage]` in function `core.callback_handler.workflow_tool_callback_handler.DifyWorkflowCallbackHandler.on_tool_execution` [bad-argument-type]
-  --> tests/unit_tests/core/callback_handler/test_workflow_tool_callback_handler.py:89:30
+  --> tests/unit_tests/core/callback_handler/test_workflow_tool_callback_handler.py:79:30
 ERROR Argument `list[DummyToolInvokeMessage]` is not assignable to parameter `tool_outputs` with type `Iterable[ToolInvokeMessage]` in function `core.callback_handler.workflow_tool_callback_handler.DifyWorkflowCallbackHandler.on_tool_execution` [bad-argument-type]
-   --> tests/unit_tests/core/callback_handler/test_workflow_tool_callback_handler.py:174:30
+   --> tests/unit_tests/core/callback_handler/test_workflow_tool_callback_handler.py:139:30
 ERROR Argument `list[DummyToolInvokeMessage]` is not assignable to parameter `tool_outputs` with type `Iterable[ToolInvokeMessage]` in function `core.callback_handler.workflow_tool_callback_handler.DifyWorkflowCallbackHandler.on_tool_execution` [bad-argument-type]
-   --> tests/unit_tests/core/callback_handler/test_workflow_tool_callback_handler.py:218:30
+   --> tests/unit_tests/core/callback_handler/test_workflow_tool_callback_handler.py:181:30
 ERROR Class member `ConcreteDatasourcePlugin.datasource_provider_type` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
   --> tests/unit_tests/core/datasource/__base/test_datasource_plugin.py:15:9
 ERROR Class member `ConcreteDatasourcePluginProviderController.get_datasource` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
@@ -4581,7 +4575,7 @@
 ERROR Argument `SimpleNamespace` is not assignable to parameter `tenant` with type `Tenant` in function `core.plugin.backwards_invocation.model.PluginModelBackwardsInvocation.invoke_summary` [bad-argument-type]
   --> tests/unit_tests/core/plugin/test_backwards_invocation_model.py:54:72
 ERROR Generator function should return `Generator` [bad-return]
-  --> tests/unit_tests/core/plugin/test_model_runtime_adapter.py:72:51
+  --> tests/unit_tests/core/plugin/test_model_runtime_adapter.py:49:51
 ERROR Class member `_BadString.__str__` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
    --> tests/unit_tests/core/plugin/test_plugin_entities.py:238:17
 ERROR Argument `TestPluginDaemonEntities.test_credential_type_helpers._FakeCredential` is not assignable to parameter `self` with type `CredentialType` in function `core.plugin.entities.plugin_daemon.CredentialType.get_name` [bad-argument-type]
@@ -5449,18 +5443,18 @@
 ERROR Class member `_DummyTool._invoke` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
   --> tests/unit_tests/core/tools/test_tool_engine.py:43:9
 ERROR Argument `SimpleNamespace` is not assignable to parameter `agent_message` with type `Message` in function `core.tools.tool_engine.ToolEngine._create_message_files` [bad-argument-type]
-   --> tests/unit_tests/core/tools/test_tool_engine.py:144:27
+   --> tests/unit_tests/core/tools/test_tool_engine.py:138:31
 ERROR Object of class `ToolInvokeMeta` has no attribute `type` [missing-attribute]
-   --> tests/unit_tests/core/tools/test_tool_engine.py:156:12
+   --> tests/unit_tests/core/tools/test_tool_engine.py:149:12
 ERROR Object of class `BlobChunkMessage` has no attribute `text`
 ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.tools.tool_engine.ToolEngine.agent_invoke` [bad-argument-type]
-   --> tests/unit_tests/core/tools/test_tool_engine.py:215:33
+   --> tests/unit_tests/core/tools/test_tool_engine.py:208:33
 ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.tools.tool_engine.ToolEngine.agent_invoke` [bad-argument-type]
-   --> tests/unit_tests/core/tools/test_tool_engine.py:238:21
+   --> tests/unit_tests/core/tools/test_tool_engine.py:231:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.tools.tool_engine.ToolEngine.agent_invoke` [bad-argument-type]
-   --> tests/unit_tests/core/tools/test_tool_engine.py:260:21
+   --> tests/unit_tests/core/tools/test_tool_engine.py:253:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.tools.tool_engine.ToolEngine.agent_invoke` [bad-argument-type]
-   --> tests/unit_tests/core/tools/test_tool_engine.py:303:21
+   --> tests/unit_tests/core/tools/test_tool_engine.py:296:21
 ERROR Argument `Generator[Unknown] | None` is not assignable to parameter `iterable` with type `Iterable[Unknown]` in function `list.__init__` [bad-argument-type]
    --> tests/unit_tests/core/tools/test_tool_file_manager.py:215:25
 ERROR `SimpleNamespace` is not assignable to attribute `entity` with type `ToolProviderEntityWithPlugin` [bad-assignment]
@@ -6312,45 +6306,45 @@
 ERROR Returned type `dict[str, Blueprint]` is not assignable to declared return type `Iterator[dict[str, Blueprint]]` [bad-return]
   --> tests/unit_tests/extensions/test_ext_blueprints_openapi.py:79:12
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:154:16
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:153:16
 ERROR Cannot index into `Mapping[str, object]` [bad-index]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:154:28
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:153:28
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:155:16
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:154:16
 ERROR Cannot index into `Mapping[str, object]` [bad-index]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:155:28
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:154:28
 ERROR `in` is not supported between `Literal['needle']` and `object` [not-iterable]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:156:16
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:155:16
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:156:31
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:155:31
 ERROR Cannot index into `Mapping[str, object]` [bad-index]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:156:43
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:155:43
 ERROR `in` is not supported between `Literal['200']` and `object` [not-iterable]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:210:16
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:209:16
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:210:25
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:209:25
 ERROR Cannot index into `Mapping[str, object]` [bad-index]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:210:37
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:209:37
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:211:16
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:210:16
 ERROR Cannot index into `Mapping[str, object]` [bad-index]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:211:28
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:210:28
 ERROR `in` is not supported between `Literal['200']` and `object` [not-iterable]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:228:16
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:227:16
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:228:25
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:227:25
 ERROR Cannot index into `Mapping[str, object]` [bad-index]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:228:37
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:227:37
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:229:16
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:228:16
 ERROR Cannot index into `Mapping[str, object]` [bad-index]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:229:28
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:228:28
 ERROR `in` is not supported between `Literal['needle']` and `object` [not-iterable]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:230:16
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:229:16
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:230:31
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:229:31
 ERROR Cannot index into `Mapping[str, object]` [bad-index]
-   --> tests/unit_tests/extensions/test_ext_request_logging.py:230:43
+   --> tests/unit_tests/extensions/test_ext_request_logging.py:229:43
 ERROR Object of class `Retry` has no attribute `_retries` [missing-attribute]
   --> tests/unit_tests/extensions/test_redis.py:34:16
 ERROR Argument `Flask` is not assignable to parameter `app` with type `DifyApp` in function `extensions.ext_set_secretkey.init_app` [bad-argument-type]
@@ -6481,10 +6475,6 @@
   --> tests/unit_tests/migrations/test_agent_drive_skill_metadata_refactor.py:60:9
 ERROR Object of class `object` has no attribute `op` [missing-attribute]
   --> tests/unit_tests/migrations/test_agent_drive_skill_metadata_refactor.py:64:13
-ERROR Argument `ModuleSpec | None` is not assignable to parameter `spec` with type `ModuleSpec` in function `_frozen_importlib.module_from_spec` [bad-argument-type]
-  --> tests/unit_tests/migrations/test_uuidv7_pg18_migration.py:31:46
-ERROR Object of class `NoneType` has no attribute `loader` [missing-attribute]
-  --> tests/unit_tests/migrations/test_uuidv7_pg18_migration.py:32:5
 ERROR TypedDict `TenantCustomConfigDict` does not have key `feature1` [bad-typed-dict-key]
    --> tests/unit_tests/models/test_account_models.py:594:23
 ERROR TypedDict `TenantCustomConfigDict` does not have key `feature2` [bad-typed-dict-key]
@@ -6775,126 +6765,126 @@
 ERROR Class member `DummyRetrieval.get_type` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
   --> tests/unit_tests/services/rag_pipeline/pipeline_template/test_pipeline_template_base.py:11:9
 ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.get_all_published_workflow` [bad-argument-type]
-   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:183:17
+   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:182:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.get_all_published_workflow` [bad-argument-type]
-   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:201:17
+   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:200:17
 ERROR Argument `list[str]` is not assignable to parameter `environment_variables` with type `Sequence[VariableBase]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.sync_draft_workflow` [bad-argument-type]
-   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:293:31
+   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:292:31
 ERROR Argument `list[str]` is not assignable to parameter `conversation_variables` with type `Sequence[VariableBase]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.sync_draft_workflow` [bad-argument-type]
-   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:294:32
+   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:293:32
 ERROR Object of class `NoneType` has no attribute `marked_name` [missing-attribute]
-   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:350:12
+   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:349:12
 ERROR Object of class `NoneType` has no attribute `marked_comment` [missing-attribute]
-   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:351:12
+   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:350:12
 ERROR Object of class `NoneType` has no attribute `disallowed`
 ERROR Object of class `NoneType` has no attribute `updated_by` [missing-attribute]
-   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:353:12
+   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:352:12
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1114:22
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1085:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1117:21
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1088:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1161:22
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1132:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1164:21
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1135:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1209:22
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1180:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1212:21
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1183:21
 ERROR Argument `() -> tuple[SimpleNamespace, Generator[NodeRunFailedEvent, Unknown]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1258:16
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1229:16
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.get_first_step_parameters` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1276:56
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1247:56
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.get_second_step_parameters` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1304:62
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1275:62
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.set_datasource_variables` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1401:55
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1372:55
 ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.set_datasource_variables` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1401:88
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1372:88
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1439:22
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1410:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1442:21
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1413:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1492:22
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1463:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1495:21
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1466:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1547:22
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1518:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1550:21
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1521:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.get_first_step_parameters` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1565:61
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1536:61
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.get_second_step_parameters` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1596:62
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1567:62
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.retry_error_document` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1608:13
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1579:13
 ERROR Argument `SimpleNamespace` is not assignable to parameter `document` with type `Document` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.retry_error_document` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1608:32
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1579:32
 ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | EndUser` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.retry_error_document` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1608:61
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1579:61
 ERROR Argument `() -> tuple[SimpleNamespace, Generator[object, Unknown]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1640:20
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1611:20
 ERROR Argument `() -> tuple[SimpleNamespace, Generator[NodeRunFailedEvent, Unknown]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1700:16
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1668:16
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1755:22
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1710:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1758:21
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1713:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.get_all_published_workflow` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1852:17
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1807:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.publish_workflow` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1883:18
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1838:18
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.publish_workflow` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1884:17
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1839:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1945:22
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1900:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1948:21
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1903:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1993:22
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1948:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_workflow_node` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1996:21
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1951:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2042:18
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1997:18
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2045:17
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2000:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.retry_error_document` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2121:13
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2076:13
 ERROR Argument `SimpleNamespace` is not assignable to parameter `document` with type `Document` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.retry_error_document` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2121:32
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2076:32
 ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | EndUser` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.retry_error_document` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2121:61
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2076:61
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.retry_error_document` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2136:13
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2091:13
 ERROR Argument `SimpleNamespace` is not assignable to parameter `document` with type `Document` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.retry_error_document` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2136:32
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2091:32
 ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | EndUser` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.retry_error_document` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2136:61
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2091:61
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.publish_workflow` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2176:73
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2131:73
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.publish_workflow` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2176:91
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2131:91
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2186:22
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2141:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2189:21
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2144:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2204:22
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2159:22
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2207:21
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2162:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2251:18
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2206:18
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2254:17
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2209:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2292:18
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2247:18
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.run_datasource_node_preview` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2295:17
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2250:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `pipeline` with type `Pipeline` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.set_datasource_variables` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2309:13
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2264:13
 ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `services.rag_pipeline.rag_pipeline.RagPipelineService.set_datasource_variables` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2311:13
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:2266:13
 ERROR Argument `dict[str, int]` is not assignable to parameter `manifest` with type `ArchiveManifest` in function `services.retention.workflow_run.restore_archived_workflow_run.WorkflowRunRestore._get_schema_version` [bad-argument-type]
    --> tests/unit_tests/services/retention/workflow_run/test_restore_archived_workflow_run.py:342:41
 ERROR Argument `() -> Mock` is not assignable to parameter `session_maker` with type `sessionmaker[Unknown]` in function `services.retention.workflow_run.restore_archived_workflow_run.WorkflowRunRestore._restore_from_run` [bad-argument-type]
@@ -6934,11 +6924,11 @@
 ERROR Argument `Literal['created_at']` is not assignable to parameter `k` with type `Never` in function `_typeshed._type_checker_internals.TypedDictFallback.pop` [bad-argument-type]
    --> tests/unit_tests/services/test_agent_drive_service.py:755:32
 ERROR Argument `dict[str, str]` is not assignable to parameter `args` with type `InsertAnnotationArgs` in function `services.annotation_service.AppAnnotationService.insert_app_annotation_directly` [bad-argument-type]
-   --> tests/unit_tests/services/test_annotation_service.py:511:69
+   --> tests/unit_tests/services/test_annotation_service.py:492:69
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `embedding_model` [bad-typed-dict-key]
-    --> tests/unit_tests/services/test_annotation_service.py:1190:59
+    --> tests/unit_tests/services/test_annotation_service.py:1221:59
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `embedding_model` [bad-typed-dict-key]
-    --> tests/unit_tests/services/test_annotation_service.py:1227:27
+    --> tests/unit_tests/services/test_annotation_service.py:1258:27
 ERROR Class member `_TrackingRateLimit.exit` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
    --> tests/unit_tests/services/test_app_generate_service.py:532:17
 ERROR Argument `_FakeStreams` is not assignable to parameter `redis_client` with type `Redis[Unknown] | RedisCluster[Unknown]` in function `libs.broadcast_channel.redis.streams_channel.StreamsBroadcastChannel.__init__` [bad-argument-type]
@@ -6992,109 +6982,109 @@
 ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
    --> tests/unit_tests/services/test_credit_pool_service.py:146:5
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.dataset_service.DatasetService.create_empty_dataset` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_dataset.py:348:61
+   --> tests/unit_tests/services/test_dataset_service_dataset.py:348:93
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.dataset_service.DatasetService.create_empty_dataset` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_dataset.py:373:25
+   --> tests/unit_tests/services/test_dataset_service_dataset.py:372:25
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.dataset_service.DatasetService.create_empty_dataset` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_dataset.py:417:25
+   --> tests/unit_tests/services/test_dataset_service_dataset.py:415:25
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_dataset.py:731:70
+   --> tests/unit_tests/services/test_dataset_service_dataset.py:736:70
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_dataset.py:741:70
+   --> tests/unit_tests/services/test_dataset_service_dataset.py:746:70
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_dataset.py:780:70
+   --> tests/unit_tests/services/test_dataset_service_dataset.py:785:70
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DatasetService._update_pipeline_knowledge_base_node_data` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_dataset.py:803:74
+   --> tests/unit_tests/services/test_dataset_service_dataset.py:808:74
 ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
-   --> tests/unit_tests/services/test_dataset_service_dataset.py:882:9
+   --> tests/unit_tests/services/test_dataset_service_dataset.py:875:9
 ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
-   --> tests/unit_tests/services/test_dataset_service_dataset.py:922:9
+   --> tests/unit_tests/services/test_dataset_service_dataset.py:913:9
 ERROR Argument `None` is not assignable to parameter `embedding_model_provider` with type `str` in function `tests.unit_tests.services.dataset_service_test_helpers.DatasetServiceUnitDataFactory.create_dataset_mock` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_dataset.py:999:38
+   --> tests/unit_tests/services/test_dataset_service_dataset.py:979:38
 ERROR Argument `None` is not assignable to parameter `embedding_model` with type `str` in function `tests.unit_tests.services.dataset_service_test_helpers.DatasetServiceUnitDataFactory.create_dataset_mock` [bad-argument-type]
-    --> tests/unit_tests/services/test_dataset_service_dataset.py:1000:29
+   --> tests/unit_tests/services/test_dataset_service_dataset.py:980:29
 ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
-    --> tests/unit_tests/services/test_dataset_service_dataset.py:1069:9
+    --> tests/unit_tests/services/test_dataset_service_dataset.py:1038:9
 ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
-    --> tests/unit_tests/services/test_dataset_service_dataset.py:1106:9
+    --> tests/unit_tests/services/test_dataset_service_dataset.py:1073:9
 ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
-    --> tests/unit_tests/services/test_dataset_service_dataset.py:1422:22
+    --> tests/unit_tests/services/test_dataset_service_dataset.py:1384:67
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset | None` in function `services.dataset_service.DatasetService.check_dataset_operator_permission` [bad-argument-type]
-    --> tests/unit_tests/services/test_dataset_service_dataset.py:1430:25
+    --> tests/unit_tests/services/test_dataset_service_dataset.py:1387:81
 ERROR Object of class `FakeAccount` has no attribute `id` [missing-attribute]
-  --> tests/unit_tests/services/test_dataset_service_document.py:93:9
+  --> tests/unit_tests/services/test_dataset_service_document.py:91:9
 ERROR Object of class `FakeAccount` has no attribute `current_tenant_id` [missing-attribute]
-  --> tests/unit_tests/services/test_dataset_service_document.py:94:9
+  --> tests/unit_tests/services/test_dataset_service_document.py:92:9
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DocumentService.update_document_with_dataset_id` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_document.py:432:21
+   --> tests/unit_tests/services/test_dataset_service_document.py:376:65
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DocumentService.update_document_with_dataset_id` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_document.py:461:21
+   --> tests/unit_tests/services/test_dataset_service_document.py:399:65
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DocumentService.update_document_with_dataset_id` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_document.py:503:17
+   --> tests/unit_tests/services/test_dataset_service_document.py:436:70
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DocumentService.update_document_with_dataset_id` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_document.py:556:21
+   --> tests/unit_tests/services/test_dataset_service_document.py:484:65
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.DocumentService.update_document_with_dataset_id` [bad-argument-type]
-   --> tests/unit_tests/services/test_dataset_service_document.py:590:17
+   --> tests/unit_tests/services/test_dataset_serv\n\n... (truncated) ...

@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 51.58% 51.58% 0.00%
Strict coverage 51.10% 51.10% 0.00%
Typed symbols 31,008 31,008 0
Untyped symbols 29,384 29,384 0
Modules 2935 2935 0

@fatelei fatelei added this pull request to the merge queue Jun 30, 2026
Merged via the queue into langgenius:main with commit 089c3f4 Jun 30, 2026
31 checks passed
GareArc pushed a commit that referenced this pull request Jul 9, 2026
…fails (#38118)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
(cherry picked from commit 089c3f4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Missing retry limits in _delete_records causes infinite loop and disk exhaustion (Poison Pill)

2 participants