Skip to content

chore: clean Db session from service#38227

Open
asukaminato0721 wants to merge 37 commits into
langgenius:mainfrom
asukaminato0721:db-session
Open

chore: clean Db session from service#38227
asukaminato0721 wants to merge 37 commits into
langgenius:mainfrom
asukaminato0721:db-session

Conversation

@asukaminato0721

@asukaminato0721 asukaminato0721 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

image

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

.
.

.

.

.

.

.

.
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. refactor labels Jun 30, 2026
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-06-30 14:59:32.402676591 +0000
+++ /tmp/pyrefly_pr.txt	2026-06-30 14:59:23.499628976 +0000
@@ -563,25 +563,23 @@
 ERROR Argument `FakeArchiveStorage` is not assignable to parameter `storage` with type `ArchiveStorage | None` in function `services.retention.workflow_run.archive_paid_plan_workflow_run.WorkflowRunArchiver._archive_bundle` [bad-argument-type]
    --> tests/integration_tests/services/retention/test_workflow_run_archiver.py:437:60
 ERROR Argument `_stub_resolver._Resolver` is not assignable to parameter `binding_resolver` with type `WorkflowAgentBindingResolver | None` in function `services.workflow.node_output_inspector_service.NodeOutputInspectorService.__init__` [bad-argument-type]
-   --> tests/integration_tests/services/test_node_output_inspector_service.py:231:59
+   --> tests/integration_tests/services/test_node_output_inspector_service.py:261:59
 ERROR Argument `_stub_resolver._Resolver` is not assignable to parameter `binding_resolver` with type `WorkflowAgentBindingResolver | None` in function `services.workflow.node_output_inspector_service.NodeOutputInspectorService.__init__` [bad-argument-type]
-   --> tests/integration_tests/services/test_node_output_inspector_service.py:257:59
+   --> tests/integration_tests/services/test_node_output_inspector_service.py:288:59
 ERROR Argument `_stub_resolver._Resolver` is not assignable to parameter `binding_resolver` with type `WorkflowAgentBindingResolver | None` in function `services.workflow.node_output_inspector_service.NodeOutputInspectorService.__init__` [bad-argument-type]
-   --> tests/integration_tests/services/test_node_output_inspector_service.py:267:59
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.workflow.node_output_inspector_service.NodeOutputInspectorService.snapshot_workflow_run` [bad-argument-type]
-   --> tests/integration_tests/services/test_node_output_inspector_service.py:269:49
+   --> tests/integration_tests/services/test_node_output_inspector_service.py:298:59
 ERROR Argument `_stub_resolver._Resolver` is not assignable to parameter `binding_resolver` with type `WorkflowAgentBindingResolver | None` in function `services.workflow.node_output_inspector_service.NodeOutputInspectorService.__init__` [bad-argument-type]
-   --> tests/integration_tests/services/test_node_output_inspector_service.py:287:63
+   --> tests/integration_tests/services/test_node_output_inspector_service.py:318:63
 ERROR Argument `_stub_resolver._Resolver` is not assignable to parameter `binding_resolver` with type `WorkflowAgentBindingResolver | None` in function `services.workflow.node_output_inspector_service.NodeOutputInspectorService.__init__` [bad-argument-type]
-   --> tests/integration_tests/services/test_node_output_inspector_service.py:330:63
+   --> tests/integration_tests/services/test_node_output_inspector_service.py:361:63
 ERROR Argument `_stub_resolver._Resolver` is not assignable to parameter `binding_resolver` with type `WorkflowAgentBindingResolver | None` in function `services.workflow.node_output_inspector_service.NodeOutputInspectorService.__init__` [bad-argument-type]
-   --> tests/integration_tests/services/test_node_output_inspector_service.py:371:63
+   --> tests/integration_tests/services/test_node_output_inspector_service.py:402:63
 ERROR Argument `_stub_resolver._Resolver` is not assignable to parameter `binding_resolver` with type `WorkflowAgentBindingResolver | None` in function `services.workflow.node_output_inspector_service.NodeOutputInspectorService.__init__` [bad-argument-type]
-   --> tests/integration_tests/services/test_node_output_inspector_service.py:393:59
+   --> tests/integration_tests/services/test_node_output_inspector_service.py:424:59
 ERROR Argument `_stub_resolver._Resolver` is not assignable to parameter `binding_resolver` with type `WorkflowAgentBindingResolver | None` in function `services.workflow.node_output_inspector_service.NodeOutputInspectorService.__init__` [bad-argument-type]
-   --> tests/integration_tests/services/test_node_output_inspector_service.py:419:59
+   --> tests/integration_tests/services/test_node_output_inspector_service.py:451:59
 ERROR Argument `_stub_resolver._Resolver` is not assignable to parameter `binding_resolver` with type `WorkflowAgentBindingResolver | None` in function `services.workflow.node_output_inspector_service.NodeOutputInspectorService.__init__` [bad-argument-type]
-   --> tests/integration_tests/services/test_node_output_inspector_service.py:468:63
+   --> tests/integration_tests/services/test_node_output_inspector_service.py:501:63
 ERROR Object of class `TestWorkflowDraftVariableServiceResetVariable` has no attribute `_test_user_id` [missing-attribute]
    --> tests/integration_tests/services/test_workflow_draft_variable_service.py:626:21
 ERROR Object of class `TestWorkflowDraftVariableServiceResetVariable` has no attribute `_test_user_id` [missing-attribute]
@@ -611,7 +609,7 @@
 ERROR Object of class `object` has no attribute `strip` [missing-attribute]
   --> tests/integration_tests/workflow/test_response_stream_filter_integration.py:75:37
 ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
-   --> tests/test_containers_integration_tests/controllers/console/app/test_app_apis.py:667:51
+   --> tests/test_containers_integration_tests/controllers/console/app/test_app_apis.py:671:51
 ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
    --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:247:9
 ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
@@ -787,25 +785,25 @@
 ERROR Object of class `NoneType` has no attribute `open_id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_account_service.py:558:16
 ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:1501:16
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1503:16
 ERROR Argument `list[str]` is not assignable to parameter `roles` with type `list[TenantAccountRole]` in function `services.account_service.TenantService.has_roles` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:1698:45
+    --> tests/test_containers_integration_tests/services/test_account_service.py:1700:45
 ERROR Object of class `NoneType` has no attribute `role` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2070:16
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2072:16
 ERROR Object of class `NoneType` has no attribute `role` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2128:16
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2130:16
 ERROR Object of class `NoneType` has no attribute `role` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2129:16
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2131:16
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2283:16
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2285:16
 ERROR Argument `dict[str, str | dict[str, bool]]` is not assignable to parameter `value` with type `TenantCustomConfigDict` in function `models.account.Tenant.custom_config_dict` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2461:37
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2463:37
 ERROR TypedDict `TenantCustomConfigDict` does not have key `theme` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2469:33
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2471:33
 ERROR TypedDict `TenantCustomConfigDict` does not have key `language` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2470:33
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2472:33
 ERROR TypedDict `TenantCustomConfigDict` does not have key `feature_flags` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_account_service.py:2471:33
+    --> tests/test_containers_integration_tests/services/test_account_service.py:2473:33
 ERROR Argument `dict[str, AppMode | str] | dict[str, str]` is not assignable to parameter `args` with type `AdvancedPromptTemplateArgs` in function `services.advanced_prompt_template_service.AdvancedPromptTemplateService.get_prompt` [bad-argument-type]
    --> tests/test_containers_integration_tests/services/test_advanced_prompt_template_service.py:718:63
 ERROR Argument `dict[str, AppMode | str]` is not assignable to parameter `args` with type `AdvancedPromptTemplateArgs` in function `services.advanced_prompt_template_service.AdvancedPromptTemplateService.get_prompt` [bad-argument-type]
@@ -827,33 +825,21 @@
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_annotation_service.py:107: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
-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
-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
-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
-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:247:17
 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:762: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:996: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:1044: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:1086: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:1087: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:1088: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
-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
-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:1089:23
 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]
