Skip to content

fix: eagerly validate conversation before generator to prevent hanging#37224

Merged
wylswz merged 2 commits into
langgenius:mainfrom
functionkiller:fix/chatflow-hang-invalid-conversation
Jun 25, 2026
Merged

fix: eagerly validate conversation before generator to prevent hanging#37224
wylswz merged 2 commits into
langgenius:mainfrom
functionkiller:fix/chatflow-hang-invalid-conversation

Conversation

@functionkiller

Copy link
Copy Markdown
Contributor

Summary

When a non-existing conversation_id is provided to the chat-messages API, the error was raised inside a generator function, making it impossible for the outer try/except to catch. This caused the request to hang with only ping events instead of returning a proper 4xx error.

Root Cause

The ConversationNotExistsError is raised inside the generate() generator method of the app generator. Since Python generators execute lazily, the exception happens during iteration (inside Flask's SSE stream processing), not during the function call. The try/except in the controller can't catch it.

Fix

Add eager pre-validation of the conversation before calling AppGenerateService.generate() in three completion endpoints:

  • controllers/web/completion.py — Web app chat-messages endpoint
  • controllers/service_api/app/completion.py — Service API completion endpoint
  • controllers/console/app/completion.py — Console (debugger) completion endpoint

The pre-validation calls ConversationService.get_conversation() which raises ConversationNotExistsError immediately, outside the generator context, so it's properly caught and returns 404.

Test plan

  • Invalid conversation_id now returns 404 immediately instead of hanging
  • Valid conversation_id works unchanged
  • No conversation_id provided works unchanged

Fixes #37197

When a non-existing conversation_id is provided, the error was raised
inside a generator function, making it impossible for the outer try/except
to catch. This caused the request to hang with only ping events.

Add pre-validation before the generator is created so that
ConversationNotExistsError is raised eagerly and properly caught.

fixes langgenius#37197
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 9, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-06-25 02:27:53.752027554 +0000
+++ /tmp/pyrefly_pr.txt	2026-06-25 02:27:37.721910058 +0000
@@ -1,3 +1,79 @@
+ERROR Object of class `CompletionMessagePayload` has no attribute `conversation_id` [missing-attribute]
+   --> controllers/console/app/completion.py:118:12
+ERROR Argument `object` is not assignable to parameter `conversation_id` with type `str` in function `services.conversation_service.ConversationService.get_conversation` [bad-argument-type]
+   --> controllers/console/app/completion.py:120:54
+ERROR Object of class `CompletionRequestPayload` has no attribute `conversation_id` [missing-attribute]
+   --> controllers/service_api/app/completion.py:134:12
+ERROR Class member `EasyUIBasedGenerateTaskPipeline._application_generate_entity` overrides parent class `BasedGenerateTaskPipeline` in an inconsistent manner [bad-override-mutable-attribute]
+  --> core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py:75:5
+ERROR `+=` is not supported between `list[PromptMessageContentUnionTypes]` and `str` [unsupported-operation]
+   --> core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py:324:37
+ERROR Argument `list[dict[str, list[dict[Unknown, Unknown]] | str]]` is not assignable to parameter `value` with type `SQLCoreOperations[dict[str, Any]] | dict[str, Any]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
+   --> core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py:392:27
+ERROR No matching overload found for function `core.model_manager.ModelInstance.invoke_llm` called with arguments: (prompt_messages=list[UserPromptMessage], model_parameters=dict[str, int], stream=Literal[False]) [no-matching-overload]
+   --> core/llm_generator/llm_generator.py:113:60
+ERROR No matching overload found for function `core.model_manager.ModelInstance.invoke_llm` called with arguments: (prompt_messages=list[UserPromptMessage], model_parameters=dict[str, float | int] | dict[str, object] | dict[Unknown, Unknown], stop=list[str] | list[Unknown], stream=Literal[False]) [no-matching-overload]
+   --> core/llm_generator/llm_generator.py:223:60
+ERROR No matching overload found for function `core.model_manager.ModelInstance.invoke_llm` called with arguments: (prompt_messages=list[UserPromptMessage], model_parameters=dict[str, Any], stream=Literal[False]) [no-matching-overload]
+   --> core/llm_generator/llm_generator.py:268:64
+ERROR No matching overload found for function `core.model_manager.ModelInstance.invoke_llm` called with arguments: (prompt_messages=list[UserPromptMessage], model_parameters=dict[str, Any], stream=Literal[False]) [no-matching-overload]
+   --> core/llm_generator/llm_generator.py:316:70
+ERROR No matching overload found for function `core.model_manager.ModelInstance.invoke_llm` called with arguments: (prompt_messages=list[UserPromptMessage], model_parameters=dict[str, Any], stream=Literal[False]) [no-matching-overload]
+   --> core/llm_generator/llm_generator.py:347:73
+ERROR No matching overload found for function `core.model_manager.ModelInstance.invoke_llm` called with arguments: (prompt_messages=list[UserPromptMessage], model_parameters=dict[str, Any], stream=Literal[False]) [no-matching-overload]
+   --> core/llm_generator/llm_generator.py:356:73
+ERROR No matching overload found for function `core.model_manager.ModelInstance.invoke_llm` called with arguments: (prompt_messages=list[UserPromptMessage], model_parameters=dict[str, Any], stream=Literal[False]) [no-matching-overload]
+   --> core/llm_generator/llm_generator.py:403:60
+ERROR No matching overload found for function `core.model_manager.ModelInstance.invoke_llm` called with arguments: (prompt_messages=list[SystemPromptMessage | UserPromptMessage], model_parameters=dict[str, Any], stream=Literal[False]) [no-matching-overload]
+   --> core/llm_generator/llm_generator.py:465:60
+ERROR No matching overload found for function `core.model_manager.ModelInstance.invoke_llm` called with arguments: (prompt_messages=list[SystemPromptMessage | UserPromptMessage], model_parameters=dict[str, float], stream=Literal[False]) [no-matching-overload]
+   --> core/llm_generator/llm_generator.py:653:60
+ERROR `list[dict[str, str | dict[str, str]]] | list[Unknown]` is not assignable to TypedDict key `tool_calls` with type `list[dict[str, str]] | str` [bad-typed-dict-key]
+  --> core/prompt/utils/prompt_message_util.py:83:44
+ERROR Argument `Unknown | None` is not assignable to parameter `result_object` with type `dict[str, Any]` in function `WaterCrawlProvider._structure_data` [bad-argument-type]
+   --> core/rag/extractor/watercrawl/provider.py:108:37
+ERROR Object of class `BaseOxmlElement` has no attribute `body` [missing-attribute]
+   --> core/rag/extractor/word_extractor.py:450:24
+ERROR Object of class `Document` has no attribute `score` [missing-attribute]
+   --> core/rag/index_processor/processor/paragraph_index_processor.py:208:33
+ERROR Object of class `Document` has no attribute `score` [missing-attribute]
+   --> core/rag/index_processor/processor/paragraph_index_processor.py:209:16
+ERROR Object of class `Document` has no attribute `score` [missing-attribute]
+   --> core/rag/index_processor/processor/parent_child_index_processor.py:249:33
+ERROR Object of class `Document` has no attribute `score` [missing-attribute]
+   --> core/rag/index_processor/processor/parent_child_index_processor.py:250:16
+ERROR Object of class `Document` has no attribute `score` [missing-attribute]
+   --> core/rag/index_processor/processor/qa_index_processor.py:213:33
+ERROR Object of class `Document` has no attribute `score` [missing-attribute]
+   --> core/rag/index_processor/processor/qa_index_processor.py:214:16
+ERROR Argument `DatasetMultiRetrieverTool` is not assignable to parameter `object` with type `DatasetRetrieverTool` in function `list.append` [bad-argument-type]
+    --> core/rag/retrieval/dataset_retrieval.py:1241:26
+ERROR Returned type `list[DatasetRetrieverTool]` is not assignable to declared return type `list[DatasetRetrieverBaseTool] | None` [bad-return]
+    --> core/rag/retrieval/dataset_retrieval.py:1243:16
+ERROR Class member `MCPToolProviderController.entity` overrides parent class `ToolProviderController` in an inconsistent manner [bad-override-mutable-attribute]
+  --> core/tools/mcp_tool/provider.py:34:14
+ERROR Class member `PluginToolProviderController.entity` overrides parent class `BuiltinToolProviderController` in an inconsistent manner [bad-override-mutable-attribute]
+  --> core/tools/plugin_tool/provider.py:12:5
+ERROR `list[Never]` is not assignable to attribute `tools` with type `Never` [bad-assignment]
+   --> core/tools/workflow_as_tool/provider.py:240:26
+ERROR Cannot set item in `dict[str, dict[str, crontab | str]]` [unsupported-operation]
+   --> extensions/ext_celery.py:176:63
+ERROR Cannot set item in `dict[str, dict[str, crontab | str]]` [unsupported-operation]
+   --> extensions/ext_celery.py:194:51
+ERROR Cannot set item in `dict[str, dict[str, crontab | str]]` [unsupported-operation]
+   --> extensions/ext_celery.py:200:53
+ERROR Cannot set item in `dict[str, dict[str, crontab | str]]` [unsupported-operation]
+   --> extensions/ext_celery.py:233:51
+ERROR Cannot set item in `dict[str, dict[str, crontab | str]]` [unsupported-operation]
+   --> extensions/ext_celery.py:239:53
+ERROR Cannot set item in `dict[str, dict[str, crontab | str]]` [unsupported-operation]
+   --> extensions/ext_celery.py:246:61
+ERROR Cannot index into `Literal['']` [bad-index]
+  --> extensions/storage/huawei_obs_storage.py:30:23
+ERROR Cannot index into `Literal['']` [bad-index]
+  --> extensions/storage/huawei_obs_storage.py:35:20
+ERROR Argument `Module[Crypto.Hash.SHA1] | Unknown` is not assignable to parameter with type `Hash | HashModule` [bad-argument-type]
+  --> libs/gmpy2_pkcs10aep_cipher.py:73:49
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `dify_vdb_alibabacloud_mysql.alibabacloud_mysql_vector.AlibabaCloudMySQLVectorFactory.init_vector` [bad-argument-type]
   --> providers/vdb/vdb-alibabacloud-mysql/tests/unit_tests/test_alibabacloud_mysql_factory.py:42:38
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `dify_vdb_alibabacloud_mysql.alibabacloud_mysql_vector.AlibabaCloudMySQLVectorFactory.init_vector` [bad-argument-type]
@@ -460,14 +536,26 @@
    --> providers/vdb/vdb-weaviate/tests/unit_tests/test_weaviate_vector.py:887:42
 ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `dify_vdb_weaviate.weaviate_vector.WeaviateVectorFactory.init_vector` [bad-argument-type]
    --> providers/vdb/vdb-weaviate/tests/unit_tests/test_weaviate_vector.py:916:42
+ERROR No matching overload found for function `flask.helpers.stream_with_context` called with arguments: (Generator[bytes]) [no-matching-overload]
+   --> services/audio_service.py:144:56
+ERROR No matching overload found for function `flask.helpers.stream_with_context` called with arguments: (Generator[bytes]) [no-matching-overload]
+   --> services/audio_service.py:151:52
+ERROR Class member `DocumentIndexingTaskProxy.NORMAL_TASK_FUNC` overrides parent class `BatchDocumentIndexingProxy` in an inconsistent manner [bad-override]
+  --> services/document_indexing_proxy/document_indexing_task_proxy.py:11:5
+ERROR Class member `DocumentIndexingTaskProxy.PRIORITY_TASK_FUNC` overrides parent class `BatchDocumentIndexingProxy` in an inconsistent manner [bad-override]
+  --> services/document_indexing_proxy/document_indexing_task_proxy.py:12:5
+ERROR Class member `DuplicateDocumentIndexingTaskProxy.NORMAL_TASK_FUNC` overrides parent class `BatchDocumentIndexingProxy` in an inconsistent manner [bad-override]
+  --> services/document_indexing_proxy/duplicate_document_indexing_task_proxy.py:14:5
+ERROR Class member `DuplicateDocumentIndexingTaskProxy.PRIORITY_TASK_FUNC` overrides parent class `BatchDocumentIndexingProxy` in an inconsistent manner [bad-override]
+  --> services/document_indexing_proxy/duplicate_document_indexing_task_proxy.py:15:5
 ERROR Object of class `FromClause` has no attribute `metadata` [missing-attribute]
   --> tests/helpers/legacy_model_type_migration.py:64:16
 ERROR Object of class `FromClause` has no attribute `metadata` [missing-attribute]
   --> tests/helpers/legacy_model_type_migration.py:80:16
 ERROR Argument `dict[_KeyType, Any]` is not assignable to parameter `object` with type `dict[str, object]` in function `list.append` [bad-argument-type]
-   --> tests/helpers/legacy_model_type_migration.py:139:23
+   --> tests/helpers/legacy_model_type_migration.py:138:23
 ERROR Object of class `FromClause` has no attribute `insert` [missing-attribute]
-   --> tests/helpers/legacy_model_type_migration.py:183:13
+   --> tests/helpers/legacy_model_type_migration.py:182:13
 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/integration_tests/controllers/openapi/conftest.py:35:43
 ERROR Argument `Literal['owner']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
@@ -602,10 +690,6 @@
    --> tests/integration_tests/workflow/nodes/test_http.py:732:35
 ERROR Argument `_SimpleJinja2Renderer` is not assignable to parameter `jinja2_template_renderer` with type `Jinja2TemplateRenderer` in function `graphon.nodes.template_transform.template_transform_node.TemplateTransformNode.__init__` [bad-argument-type]
   --> tests/integration_tests/workflow/nodes/test_template_transform.py:94:34
-ERROR Object of class `object` has no attribute `strip` [missing-attribute]
-  --> tests/integration_tests/workflow/test_response_stream_filter_integration.py:74:12
-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:658:51
 ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
@@ -613,13 +697,11 @@
 ERROR Object of class `RequestError` has no attribute `response` [missing-attribute]
    --> tests/test_containers_integration_tests/controllers/console/auth/test_oauth.py:248:9
 ERROR `SimpleNamespace` is not assignable to attribute `mcp_ns` with type `Namespace` [bad-assignment]
-  --> tests/test_containers_integration_tests/controllers/mcp/test_mcp.py:22:21
+  --> tests/test_containers_integration_tests/controllers/mcp/test_mcp.py:27:21
 ERROR Attribute `payload` of class `Namespace` is a read-only property and cannot be set [read-only]
-  --> tests/test_containers_integration_tests/controllers/mcp/test_mcp.py:26:5
+  --> tests/test_containers_integration_tests/controllers/mcp/test_mcp.py:31:5
 ERROR Argument `DummyServer` is not assignable to parameter `mcp_server` with type `AppMCPServer` in function `controllers.mcp.mcp.MCPAppApi._validate_server_status` [bad-argument-type]
-   --> tests/test_containers_integration_tests/controllers/mcp/test_mcp.py:455:37
-ERROR Class member `SessionMatcher.__eq__` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
-  --> tests/test_containers_integration_tests/controllers/service_api/dataset/test_dataset.py:28:9
+   --> tests/test_containers_integration_tests/controllers/mcp/test_mcp.py:460:37
 ERROR `in` is not supported between `Literal['webapp-logo']` and `None` [not-iterable]
    --> tests/test_containers_integration_tests/controllers/web/test_site.py:133:16
 ERROR Argument `SimpleNamespace` is not assignable to parameter `webapp_settings` with type `WebAppSettings | None` in function `controllers.web.wraps._validate_user_accessibility` [bad-argument-type]
@@ -661,65 +743,65 @@
 ERROR Object of class `AdvancedChatAppGenerateEntity` has no attribute `workflow_execution_id` [missing-attribute]
    --> tests/test_containers_integration_tests/core/app/layers/test_pause_state_persist_layer.py:535:16
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:38:23
+  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:37:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:53:27
+  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:52:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:73:60
+  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:72:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:78:39
+  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:77:39
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:99:23
+  --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:97:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:111:27
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:109:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:130:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:128:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:153:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:150:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:165:27
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:162:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:184:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:181:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:207:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:203:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:219:27
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:215:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:238:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:234:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:271:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:266:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:282:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:277:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:321:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:310:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:332:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:321:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:363:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:352:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:368:39
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:357:39
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:390:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:378:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:416:27
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:403:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:428:27
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:415:27
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:448:60
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:435:60
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:475:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:461:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:486:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:472:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:504:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:490:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:545:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:530:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:555:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:540:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:593:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:577:23
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:603:23
+   --> tests/test_containers_integration_tests/core/rag/retrieval/test_dataset_retrieval_integration.py:587:23
 ERROR Argument `Connection | Engine` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown]` in function `core.repositories.sqlalchemy_workflow_execution_repository.SQLAlchemyWorkflowExecutionRepository.__init__` [bad-argument-type]
    --> tests/test_containers_integration_tests/core/workflow/test_human_input_resume_node_execution.py:265:29
 ERROR Argument `Connection | Engine` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown]` in function `core.repositories.sqlalchemy_workflow_node_execution_repository.SQLAlchemyWorkflowNodeExecutionRepository.__init__` [bad-argument-type]
@@ -771,7 +853,7 @@
 ERROR Generator function should return `Generator` [bad-return]
   --> tests/test_containers_integration_tests/repositories/test_workflow_run_repository.py:89:56
 ERROR `None` is not subscriptable [unsupported-operation]
-   --> tests/test_containers_integration_tests/services/auth/test_api_key_auth_service.py:196:16
+   --> tests/test_containers_integration_tests/services/auth/test_api_key_auth_service.py:191:16
 ERROR Could not find name `Session` [unknown-name]
   --> tests/test_containers_integration_tests/services/plugin/test_plugin_parameter_service.py:54:37
 ERROR Could not find name `Session` [unknown-name]
@@ -781,27 +863,27 @@
 ERROR Object of class `NoneType` has no attribute `version` [missing-attribute]
   --> tests/test_containers_integration_tests/services/plugin/test_plugin_service.py:71:16
 ERROR Object of class `NoneType` has no attribute `open_id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_account_service.py:558:16
+   --> tests/test_containers_integration_tests/services/test_account_service.py:530: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:1434: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:1625: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:1943: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:1997: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:1998: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:2144: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:2311: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:2319: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:2320: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:2321: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]
@@ -809,269 +891,191 @@
 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]
    --> tests/test_containers_integration_tests/services/test_advanced_prompt_template_service.py:894:63
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_agent_service.py:135:38
+   --> tests/test_containers_integration_tests/services/test_agent_service.py:134:38
 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:566:24
+   --> tests/test_containers_integration_tests/services/test_agent_service.py:565:24
 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:801:24
+   --> tests/test_containers_integration_tests/services/test_agent_service.py:800:24
 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:965:24
+   --> tests/test_containers_integration_tests/services/test_agent_service.py:964:24
 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
+    --> tests/test_containers_integration_tests/services/test_agent_service.py:1005:24
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:103:38
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:102:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:106:81
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:105: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: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: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: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: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:615:92
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:238:65
 ERROR Object of class `str` has no attribute `decode` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:693:33
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:690:33
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:910:27
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:907:27
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:956:27
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:953:27
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `id` [bad-typed-dict-key]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:998:23
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:995:23
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `score_threshold` [bad-typed-dict-key]
-   --> tests/test_containers_integration_tests/services/test_annotation_service.py:999:23
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:996:23
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `embedding_model` [bad-typed-dict-key]
-    --> tests/test_containers_integration_tests/services/test_annotation_service.py:1000:23
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:997:23
 ERROR TypedDict `AnnotationSettingDisabledDict` does not have key `embedding_model` [bad-typed-dict-key]
-    --> 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: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:1303:75
+   --> tests/test_containers_integration_tests/services/test_annotation_service.py:998: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
+   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:222:57
 ERROR Argument `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_api_based_extension_service.py:424:39
