fix(workflow): unblock plugin model selector tools on 1.14.0#35794
Merged
fatelei merged 2 commits intoMay 6, 2026
Merged
Conversation
This fixes a severe 1.14 regression where plugin tools using model-selector params failed before invocation with 'The selector must be a dictionary', blocking LLM/TTS model selection in plugin workflows.
6 tasks
6 tasks
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-05-06 03:10:30.965640898 +0000
+++ /tmp/pyrefly_pr.txt 2026-05-06 03:10:17.273530065 +0000
@@ -1,7 +1,7 @@
ERROR Object of class `Server` has no attribute `app` [missing-attribute]
--> app_factory.py:132:5
ERROR Object of class `App` has no attribute `access_mode` [missing-attribute]
- --> controllers/console/app/app.py:573:13
+ --> controllers/console/app/app.py:553:13
ERROR Argument `str | None` is not assignable to parameter `language` with type `str` in function `services.account_service.AccountService.send_email_register_email` [bad-argument-type]
--> controllers/console/auth/email_register.py:75:108
ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
@@ -764,8 +764,6 @@
--> tests/test_containers_integration_tests/core/workflow/test_human_input_resume_node_execution.py:270:29
ERROR Argument `Literal['owner']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/helpers/execution_extra_content.py:48:14
-ERROR Returned type `int | str` is not assignable to declared return type `str` [bad-return]
- --> tests/test_containers_integration_tests/libs/broadcast_channel/redis/test_sharded_channel.py:363:16
ERROR Object of class `TypeEngine` has no attribute `length` [missing-attribute]
--> tests/test_containers_integration_tests/models/test_types_enum_text.py:104:16
ERROR Object of class `NoneType` has no attribute `user_type` [missing-attribute]
@@ -1807,29 +1805,27 @@
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
--> tests/unit_tests/controllers/console/app/test_annotation_security.py:256:35
ERROR Object of class `ModuleType` has no attribute `console_ns` [missing-attribute]
- --> tests/unit_tests/controllers/console/app/test_app_response_models.py:72:5
+ --> tests/unit_tests/controllers/console/app/test_app_response_models.py:70:5
ERROR Object of class `ModuleType` has no attribute `api` [missing-attribute]
- --> tests/unit_tests/controllers/console/app/test_app_response_models.py:73:5
+ --> tests/unit_tests/controllers/console/app/test_app_response_models.py:71:5
ERROR Object of class `ModuleType` has no attribute `bp` [missing-attribute]
- --> tests/unit_tests/controllers/console/app/test_app_response_models.py:74:5
+ --> tests/unit_tests/controllers/console/app/test_app_response_models.py:72:5
ERROR Object of class `ModuleType` has no attribute `app` [missing-attribute]
- --> tests/unit_tests/controllers/console/app/test_app_response_models.py:80:5
+ --> tests/unit_tests/controllers/console/app/test_app_response_models.py:78:5
ERROR Argument `ModuleSpec | None` is not assignable to parameter `spec` with type `ModuleSpec` in function `_frozen_importlib.module_from_spec` [bad-argument-type]
- --> tests/unit_tests/controllers/console/app/test_app_response_models.py:109:36
+ --> tests/unit_tests/controllers/console/app/test_app_response_models.py:107:36
ERROR Object of class `NoneType` has no attribute `loader` [missing-attribute]
- --> tests/unit_tests/controllers/console/app/test_app_response_models.py:112:12
+ --> tests/unit_tests/controllers/console/app/test_app_response_models.py:110:12
ERROR Object of class `object` has no attribute `exec_module` [missing-attribute]
- --> tests/unit_tests/controllers/console/app/test_app_response_models.py:113:5
+ --> tests/unit_tests/controllers/console/app/test_app_response_models.py:111:5
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `controllers.console.app.workflow._parse_file` [bad-argument-type]
--> tests/unit_tests/controllers/console/app/test_workflow.py:26:40
ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `controllers.console.app.workflow._parse_file` [bad-argument-type]
--> tests/unit_tests/controllers/console/app/test_workflow.py:44:42
ERROR Object of class `FunctionType` has no attribute `assert_called_once_with` [missing-attribute]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:406:5
-ERROR Object of class `FunctionType` has no attribute `call_count` [missing-attribute]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:438:12
+ --> tests/unit_tests/controllers/console/app/test_workflow.py:405:5
ERROR `in` is not supported between `Literal['Maximum']` and `None` [not-iterable]
- --> tests/unit_tests/controllers/console/app/test_workflow.py:466:12
+ --> tests/unit_tests/controllers/console/app/test_workflow.py:433:12
ERROR Argument `dict[str, float | list[Unknown] | str]` is not assignable to parameter `payload` with type `dict[str, object] | None` in function `_patch_payload` [bad-argument-type]
--> tests/unit_tests/controllers/console/app/test_workflow_comment_api.py:157:29
ERROR Argument `dict[str, float | str]` is not assignable to parameter `payload` with type `dict[str, object] | None` in function `_patch_payload` [bad-argument-type]
@@ -5425,11 +5421,11 @@
ERROR Object of class `_InteractiveSurfaceDeliveryConfig` has no attribute `recipients` [missing-attribute]
--> tests/unit_tests/core/workflow/test_human_input_adapter.py:87:12
ERROR Argument `Literal[123]` is not assignable to parameter `node_data` with type `BaseModel | Mapping[str, Any]` in function `core.workflow.human_input_adapter.adapt_human_input_node_data_for_graph` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_human_input_adapter.py:214:47
+ --> tests/unit_tests/core/workflow/test_human_input_adapter.py:279:47
ERROR Argument `Literal[123]` is not assignable to parameter `node_data` with type `BaseModel | Mapping[str, Any]` in function `core.workflow.human_input_adapter.adapt_node_data_for_graph` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_human_input_adapter.py:300:35
+ --> tests/unit_tests/core/workflow/test_human_input_adapter.py:365:35
ERROR Argument `Literal[123]` is not assignable to parameter `node_config` with type `BaseModel | Mapping[str, Any]` in function `core.workflow.human_input_adapter.adapt_node_config_for_graph` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_human_input_adapter.py:305:37
+ --> tests/unit_tests/core/workflow/test_human_input_adapter.py:370:37
ERROR Argument `_FakeSession` is not assignable to parameter `session` with type `Session | None` in function `core.workflow.human_input_forms.load_form_tokens_by_form_id` [bad-argument-type]
--> tests/unit_tests/core/workflow/test_human_input_forms.py:37:60
ERROR Argument `_FakeSession` is not assignable to parameter `session` with type `Session | None` in function `core.workflow.human_input_forms.load_form_tokens_by_form_id` [bad-argument-type]
@@ -5455,23 +5451,23 @@
ERROR `SimpleNamespace` is not assignable to attribute `graph_runtime_state` with type `GraphRuntimeState` [bad-assignment]
--> tests/unit_tests/core/workflow/test_node_factory.py:771:39
ERROR Object of class `ExternalRecipient` has no attribute `reference_id` [missing-attribute]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:88:12
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:90:12
ERROR Argument `object` is not assignable to parameter `method` with type `EmailDeliveryMethod | InteractiveSurfaceDeliveryMethod` in function `core.workflow.node_runtime.apply_dify_debug_email_recipient` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:103:45
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:105:45
ERROR Argument `SimpleNamespace` is not assignable to parameter `model_instance` with type `ModelInstance` in function `core.workflow.node_runtime.DifyPreparedLLM.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:135:32
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:137:32
ERROR Argument `SimpleNamespace` is not assignable to parameter `model_instance` with type `ModelInstance` in function `core.workflow.node_runtime.DifyPreparedLLM.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:170:32
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:172:32
ERROR Argument `SimpleNamespace` is not assignable to parameter `model_instance` with type `ModelInstance` in function `core.workflow.node_runtime.DifyPreparedLLM.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:183:32
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:185:32
ERROR Argument `SimpleNamespace` is not assignable to parameter `model_instance` with type `ModelInstance` in function `core.workflow.node_runtime.DifyPreparedLLM.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:209:32
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:211:32
ERROR Argument `Literal['chat']` is not assignable to parameter `model_mode` with type `LLMMode` in function `core.workflow.node_runtime.DifyPromptMessageSerializer.serialize` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:220:20
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:222:20
ERROR Argument `SimpleNamespace` is not assignable to parameter `file_reference_factory` with type `FileReferenceFactoryProtocol` in function `core.workflow.node_runtime.DifyRetrieverAttachmentLoader.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:255:32
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:257:32
ERROR Object of class `NoneType` has no attribute `storage_key` [missing-attribute]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:266:12
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:268:12
ERROR Argument `list[VariableBase]` is not assignable to parameter `variables` with type `Sequence[Variable]` in function `core.workflow.variable_pool_initializer.add_variables_to_pool` [bad-argument-type]
--> tests/unit_tests/core/workflow/test_variable_pool.py:94:13
ERROR Argument `TestWorkflowEntry.test_single_step_run_injects_code_limits.StubWorkflow` is not assignable to parameter `workflow` with type `Workflow` in function `core.workflow.workflow_entry.WorkflowEntry.single_step_run` [bad-argument-type]
|
Contributor
|
style check failed |
Cast validated selector payloads after plugin model selector normalization so Python Style passes while preserving the severe 1.14 regression fix.
Contributor
Author
fixed,please help to recheck |
Contributor
Author
@fatelei fixed,please help to recheck |
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-05-06 04:24:44.008366591 +0000
+++ /tmp/pyrefly_pr.txt 2026-05-06 04:24:30.456293337 +0000
@@ -5425,11 +5425,11 @@
ERROR Object of class `_InteractiveSurfaceDeliveryConfig` has no attribute `recipients` [missing-attribute]
--> tests/unit_tests/core/workflow/test_human_input_adapter.py:87:12
ERROR Argument `Literal[123]` is not assignable to parameter `node_data` with type `BaseModel | Mapping[str, Any]` in function `core.workflow.human_input_adapter.adapt_human_input_node_data_for_graph` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_human_input_adapter.py:214:47
+ --> tests/unit_tests/core/workflow/test_human_input_adapter.py:279:47
ERROR Argument `Literal[123]` is not assignable to parameter `node_data` with type `BaseModel | Mapping[str, Any]` in function `core.workflow.human_input_adapter.adapt_node_data_for_graph` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_human_input_adapter.py:300:35
+ --> tests/unit_tests/core/workflow/test_human_input_adapter.py:365:35
ERROR Argument `Literal[123]` is not assignable to parameter `node_config` with type `BaseModel | Mapping[str, Any]` in function `core.workflow.human_input_adapter.adapt_node_config_for_graph` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_human_input_adapter.py:305:37
+ --> tests/unit_tests/core/workflow/test_human_input_adapter.py:370:37
ERROR Argument `_FakeSession` is not assignable to parameter `session` with type `Session | None` in function `core.workflow.human_input_forms.load_form_tokens_by_form_id` [bad-argument-type]
--> tests/unit_tests/core/workflow/test_human_input_forms.py:37:60
ERROR Argument `_FakeSession` is not assignable to parameter `session` with type `Session | None` in function `core.workflow.human_input_forms.load_form_tokens_by_form_id` [bad-argument-type]
@@ -5455,23 +5455,23 @@
ERROR `SimpleNamespace` is not assignable to attribute `graph_runtime_state` with type `GraphRuntimeState` [bad-assignment]
--> tests/unit_tests/core/workflow/test_node_factory.py:771:39
ERROR Object of class `ExternalRecipient` has no attribute `reference_id` [missing-attribute]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:88:12
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:90:12
ERROR Argument `object` is not assignable to parameter `method` with type `EmailDeliveryMethod | InteractiveSurfaceDeliveryMethod` in function `core.workflow.node_runtime.apply_dify_debug_email_recipient` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:103:45
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:105:45
ERROR Argument `SimpleNamespace` is not assignable to parameter `model_instance` with type `ModelInstance` in function `core.workflow.node_runtime.DifyPreparedLLM.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:135:32
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:137:32
ERROR Argument `SimpleNamespace` is not assignable to parameter `model_instance` with type `ModelInstance` in function `core.workflow.node_runtime.DifyPreparedLLM.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:170:32
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:172:32
ERROR Argument `SimpleNamespace` is not assignable to parameter `model_instance` with type `ModelInstance` in function `core.workflow.node_runtime.DifyPreparedLLM.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:183:32
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:185:32
ERROR Argument `SimpleNamespace` is not assignable to parameter `model_instance` with type `ModelInstance` in function `core.workflow.node_runtime.DifyPreparedLLM.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:209:32
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:211:32
ERROR Argument `Literal['chat']` is not assignable to parameter `model_mode` with type `LLMMode` in function `core.workflow.node_runtime.DifyPromptMessageSerializer.serialize` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:220:20
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:222:20
ERROR Argument `SimpleNamespace` is not assignable to parameter `file_reference_factory` with type `FileReferenceFactoryProtocol` in function `core.workflow.node_runtime.DifyRetrieverAttachmentLoader.__init__` [bad-argument-type]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:255:32
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:257:32
ERROR Object of class `NoneType` has no attribute `storage_key` [missing-attribute]
- --> tests/unit_tests/core/workflow/test_node_runtime.py:266:12
+ --> tests/unit_tests/core/workflow/test_node_runtime.py:268:12
ERROR Argument `list[VariableBase]` is not assignable to parameter `variables` with type `Sequence[Variable]` in function `core.workflow.variable_pool_initializer.add_variables_to_pool` [bad-argument-type]
--> tests/unit_tests/core/workflow/test_variable_pool.py:94:13
ERROR Argument `TestWorkflowEntry.test_single_step_run_injects_code_limits.StubWorkflow` is not assignable to parameter `workflow` with type `Workflow` in function `core.workflow.workflow_entry.WorkflowEntry.single_step_run` [bad-argument-type]
|
fatelei
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes a severe 1.14 regression where plugin tools using model-selector params failed before invocation with 'The selector must be a dictionary', blocking LLM/TTS model selection in plugin workflows.
This blocks plugin tools that rely on Dify platform model selection from running at all.
This PR fixes the model selector parameter flow by:
• Preserving model/app selector dictionaries instead of flattening them as primitive tool configuration values.
• Moving legacy selector-shaped tool configurations into tool_parameters, where structured constant values are supported by graph validation.
• Merging tool_parameters into the workflow tool runtime spec so plugin runtime invocation still receives the selected model config.
• Adding regression tests for LLM and TTS model selector payloads.
Summary
resolves #35816
Fixes a severe regression introduced in 1.14 where plugin workflow tools using
model-selectorparameters fail before the plugin is invoked.When a plugin tool defines a Dify model selector parameter, such as an LLM or TTS model field, workflow execution can fail with:
Failed to invoke tool: The selector must be a dictionary.
Screenshots
Checklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods