Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: return disabled auto-upgrade settings when strategy is missing (#39494)
非法操作aef1c6772116
diff --git a/api/controllers/console/workspace/plugin.py b/api/controllers/console/workspace/plugin.pyindex 33a4f54e69b..98eb1192027 100644--- a/api/controllers/console/workspace/plugin.py+++ b/api/controllers/console/workspace/plugin.py@@ -442,12 +442,10 @@ register_enum_models()-def _default_auto_upgrade_settings(- tenant_id: str,- category: TenantPluginAutoUpgradeCategory,-) -> AutoUpgradeSettingsResponse:+def _missing_auto_upgrade_settings(tenant_id: str) -> AutoUpgradeSettingsResponse:+ """Represent a missing persisted strategy as effectively disabled."""return {- "strategy_setting": PluginAutoUpgradeService.default_strategy_setting_for_category(category),+ "strategy_setting": TenantPluginAutoUpgradeStrategySetting.DISABLED,"upgrade_time_of_day": PluginAutoUpgradeService.default_upgrade_time_of_day(tenant_id),"upgrade_mode": TenantPluginAutoUpgradeMode.EXCLUDE,"exclude_plugins": [],@@ -1135,9 +1133,7 @@ class PluginFetchAutoUpgradeApi(Resource):args = ParserAutoUpgradeFetch.model_validate(request.args.to_dict(flat=True))auto_upgrade = PluginAutoUpgradeService.get_strategy(tenant_id, args.category, session=db.session())auto_upgrade_dict = (- _auto_upgrade_settings_to_dict(auto_upgrade)- if auto_upgrade- else _default_auto_upgrade_settings(tenant_id, args.category)+ _auto_upgrade_settings_to_dict(auto_upgrade) if auto_upgrade else _missing_auto_upgrade_settings(tenant_id))return jsonable_encoder(diff --git a/api/tests/unit_tests/controllers/console/workspace/test_plugin.py b/api/tests/unit_tests/controllers/console/workspace/test_plugin.pyindex 889b4cb6c1a..0cb336cfea8 100644--- a/api/tests/unit_tests/controllers/console/workspace/test_plugin.py+++ b/api/tests/unit_tests/controllers/console/workspace/test_plugin.py@@ -1343,6 +1343,34 @@ class TestPluginFetchAutoUpgradeApi:assert result["category"] == TenantPluginAutoUpgradeCategory.TOOLassert result["auto_upgrade"]["upgrade_time_of_day"] == 1+ def test_returns_disabled_settings_when_strategy_is_missing(self, app: Flask):+ api = PluginFetchAutoUpgradeApi()+ method = unwrap(api.get)++ with (+ app.test_request_context(f"/?category={TenantPluginAutoUpgradeCategory.MODEL.value}"),+ patch(+ "controllers.console.workspace.plugin.PluginAutoUpgradeService.get_strategy",+ return_value=None,+ ),+ patch(+ "controllers.console.workspace.plugin.PluginAutoUpgradeService.default_upgrade_time_of_day",+ return_value=78300,+ ),+ ):+ result = method(api, "t1")++ assert result == {+ "category": TenantPluginAutoUpgradeCategory.MODEL,+ "auto_upgrade": {+ "strategy_setting": TenantPluginAutoUpgradeStrategySetting.DISABLED,+ "upgrade_time_of_day": 78300,+ "upgrade_mode": TenantPluginAutoUpgradeMode.EXCLUDE,+ "exclude_plugins": [],+ "include_plugins": [],+ },+ }+class TestPluginAutoUpgradeExcludePluginApi:def test_success(self, app: Flask):