Skip to content

Commit 359bc29

Browse files
committed
Fix: Preserve profile when loading subordinate agent settings
Follows up on PR #788 (Subordinate agents settings override). When subordinate agents have a settings.json in their profile directory, the profile was getting reset to 'agent0' instead of preserving the intended profile. Root cause: initialize_agent() creates a new config with default profile, and while memory_subdir was preserved, the profile was not. Fix: Apply the same preservation pattern used for memory_subdir to profile.
1 parent 601bb56 commit 359bc29

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

python/extensions/agent_init/_15_load_profile_settings.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class LoadProfileSettings(Extension):
7-
7+
88
async def execute(self, **kwargs) -> None:
99

1010
if not self.agent or not self.agent.config.profile:
@@ -36,18 +36,18 @@ async def execute(self, **kwargs) -> None:
3636
if settings_override:
3737
# Preserve the original memory_subdir unless it's explicitly overridden
3838
current_memory_subdir = self.agent.config.memory_subdir
39+
# FIX: Also preserve the original profile
40+
original_profile = self.agent.config.profile
41+
3942
new_config = initialize_agent(override_settings=settings_override)
43+
4044
if (
4145
"agent_memory_subdir" not in settings_override
4246
and current_memory_subdir != "default"
4347
):
4448
new_config.memory_subdir = current_memory_subdir
49+
50+
# FIX: Restore the original profile
51+
new_config.profile = original_profile
52+
4553
self.agent.config = new_config
46-
# self.agent.context.log.log(
47-
# type="info",
48-
# content=(
49-
# "Loaded custom settings for agent "
50-
# f"{self.agent.number} with profile '{self.agent.config.profile}'."
51-
# ),
52-
# )
53-

0 commit comments

Comments
 (0)