+   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:417:39
 ERROR Argument `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_api_based_extension_service.py:431:34
+   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:424:34
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:448:100
+   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:441:72
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:534:85
+   --> tests/test_containers_integration_tests/services/test_api_based_extension_service.py:527:57
 ERROR Argument `Literal['app']` is not assignable to parameter `value` with type `ApiTokenType | SQLCoreOperations[ApiTokenType]` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
   --> tests/test_containers_integration_tests/services/test_api_token_service.py:28:26
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:165:42
+   --> tests/test_containers_integration_tests/services/test_app_dsl_service.py:161: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:925: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:948: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:983: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:1024: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:1310: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
+   --> tests/test_containers_integration_tests/services/test_app_generate_service.py:188: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:447: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:516: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:734:64
 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:761:64
 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:787:68
 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:832: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:958:20
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/services/test_app_service.py:87:38
+  --> tests/test_containers_integration_tests/services/test_app_service.py:84:38
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-  --> tests/test_containers_integration_tests/services/test_app_service.py:96:33
+  --> tests/test_containers_integration_tests/services/test_app_service.py:93:33
 ERROR Argument `str` is not assignable to parameter `mode` with type `Literal['advanced-chat', 'agent', 'agent-chat', 'chat', 'completion', 'workflow']` in function `services.app_service.CreateAppParams.__init__` [bad-argument-type]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:141:22
-ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:147:42
-ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:152:37
-ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:186:46
-ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> 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
-ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:287: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
-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
-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
-ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:362:13
-ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:367: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
-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
+   --> tests/test_containers_integration_tests/services/test_app_service.py:136:22
 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:142:42
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:427:13
+   --> tests/test_containers_integration_tests/services/test_app_service.py:147:37
 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:180:46
 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:230:36
 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:235:68
 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:245:37
 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:289:43
 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:290:49
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/test_containers_integration_tests/services/test_app_service.py:539:49
-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:293:63
 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:294: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:295: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:299: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:301: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:302: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:306:25
 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:308: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:344: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:353: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:357: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:397: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:406: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:409:61
 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:422: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:457: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:481: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:517: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:536: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:569: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:589: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:629: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:682: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:742: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:801: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:860: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:910: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:923: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:961: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:984: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:1020: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:1058: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:1097: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:1176: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:1191: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:1206: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:1222: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:1238: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:1247:25
 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:1256:25
 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:1265: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:1302: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:1316: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
+ERROR Object of class `NoneType` has no attribute `quota_used` [missing-attribute]
+  --> tests/test_containers_integration_tests/services/test_credit_pool_service.py:91:16
+ERROR Object of class `NoneType` has no attribute `quota_used` [missing-attribute]
+   --> tests/test_containers_integration_tests/services/test_credit_pool_service.py:108:16
+ERROR Object of class `NoneType` has no attribute `quota_used` [missing-attribute]
+   --> tests/test_containers_integration_tests/services/test_credit_pool_service.py:123:16
 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 func\n\n... (truncated) ...

@wylswz

wylswz commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Overall LGTM, but the ConversationNotExistsError raised by ConversationService.get_conversation is currently translated to HTTP 400, which does not match the PR description. Consider catching that error and return proper status code.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 51.07% 51.07% 0.00%
Strict coverage 50.58% 50.58% 0.00%
Typed symbols 30,368 30,368 0
Untyped symbols 29,381 29,381 0
Modules 2929 2929 0

@wylswz wylswz self-requested a review June 25, 2026 02:31
Comment thread api/controllers/console/app/completion.py Outdated
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jun 25, 2026

@wylswz wylswz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 25, 2026
@wylswz wylswz added this pull request to the merge queue Jun 25, 2026
Merged via the queue into langgenius:main with commit 31a50a3 Jun 25, 2026
31 checks passed
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:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chatflow hangs on non-existing conversation id

2 participants