mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-10-07 12:58:49 +08:00
fix: default ENABLE_ACP on so ACP agent settings show in OH Cloud (#15183)
This commit is contained in:
@@ -160,12 +160,15 @@ def _get_feature_flags() -> WebClientFeatureFlags:
|
||||
|
||||
Reads ENABLE_BILLING, HIDE_LLM_SETTINGS, ENABLE_JIRA, ENABLE_JIRA_DC,
|
||||
ENABLE_LINEAR, HIDE_USERS_PAGE, HIDE_BILLING_PAGE, HIDE_INTEGRATIONS_PAGE,
|
||||
HIDE_PERSONAL_WORKSPACES, ENABLE_ACP, and OH_ENABLE_ONBOARDING from
|
||||
environment. Each flag is True only if the corresponding env var is
|
||||
exactly 'true', otherwise False.
|
||||
HIDE_PERSONAL_WORKSPACES, and OH_ENABLE_ONBOARDING from environment. Each
|
||||
flag is True only if the corresponding env var is exactly 'true', otherwise
|
||||
False.
|
||||
|
||||
OH_ALLOW_USER_LLM_CONFIGURATION is the exception: it defaults to 'true'
|
||||
when unset so SaaS and existing installs keep the BYOK editing UI.
|
||||
OH_ALLOW_USER_LLM_CONFIGURATION and ENABLE_ACP are the exceptions: they
|
||||
default to 'true' when unset. OH_ALLOW_USER_LLM_CONFIGURATION keeps the
|
||||
BYOK editing UI visible; ENABLE_ACP keeps the ACP agent configuration UI
|
||||
(Settings > Agent) visible on SaaS and existing installs, matching Agent
|
||||
Canvas. Set ENABLE_ACP=false to hide it.
|
||||
"""
|
||||
return WebClientFeatureFlags(
|
||||
enable_billing=os.getenv('ENABLE_BILLING', 'false') == 'true',
|
||||
@@ -182,7 +185,7 @@ def _get_feature_flags() -> WebClientFeatureFlags:
|
||||
'OH_ALLOW_USER_LLM_CONFIGURATION', 'true'
|
||||
)
|
||||
== 'true',
|
||||
enable_acp=os.getenv('ENABLE_ACP', 'false') == 'true',
|
||||
enable_acp=os.getenv('ENABLE_ACP', 'true') == 'true',
|
||||
enable_onboarding=os.getenv('OH_ENABLE_ONBOARDING', 'false') == 'true',
|
||||
enable_automations=os.getenv('ENABLE_AUTOMATIONS', 'true') == 'true',
|
||||
)
|
||||
|
||||
@@ -33,7 +33,10 @@ class WebClientFeatureFlags(BaseModel):
|
||||
# existing installs are unaffected. UI-level only — previously saved BYOK
|
||||
# settings keep working at runtime.
|
||||
allow_user_llm_configuration: bool = True
|
||||
enable_acp: bool = False
|
||||
# Defaults to True so the ACP agent configuration UI (Settings > Agent) is
|
||||
# visible on SaaS and existing installs, matching Agent Canvas. Set
|
||||
# ENABLE_ACP=false to hide it. UI-level only.
|
||||
enable_acp: bool = True
|
||||
deployment_mode: DeploymentMode | None = None
|
||||
enable_onboarding: bool = False
|
||||
enable_automations: bool = True
|
||||
|
||||
@@ -303,6 +303,41 @@ class TestGetFeatureFlags:
|
||||
result = _get_feature_flags()
|
||||
assert result.enable_automations is True
|
||||
|
||||
def test_enable_acp_true_by_default(self):
|
||||
"""When ENABLE_ACP is unset, enable_acp defaults to True.
|
||||
|
||||
Keeps the ACP agent configuration UI (Settings > Agent) visible on
|
||||
SaaS and existing installs, matching Agent Canvas.
|
||||
"""
|
||||
from openhands.app_server.web_client.default_web_client_config_injector import (
|
||||
_get_feature_flags,
|
||||
)
|
||||
|
||||
with patch.dict(os.environ, {}, clear=True):
|
||||
os.environ.pop('ENABLE_ACP', None)
|
||||
result = _get_feature_flags()
|
||||
assert result.enable_acp is True
|
||||
|
||||
def test_enable_acp_false_when_env_var_false(self):
|
||||
"""When ENABLE_ACP is 'false', enable_acp flag is False."""
|
||||
from openhands.app_server.web_client.default_web_client_config_injector import (
|
||||
_get_feature_flags,
|
||||
)
|
||||
|
||||
with patch.dict(os.environ, {'ENABLE_ACP': 'false'}):
|
||||
result = _get_feature_flags()
|
||||
assert result.enable_acp is False
|
||||
|
||||
def test_enable_acp_true_when_env_var_true(self):
|
||||
"""When ENABLE_ACP is 'true', enable_acp flag is True."""
|
||||
from openhands.app_server.web_client.default_web_client_config_injector import (
|
||||
_get_feature_flags,
|
||||
)
|
||||
|
||||
with patch.dict(os.environ, {'ENABLE_ACP': 'true'}):
|
||||
result = _get_feature_flags()
|
||||
assert result.enable_acp is True
|
||||
|
||||
|
||||
class TestGetJiraDcServiceAccountConfig:
|
||||
"""Test cases for Jira DC service-account web-client config helpers."""
|
||||
|
||||
Reference in New Issue
Block a user