mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-23 11:34:44 -07:00
fix(core): ensure subagent tool updates apply configuration overrides immediately (#23161)
This commit is contained in:
@@ -3301,9 +3301,28 @@ export class Config implements McpContext, AgentLoopContext {
|
||||
*/
|
||||
private registerSubAgentTools(registry: ToolRegistry): void {
|
||||
const agentsOverrides = this.getAgentsSettings().overrides ?? {};
|
||||
const definitions = this.agentRegistry.getAllDefinitions();
|
||||
const discoveredDefinitions =
|
||||
this.agentRegistry.getAllDiscoveredAgentNames();
|
||||
|
||||
for (const definition of definitions) {
|
||||
// First, unregister any agents that are now disabled
|
||||
for (const agentName of discoveredDefinitions) {
|
||||
if (
|
||||
!this.isAgentsEnabled() ||
|
||||
agentsOverrides[agentName]?.enabled === false
|
||||
) {
|
||||
const tool = registry.getTool(agentName);
|
||||
if (tool instanceof SubagentTool) {
|
||||
registry.unregisterTool(agentName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const discoveredNames = this.agentRegistry.getAllDiscoveredAgentNames();
|
||||
for (const agentName of discoveredNames) {
|
||||
const definition = this.agentRegistry.getDiscoveredDefinition(agentName);
|
||||
if (!definition) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
if (
|
||||
!this.isAgentsEnabled() ||
|
||||
|
||||
Reference in New Issue
Block a user