diff --git a/helpers/settings.py b/helpers/settings.py index 9eabff9ee..ddeb02d35 100644 --- a/helpers/settings.py +++ b/helpers/settings.py @@ -434,6 +434,9 @@ def normalize_settings(settings: Settings) -> Settings: except (ValueError, TypeError): copy[key] = value # make default instead + if copy["agent_profile"] == "default": + copy["agent_profile"] = "agent0" + # mcp server token is set automatically copy["mcp_server_token"] = create_auth_token() copy["max_consecutive_unusable_responses"] = max( diff --git a/helpers/settings.py.dox.md b/helpers/settings.py.dox.md index aaf5b3812..bb6d8656b 100644 --- a/helpers/settings.py.dox.md +++ b/helpers/settings.py.dox.md @@ -71,6 +71,8 @@ A currently configured unavailable profile remains visible with an explicit unavailable label so settings can round-trip it truthfully, except that the exact `default` utility profile is never offered as a selectable option. +- Legacy settings that still name the hidden `default` utility profile normalize + to `agent0`, so newly created chats always start with a selectable profile. - Keep request/response, tool, or helper semantics documented here at the same time as source changes. ## Work Guidance diff --git a/tests/test_subagent_profiles.py b/tests/test_subagent_profiles.py index 605e83fd3..30bf312e6 100644 --- a/tests/test_subagent_profiles.py +++ b/tests/test_subagent_profiles.py @@ -5,7 +5,7 @@ from types import SimpleNamespace import pytest from agent import Agent, AgentConfig, AgentContext -from helpers import persist_chat, projects +from helpers import persist_chat, projects, settings from helpers.errors import RepairableException @@ -34,6 +34,13 @@ class _FakeParentAgent: return "" +def test_hidden_default_profile_normalizes_to_agent0() -> None: + configured = settings.get_default_settings() + configured["agent_profile"] = "default" + + assert settings.normalize_settings(configured)["agent_profile"] == "agent0" + + class _FakeSubAgent: DATA_NAME_SUPERIOR = "_superior" DATA_NAME_SUBORDINATE = "_subordinate"