Skip to content

Conversation

@Krashnicov
Copy link

Related Issue

Follows up on PR #788 (Subordinate agents settings override)

Problem

When subordinate agents have a settings.json in their profile directory, the profile gets reset to agent0 instead of preserving the intended profile.

Root Cause

In _15_load_profile_settings.py, the extension:

  1. Saves memory_subdir before calling initialize_agent()
  2. Calls initialize_agent(override_settings=...) which creates a NEW config
  3. The new config defaults profile to "agent0" from global settings
  4. Restores memory_subdir but forgets to restore profile

Why working profiles work

Profiles without settings.json (researcher, developer, hacker) skip this extension's logic entirely, so their profile is never overwritten.

Solution

Apply the same preservation pattern used for memory_subdir to profile:

# Before initialize_agent():
original_profile = self.agent.config.profile

# After initialize_agent():
new_config.profile = original_profile

Testing

  1. Create a profile with settings.json (e.g., /agents/arachnia/settings.json)
  2. Call call_subordinate(profile="arachnia", reset=True)
  3. Before fix: Subordinate loads as agent0
  4. After fix: Subordinate loads correctly as arachnia

Checklist

  • Bug identified and root cause analyzed
  • Fix follows existing code patterns
  • Tested locally with custom profile
  • Minimal change (2 lines added)

@Krashnicov Krashnicov changed the base branch from main to development December 28, 2025 16:46
@Krashnicov Krashnicov force-pushed the fix/profile-preservation-bug branch from b59833b to 6baa059 Compare December 28, 2025 17:19
Follows up on PR agent0ai#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.
@Krashnicov Krashnicov force-pushed the fix/profile-preservation-bug branch from 6baa059 to 359bc29 Compare December 28, 2025 17:28
@frdel
Copy link
Collaborator

frdel commented Dec 28, 2025

@linuztx please take a look, it seems like a bug introduced with the subordinate settings override.

In general we should not store memory folder or profile on the side and restore it, we should not make exceptions like this, it should not be overridden in the first place.

Thanks.

@Krashnicov
Copy link
Author

I think it would be useful to be able to override memory settings- particularly interval but also folders (eg if we had a specialist terraform agent that was being asked to do work on a folder) - or indeed if we could combine memory stores (want to use project folder and the default knowledge)

@Krashnicov Krashnicov closed this Jan 11, 2026
@Krashnicov Krashnicov deleted the fix/profile-preservation-bug branch January 11, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants