From a02817b76aff137eddc8fb167fcd65772471bf24 Mon Sep 17 00:00:00 2001 From: dante01yoon Date: Wed, 4 Nov 2026 19:06:15 -0500 Subject: [PATCH] Turn on local_web_sso and partner_node_token by default Reapplies #17490, reverted in #17514 until the frontend bump and the Cloud callback page landed. --- comfy_api/feature_flags.py | 20 ++++++++++++-------- tests-unit/feature_flags_test.py | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/comfy_api/feature_flags.py b/comfy_api/feature_flags.py index 6bc29ba9c03..569a77c9977 100644 --- a/comfy_api/feature_flags.py +++ b/comfy_api/feature_flags.py @@ -37,12 +37,12 @@ class FeatureFlagInfo(TypedDict): }, "partner_node_token": { "type": "bool", - "default": False, + "default": True, "description": "Queue Local API-node prompts with a renewable partner-node token instead of the workspace token", }, "local_web_sso": { "type": "bool", - "default": False, + "default": True, "description": "Offer Sign in with browser (Cloud OAuth + PKCE) on Local ComfyUI opened at localhost or 127.0.0.1", }, } @@ -126,13 +126,17 @@ def _parse_cli_feature_flags() -> dict[str, Any]: # Owned by app.deploy_to_cloud, which sets it via set_server_feature. _SERVER_SET_FEATURE_FLAGS = ("deploy_to_cloud",) -# CLI-provided flags cannot overwrite core or server-set flags. Startup code may: main.py sets "assets". -_cli_flags = { - k: v for k, v in _parse_cli_feature_flags().items() - if k not in _CORE_FEATURE_FLAGS and k not in _SERVER_SET_FEATURE_FLAGS -} +def _server_feature_flags() -> dict[str, Any]: + """Registry defaults, then core flags, then CLI flags. CLI flags cannot overwrite core or server-set flags; main.py may still set "assets".""" + registry_defaults = {k: info["default"] for k, info in CLI_FEATURE_FLAG_REGISTRY.items()} + cli_flags = { + k: v for k, v in _parse_cli_feature_flags().items() + if k not in _CORE_FEATURE_FLAGS and k not in _SERVER_SET_FEATURE_FLAGS + } + return {**registry_defaults, **_CORE_FEATURE_FLAGS, **cli_flags} + -SERVER_FEATURE_FLAGS: dict[str, Any] = {**_CORE_FEATURE_FLAGS, **_cli_flags} +SERVER_FEATURE_FLAGS: dict[str, Any] = _server_feature_flags() def get_connection_feature( diff --git a/tests-unit/feature_flags_test.py b/tests-unit/feature_flags_test.py index d68b044e06b..b483a1b9cbb 100644 --- a/tests-unit/feature_flags_test.py +++ b/tests-unit/feature_flags_test.py @@ -10,6 +10,7 @@ SERVER_FEATURE_FLAGS, _coerce_flag_value, _parse_cli_feature_flags, + _server_feature_flags, ) from app.comfy_api_env import ( environment_overrides_for_base, @@ -193,6 +194,25 @@ def test_invalid_bool_value_dropped(self, monkeypatch, caplog): class TestCliFeatureFlagRegistry: """Test suite for the CLI feature flag registry.""" + @pytest.mark.parametrize("key", ["partner_node_token", "local_web_sso"]) + def test_local_sso_flags_are_on_by_default(self, key): + assert CLI_FEATURE_FLAG_REGISTRY[key]["default"] is True + + def test_server_features_report_registry_defaults(self, monkeypatch): + monkeypatch.setattr("comfy_api.feature_flags.args", type("Args", (), {"feature_flag": []})()) + features = _server_feature_flags() + for key, info in CLI_FEATURE_FLAG_REGISTRY.items(): + assert features[key] == info["default"], key + + @pytest.mark.parametrize("key", ["partner_node_token", "local_web_sso"]) + def test_cli_flag_turns_a_default_on_flag_off(self, monkeypatch, key): + monkeypatch.setattr("comfy_api.feature_flags.args", type("Args", (), {"feature_flag": [f"{key}=false"]})()) + assert _server_feature_flags()[key] is False + + def test_cli_flags_cannot_override_core_flags(self, monkeypatch): + monkeypatch.setattr("comfy_api.feature_flags.args", type("Args", (), {"feature_flag": ["node_replacements=false"]})()) + assert _server_feature_flags()["node_replacements"] is True + def test_registry_entries_have_required_fields(self): for key, info in CLI_FEATURE_FLAG_REGISTRY.items(): assert "type" in info, f"{key} missing 'type'"