@@ -869,31 +855,31 @@
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:165:42
 ERROR Argument `Literal['simple']` is not assignable to parameter `prompt_type` with type `PromptType | SQLCoreOperations[PromptType]` in function `models.model.AppModelConfig.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:929:25
+   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:931:25
 ERROR Argument `Literal['workflow']` 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_dsl_service.py:952:20
+   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:954:20
 ERROR Argument `Literal['workflow']` 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_dsl_service.py:987:20
+   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:989:20
 ERROR Argument `Literal['workflow']` 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_dsl_service.py:1028:20
+    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1032:20
 ERROR Argument `list[SimpleNamespace]` is not assignable to parameter `dsl_dependencies` with type `list[PluginDependency]` in function `services.app_dsl_service.AppDslService.get_leaked_dependencies` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1314:73
+    --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:1326:73
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_app_generate_service.py:190:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:449:23
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:489: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:518:20
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:568: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:736:64
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:829: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:763:64
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:861: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:789:68
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:892:22
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:834:23
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:939: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:960:20
+    --> tests/test_containers_integration_tests/services/test_app_generate_service.py:1070:20
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
   --> tests/test_containers_integration_tests/services/test_app_service.py:87:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
@@ -910,172 +896,134 @@
    --> tests/test_containers_integration_tests/services/test_app_service.py:237:36
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_app_service.py:242:68
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:242:87
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_app_service.py:252:37
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_app_service.py:277:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:282:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:283:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:287:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:289:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:304:25
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:304:82
+   --> tests/test_containers_integration_tests/services/test_app_service.py:307:25
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:315:13
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:317:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:318:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:328:13
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:330:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:331:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:362:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:365:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:367:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:371:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:382:25
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:382:82
+   --> tests/test_containers_integration_tests/services/test_app_service.py:387:25
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:393:25
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:393:82
-ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:422:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:398:25
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
    --> tests/test_containers_integration_tests/services/test_app_service.py:427:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:432:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:433:13
+ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
+   --> tests/test_containers_integration_tests/services/test_app_service.py:439:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:437:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:445:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:459:25
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_starred_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:459:89
+   --> tests/test_containers_integration_tests/services/test_app_service.py:468:25
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:472:13
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_starred_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:474:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:481:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:485:13
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_starred_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:487:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:494:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:538:43
+   --> tests/test_containers_integration_tests/services/test_app_service.py:547:43
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:539:49
+   --> tests/test_containers_integration_tests/services/test_app_service.py:549:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:543:25
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:543:82
+   --> tests/test_containers_integration_tests/services/test_app_service.py:554:25
 ERROR Object of class `NoneType` has no attribute `items` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:545:20
+   --> tests/test_containers_integration_tests/services/test_app_service.py:556:20
 ERROR Cannot index into `object` [bad-index]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:546:16
+   --> tests/test_containers_integration_tests/services/test_app_service.py:557:16
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:550:25
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:550:95
+   --> tests/test_containers_integration_tests/services/test_app_service.py:561:25
 ERROR Object of class `NoneType` has no attribute `items` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:552:20
+   --> tests/test_containers_integration_tests/services/test_app_service.py:563:20
 ERROR Cannot index into `object` [bad-index]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:553:26
+   --> tests/test_containers_integration_tests/services/test_app_service.py:564:26
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:558:13
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:560:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:569:13
 ERROR Object of class `NoneType` has no attribute `items` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:562:20
+   --> tests/test_containers_integration_tests/services/test_app_service.py:573:20
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:602:32
+   --> tests/test_containers_integration_tests/services/test_app_service.py:613:32
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:611:32
+   --> tests/test_containers_integration_tests/services/test_app_service.py:622:32
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:615:13
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:617:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:626:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:657:38
+   --> tests/test_containers_integration_tests/services/test_app_service.py:668:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:666:72
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:666:91
+   --> tests/test_containers_integration_tests/services/test_app_service.py:677:72
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:670:24
+   --> tests/test_containers_integration_tests/services/test_app_service.py:681:24
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:684:72
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:684:91
+   --> tests/test_containers_integration_tests/services/test_app_service.py:695:72
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:720:38
+   --> tests/test_containers_integration_tests/services/test_app_service.py:731:38
 ERROR Argument `dict[str, bool | str]` is not assignable to parameter `args` with type `AppService.ArgsDict` in function `services.app_service.AppService.update_app` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:744:55
+   --> tests/test_containers_integration_tests/services/test_app_service.py:755:55
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:781:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:792:13
 ERROR Missing required key `max_active_requests` for TypedDict `ArgsDict` [bad-typed-dict-key]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:800:17
+   --> tests/test_containers_integration_tests/services/test_app_service.py:812:17
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:834:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:847:13
 ERROR Missing required key `max_active_requests` for TypedDict `ArgsDict` [bad-typed-dict-key]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:854:21
+   --> tests/test_containers_integration_tests/services/test_app_service.py:868:21
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:895:38
+   --> tests/test_containers_integration_tests/services/test_app_service.py:910:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:949:38
+   --> tests/test_containers_integration_tests/services/test_app_service.py:964:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1010:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1027:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1070:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1087:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1130:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1147:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1181:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1198:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1194:70
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1211:70
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1233:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1250:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1256:70
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1273:70
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1293:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1310:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1332:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1349:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1372:38
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1389:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1453:13
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1470:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1468:13
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1486:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1483:13
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1502:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1499:13
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1519:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1515:25
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1515:94
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1536:25
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1525:13
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1527:13
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1546:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1537:13
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1539:13
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1558:13
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1548:25
-ERROR Argument `Session` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService.get_paginate_apps` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1548:94
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1569:25
 ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.app_service.AppService.get_app_meta` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1585:41
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1606:41
 ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `services.app_service.AppService.get_app_meta` [bad-argument-type]
-    --> tests/test_containers_integration_tests/services/test_app_service.py:1599:41
+    --> tests/test_containers_integration_tests/services/test_app_service.py:1620:41
 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_conversation_service_variables.py:47:18
+  --> tests/test_containers_integration_tests/services/test_conversation_service_variables.py:46: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]
   --> tests/test_containers_integration_tests/services/test_dataset_permission_service.py:39: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]
@@ -1205,7 +1153,7 @@
 ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.LoadBalancingModelConfig.__init__` [bad-argument-type]
    --> tests/test_containers_integration_tests/services/test_model_load_balancing_service.py:301:24
 ERROR Argument `Literal['llm']` is not assignable to parameter `model_type` with type `ModelType | SQLCoreOperations[ModelType]` in function `models.provider.LoadBalancingModelConfig.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_model_load_balancing_service.py:420:24
+   --> tests/test_containers_integration_tests/services/test_model_load_balancing_service.py:428:24
 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_model_provider_service.py:55: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]
@@ -1221,7 +1169,7 @@
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
   --> tests/test_containers_integration_tests/services/test_ops_service.py:60:13
 ERROR Argument `dict[str, Any] | dict[Unknown, Unknown] | object | None` is not assignable to parameter `tracing_config` with type `SQLCoreOperations[dict[str, Any] | None] | dict[str, Any] | None` in function `models.model.TraceAppConfig.__init__` [bad-argument-type]
-  --> tests/test_containers_integration_tests/services/test_ops_service.py:85:28
+  --> tests/test_containers_integration_tests/services/test_ops_service.py:86:28
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
   --> tests/test_containers_integration_tests/services/test_saved_message_service.py:89:38
 ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
@@ -1395,9 +1343,9 @@
 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
 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:1302: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:1656: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]
@@ -1581,11 +1529,11 @@
 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/workflow/test_workflow_converter.py:116:20
 ERROR Argument `AppModelConfig | None` is not assignable to parameter `app_model_config` with type `AppModelConfig` in function `services.workflow.workflow_converter.WorkflowConverter.convert_app_model_config_to_workflow` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/workflow/test_workflow_converter.py:326:30
+   --> tests/test_containers_integration_tests/services/workflow/test_workflow_converter.py:328:30
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/test_containers_integration_tests/services/workflow/test_workflow_converter.py:646:16
+   --> tests/test_containers_integration_tests/services/workflow/test_workflow_converter.py:651:16
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/test_containers_integration_tests/services/workflow/test_workflow_converter.py:654:16
+   --> 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_execution_data`, `get_by_workflow_execution` [bad-instantiation]
@@ -2045,15 +1993,15 @@
 ERROR Argument `Literal['00000000-0000-0000-0000-000000000002']` is not assignable to parameter `message_id` with type `UUID` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
     --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:1708:24
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_annotation_security.py:221:38
+   --> tests/unit_tests/controllers/console/app/test_annotation_security.py:219:38
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_annotation_security.py:221:82
+   --> tests/unit_tests/controllers/console/app/test_annotation_security.py:219:82
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_annotation_security.py:238:34
+   --> tests/unit_tests/controllers/console/app/test_annotation_security.py:236:34
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_annotation_security.py:238:78
+   --> tests/unit_tests/controllers/console/app/test_annotation_security.py:236:78
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_annotation_security.py:256:35
+   --> tests/unit_tests/controllers/console/app/test_annotation_security.py:254:35
 ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.conversation._get_conversation` [bad-argument-type]
   --> tests/unit_tests/controllers/console/app/test_conversation_api.py:90:52
 ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.conversation._get_conversation` [bad-argument-type]
@@ -2349,27 +2297,27 @@
 ERROR Argument `SimpleNamespace` is not assignable to parameter `application_generate_entity` with type `AdvancedChatAppGenerateEntity | WorkflowAppGenerateEntity` in function `core.app.apps.common.workflow_response_converter.WorkflowResponseConverter.__init__` [bad-argument-type]
   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:99:37
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `WorkflowSnapshot` 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:434:22
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:435:22
 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:435:27
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:436:27
 ERROR Argument `SimpleNamespace` is not assignable to parameter `conversation` with type `ConversationSnapshot` 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:436:26
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:437:26
 ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `MessageSnapshot` 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:437:21
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:438:21
 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:447:37
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:448:37
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` 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:527:22
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:528:22
 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:528:27
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:529:27
 ERROR Argument `SimpleNamespace` is not assignable to parameter `user` with type `Account | EndUser` 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:529:18
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:530:18
 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:531:37
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:532: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:627:33
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:628:33
 ERROR Argument `() -> TestHitlServiceApi.test_snapshot_events_include_pause_payload_contract._SessionContext` is not assignable to parameter `session_maker` with type `sessionmaker[Session] | None` in function `services.workflow_event_snapshot_service._build_snapshot_events` [bad-argument-type]
-   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:702:27
+   --> tests/unit_tests/controllers/service_api/app/test_hitl_service_api.py:703:27
 ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `limit` [bad-argument-type]
   --> tests/unit_tests/controllers/service_api/app/test_message.py:90:63
 ERROR Argument value `Literal[101]` violates Pydantic `le` constraint `Literal[100]` for field `limit` [bad-argument-type]
@@ -2384,20 +2332,12 @@
    --> tests/unit_tests/controllers/service_api/app/test_message.py:184:31
 ERROR Argument `list[dict[str, Any]] | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
    --> tests/unit_tests/controllers/service_api/app/test_workflow.py:111:20
-ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `page` [bad-argument-type]
-   --> tests/unit_tests/controllers/service_api/app/test_workflow.py:173:30
-ERROR Argument value `Literal[100000]` violates Pydantic `le` constraint `Literal[99999]` for field `page` [bad-argument-type]
-   --> tests/unit_tests/controllers/service_api/app/test_workflow.py:178:30
-ERROR Argument value `Literal[0]` violates Pydantic `ge` constraint `Literal[1]` for field `limit` [bad-argument-type]
-   --> tests/unit_tests/controllers/service_api/app/test_workflow.py:183:30
-ERROR Argument value `Literal[101]` violates Pydantic `le` constraint `Literal[100]` for field `limit` [bad-argument-type]
-   --> tests/unit_tests/controllers/service_api/app/test_workflow.py:188:30
 ERROR Object of class `dict` has no attribute `page` [missing-attribute]
-   --> tests/unit_tests/controllers/service_api/app/test_workflow.py:239:16
+   --> tests/unit_tests/controllers/service_api/app/test_workflow.py:219:16
 ERROR Object of class `dict` has no attribute `limit` [missing-attribute]
-   --> tests/unit_tests/controllers/service_api/app/test_workflow.py:240:16
+   --> tests/unit_tests/controllers/service_api/app/test_workflow.py:220:16
 ERROR Object of class `NoneType` has no attribute `status` [missing-attribute]
-   --> tests/unit_tests/controllers/service_api/app/test_workflow.py:367:16
+   --> tests/unit_tests/controllers/service_api/app/test_workflow.py:351:16
 ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunStatusField.output` [bad-argument-type]
   --> tests/unit_tests/controllers/service_api/app/test_workflow_fields.py:11:35
 ERROR Argument `SimpleNamespace` is not assignable to parameter `obj` with type `WorkflowRun` in function `controllers.service_api.app.workflow.WorkflowRunOutputsField.output` [bad-argument-type]
@@ -6576,63 +6516,63 @@
 ERROR Argument `list[SimpleNamespace]` is not assignable to parameter `recipients` with type `Sequence[HumanInputFormRecipient]` in function `repositories.sqlalchemy_api_workflow_run_repository._build_human_input_required_reason` [bad-argument-type]
   --> tests/unit_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:56:9
 ERROR Object of class `object` has no attribute `prompt` [missing-attribute]
-   --> tests/unit_tests/services/agent/test_agent_services.py:959:12
+    --> tests/unit_tests/services/agent/test_agent_services.py:1011:12
 ERROR Cannot index into `object` [bad-index]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1135:12
+    --> tests/unit_tests/services/agent/test_agent_services.py:1190:12
 ERROR Cannot index into `object` [bad-index]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1136:12
+    --> tests/unit_tests/services/agent/test_agent_services.py:1191:12
 ERROR Cannot index into `object` [bad-index]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1137:12
+    --> tests/unit_tests/services/agent/test_agent_services.py:1192:12
 ERROR Cannot index into `object` [bad-index]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1139:12
+    --> tests/unit_tests/services/agent/test_agent_services.py:1194:12
 ERROR Cannot index into `object` [bad-index]
-    --> tests/unit_tests/services/agent/test_agent_services.py:1140:12
-ERROR Argument `FakeSession` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService._build_app_list_filters` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:2391:61
-ERROR Argument `FakeSession` is not assignable to parameter `session` with type `scoped_session[Unknown]` in function `services.app_service.AppService._build_app_list_filters` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:2400:63
+    --> tests/unit_tests/services/agent/test_agent_services.py:1195:12
+ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session | scoped_session[Unknown]` in function `services.app_service.AppService._build_app_list_filters` [bad-argument-type]
+    --> tests/unit_tests/services/agent/test_agent_services.py:2481:61
+ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session | scoped_session[Unknown]` in function `services.app_service.AppService._build_app_list_filters` [bad-argument-type]
+    --> tests/unit_tests/services/agent/test_agent_services.py:2490:63
 ERROR Object of class `object` has no attribute `name` [missing-attribute]
-    --> tests/unit_tests/services/agent/test_agent_services.py:2877:16
+    --> tests/unit_tests/services/agent/test_agent_services.py:2967:16
 ERROR Object of class `object` has no attribute `mode` [missing-attribute]
-    --> tests/unit_tests/services/agent/test_agent_services.py:2878:16
+    --> tests/unit_tests/services/agent/test_agent_services.py:2968:16
 ERROR Object of class `object` has no attribute `agent_role` [missing-attribute]
-    --> tests/unit_tests/services/agent/test_agent_services.py:2879:16
+    --> tests/unit_tests/services/agent/test_agent_services.py:2969:16
 ERROR Object of class `object` has no attribute `agent_role` [missing-attribute]
-    --> tests/unit_tests/services/agent/test_agent_services.py:2955:16
+    --> tests/unit_tests/services/agent/test_agent_services.py:3045:16
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3209:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:3299:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.validate_agent_nodes_for_publish` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3236:25
+    --> tests/unit_tests/services/agent/test_agent_services.py:3326:25
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.validate_agent_nodes_for_publish` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3258:25
+    --> tests/unit_tests/services/agent/test_agent_services.py:3348:25
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.project_draft_bindings_to_graph` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3322:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:3412:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.project_draft_bindings_to_graph` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3379:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:3469:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.project_draft_bindings_to_graph` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3430:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:3520:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3483:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:3573:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3578:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:3668:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3628:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:3718:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3679:25
+    --> tests/unit_tests/services/agent/test_agent_services.py:3769:25
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3711:25
+    --> tests/unit_tests/services/agent/test_agent_services.py:3801:25
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3744:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:3834:21
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3794:25
+    --> tests/unit_tests/services/agent/test_agent_services.py:3884:25
 ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
-    --> tests/unit_tests/services/agent/test_agent_services.py:3854:21
+    --> tests/unit_tests/services/agent/test_agent_services.py:3944:21
 ERROR Argument `FakeSession` is not assignable to par\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.77% +0.19%
Strict coverage 51.10% 51.29% +0.19%
Typed symbols 31,008 31,243 +235
Untyped symbols 29,384 29,376 -8
Modules 2935 2935 0

@autofix-ci autofix-ci Bot requested a review from crazywoola as a code owner June 30, 2026 14:47
@github-actions github-actions Bot added the web This relates to changes on the web. label Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor size:L This PR changes 100-499 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.

2 participants