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.

Alessandro committed Aug 11, 2026 at 23:29 UTC 4f8ae9cc2c4aaa6932bb8ae88c0a72709b498fce
3 files changed +13 -1
helpers/settings.py
+3
@@ -434,6 +434,9 @@ def normalize_settings(settings: Settings) -> Settings:
434 except (ValueError, TypeError):
435 copy[key] = value # make default instead
436
437 + if copy["agent_profile"] == "default":
438 + copy["agent_profile"] = "agent0"
439 +
440 # mcp server token is set automatically
441 copy["mcp_server_token"] = create_auth_token()
442 copy["max_consecutive_unusable_responses"] = max(
helpers/settings.py.dox.md
+2
@@ -71,6 +71,8 @@
71 A currently configured unavailable profile remains visible with an explicit
72 unavailable label so settings can round-trip it truthfully, except that the
73 exact `default` utility profile is never offered as a selectable option.
74 +- Legacy settings that still name the hidden `default` utility profile normalize
75 + to `agent0`, so newly created chats always start with a selectable profile.
76 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
77
78 ## Work Guidance
tests/test_subagent_profiles.py
+8 -1
@@ -5,7 +5,7 @@ from types import SimpleNamespace
5 import pytest
6
7 from agent import Agent, AgentConfig, AgentContext
8 -from helpers import persist_chat, projects
8 +from helpers import persist_chat, projects, settings
9 from helpers.errors import RepairableException
10
11
@@ -34,6 +34,13 @@ class _FakeParentAgent:
34 return ""
35
36
37 +def test_hidden_default_profile_normalizes_to_agent0() -> None:
38 + configured = settings.get_default_settings()
39 + configured["agent_profile"] = "default"
40 +
41 + assert settings.normalize_settings(configured)["agent_profile"] == "agent0"
42 +
43 +
44 class _FakeSubAgent:
45 DATA_NAME_SUPERIOR = "_superior"
46 DATA_NAME_SUBORDINATE = "_subordinate"