Keep hidden utility profile out of new chats

Normalize legacy global settings that still select the internal default profile to Agent 0. This keeps fresh chats aligned with the visible profile catalog while preserving existing chat selections.
This commit is contained in:
Alessandro 2026-08-11 23:29:23 +02:00
parent 282f13982b
commit 4f8ae9cc2c
3 changed files with 13 additions and 1 deletions

View file

@ -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(

View file

@ -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

View file

@ -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"